Documentation for update manager.

This commit is contained in:
Martin Fietz 2015-08-01 16:05:25 +02:00
parent 4f7566ddfc
commit 759a7bb5ac
2 changed files with 7 additions and 6 deletions

View File

@ -38,7 +38,6 @@ public class PodcastApp extends Application {
singleton = this; singleton = this;
LOGICAL_DENSITY = getResources().getDisplayMetrics().density; LOGICAL_DENSITY = getResources().getDisplayMetrics().density;
// PicassoProvider.setupPicassoInstance(this);
UpdateManager.init(this); UpdateManager.init(this);
UserPreferences.init(this); UserPreferences.init(this);
PlaybackPreferences.init(this); PlaybackPreferences.init(this);

View File

@ -16,6 +16,9 @@ import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
/*
* This class's job is do perform maintenance tasks whenever the app has been updated
*/
public class UpdateManager { public class UpdateManager {
public static final String TAG = UpdateManager.class.getSimpleName(); public static final String TAG = UpdateManager.class.getSimpleName();
@ -38,6 +41,7 @@ public class UpdateManager {
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Failed to obtain package info for package name: " + context.getPackageName(), e); Log.e(TAG, "Failed to obtain package info for package name: " + context.getPackageName(), e);
currentVersionCode = 0; currentVersionCode = 0;
return;
} }
final int oldVersionCode = getStoredVersionCode(); final int oldVersionCode = getStoredVersionCode();
Log.d(TAG, "old: " + oldVersionCode + ", current: " + currentVersionCode); Log.d(TAG, "old: " + oldVersionCode + ", current: " + currentVersionCode);
@ -47,10 +51,6 @@ public class UpdateManager {
} }
} }
public static int getCurrentVersionCode() {
return currentVersionCode;
}
public static int getStoredVersionCode() { public static int getStoredVersionCode() {
return prefs.getInt(KEY_VERSION_CODE, -1); return prefs.getInt(KEY_VERSION_CODE, -1);
} }
@ -60,7 +60,9 @@ public class UpdateManager {
} }
private static void onUpgrade(final int oldVersionCode, final int newVersionCode) { private static void onUpgrade(final int oldVersionCode, final int newVersionCode) {
if(oldVersionCode < 1030000) { if(oldVersionCode < 1030099) {
// delete the now obsolete image cache
// from now on, Glide will handle caching images
new Thread() { new Thread() {
public void run() { public void run() {
List<Feed> feeds = DBReader.getFeedList(context); List<Feed> feeds = DBReader.getFeedList(context);