Replace DB entries on conflict
In this way we could add previously unknown info such as the size.
This commit is contained in:
@@ -138,7 +138,9 @@ public class UpdaterController implements UpdaterControllerInt {
|
|||||||
if (contentLenght != null) {
|
if (contentLenght != null) {
|
||||||
try {
|
try {
|
||||||
long size = Long.parseLong(contentLenght);
|
long size = Long.parseLong(contentLenght);
|
||||||
update.setFileSize(size);
|
if (size > 0) {
|
||||||
|
update.setFileSize(size);
|
||||||
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(TAG, "Could not get content-length");
|
Log.e(TAG, "Could not get content-length");
|
||||||
}
|
}
|
||||||
@@ -149,7 +151,7 @@ public class UpdaterController implements UpdaterControllerInt {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mUpdatesDbHelper.addUpdateWithOnConflict(update,
|
mUpdatesDbHelper.addUpdateWithOnConflict(update,
|
||||||
SQLiteDatabase.CONFLICT_IGNORE);
|
SQLiteDatabase.CONFLICT_REPLACE);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
notifyUpdateChange(downloadId);
|
notifyUpdateChange(downloadId);
|
||||||
|
Reference in New Issue
Block a user