Avoid redundant info in history

git-svn-id: https://zxing.googlecode.com/svn/trunk@2688 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-04-25 14:13:15 +00:00
parent 7c6ac647e3
commit 82e05d1c51
2 changed files with 14 additions and 5 deletions

View file

@ -204,10 +204,19 @@ public final class HistoryManager {
}
if (oldID != null) {
String newDetails = oldDetails == null ? itemDetails : oldDetails + " : " + itemDetails;
ContentValues values = new ContentValues();
values.put(DBHelper.DETAILS_COL, newDetails);
db.update(DBHelper.TABLE_NAME, values, DBHelper.ID_COL + "=?", new String[] { oldID });
String newDetails;
if (oldDetails == null) {
newDetails = itemDetails;
} else if (oldDetails.contains(itemDetails)) {
newDetails = null;
} else {
newDetails = oldDetails + " : " + itemDetails;
}
if (newDetails != null) {
ContentValues values = new ContentValues();
values.put(DBHelper.DETAILS_COL, newDetails);
db.update(DBHelper.TABLE_NAME, values, DBHelper.ID_COL + "=?", new String[] { oldID });
}
}
} finally {

View file

@ -108,7 +108,7 @@ public abstract class SupplementalInfoRetriever extends AsyncTask<Object,Object,
StringBuilder newTextCombined = new StringBuilder();
if (source != null) {
newTextCombined.append(source).append(" : ");
newTextCombined.append(source).append(' ');
}
int linkStart = newTextCombined.length();