
package com.battlelancer.seriesguide.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Access advanced settings for auto backup.
 */
public class AdvancedSettings {

    public static final String KEY_AUTOBACKUP = "com.battlelancer.seriesguide.autobackup";

    public static final String KEY_LASTBACKUP = "com.battlelancer.seriesguide.lastbackup";

    public static boolean isAutoBackupEnabled(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_AUTOBACKUP,
                true);
    }

    public static long getLastAutoBackupTime(Context context) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

        long time = prefs.getLong(KEY_LASTBACKUP, 0);
        if (time == 0) {
            // use now as default value, so a re-install won't overwrite the old
            // auto-backup right away
            time = System.currentTimeMillis();
            prefs.edit().putLong(KEY_LASTBACKUP, time).commit();
        }

        return time;
    }
}

@@ -205,16 +205,32 @@
 o backup
+ and auto update
 .%0A */%0Apu
@@ -260,16 +260,108 @@
 ings %7B%0A%0A
+    public static final String KEY_LASTUPDATE = %22com.battlelancer.seriesguide.lastupdate%22;%0A%0A
     publ
@@ -528,32 +528,517 @@
 e.lastbackup%22;%0A%0A
+    public static long getLastAutoUpdateTime(Context context) %7B%0A        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);%0A%0A        long time = prefs.getLong(KEY_LASTUPDATE, 0);%0A        if (time == 0) %7B%0A            // use now as default value, so auto-update will not run on first%0A            // launch%0A            time = System.currentTimeMillis();%0A            prefs.edit().putLong(KEY_LASTUPDATE, time).commit();%0A        %7D%0A%0A        return time;%0A    %7D%0A%0A
     public stati

Add last update time to AdvancedSettings.