Databases is now loaded even if no storage is available

This commit is contained in:
daniel oeh 2012-07-22 18:25:15 +02:00
parent d061f86266
commit 8fb81fa799
2 changed files with 11 additions and 9 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ local.properties
# other # other
*.odg# *.odg#
Docs/todo Docs/todo
Docs/market

View File

@ -27,7 +27,7 @@ public class PodcastApp extends Application implements
public static final String PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY = "prefDownloadMediaOnWifiOnly"; public static final String PREF_DOWNLOAD_MEDIA_ON_WIFI_ONLY = "prefDownloadMediaOnWifiOnly";
public static final String PREF_UPDATE_INTERVALL = "prefAutoUpdateIntervall"; public static final String PREF_UPDATE_INTERVALL = "prefAutoUpdateIntervall";
public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate"; public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate";
private static float LOGICAL_DENSITY; private static float LOGICAL_DENSITY;
private static PodcastApp singleton; private static PodcastApp singleton;
@ -44,10 +44,8 @@ public class PodcastApp extends Application implements
SharedPreferences prefs = PreferenceManager SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(this); .getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(this); prefs.registerOnSharedPreferenceChangeListener(this);
if (StorageUtils.storageAvailable()) { FeedManager manager = FeedManager.getInstance();
FeedManager manager = FeedManager.getInstance(); manager.loadDBData(getApplicationContext());
manager.loadDBData(getApplicationContext());
}
} }
@Override @Override
@ -60,7 +58,8 @@ public class PodcastApp extends Application implements
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) { String key) {
if (AppConfig.DEBUG) Log.d(TAG, "Registered change of application preferences"); if (AppConfig.DEBUG)
Log.d(TAG, "Registered change of application preferences");
if (key.equals(PREF_UPDATE_INTERVALL)) { if (key.equals(PREF_UPDATE_INTERVALL)) {
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
int hours = Integer.parseInt(sharedPreferences.getString( int hours = Integer.parseInt(sharedPreferences.getString(
@ -72,13 +71,15 @@ public class PodcastApp extends Application implements
long newIntervall = TimeUnit.HOURS.toMillis(hours); long newIntervall = TimeUnit.HOURS.toMillis(hours);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
newIntervall, newIntervall, updateIntent); newIntervall, newIntervall, updateIntent);
if (AppConfig.DEBUG) Log.d(TAG, "Changed alarm to new intervall"); if (AppConfig.DEBUG)
Log.d(TAG, "Changed alarm to new intervall");
} else { } else {
if (AppConfig.DEBUG) Log.d(TAG, "Automatic update was deactivated"); if (AppConfig.DEBUG)
Log.d(TAG, "Automatic update was deactivated");
} }
} }
} }
public static float getLogicalDensity() { public static float getLogicalDensity() {
return LOGICAL_DENSITY; return LOGICAL_DENSITY;
} }