diff options
| -rw-r--r-- | main/src/cgeo/geocaching/Settings.java | 6 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/backup/CentralBackupAgent.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/utils/ApplicationSettings.java | 24 |
3 files changed, 26 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 7e6f91f..850c4f4 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -1359,12 +1359,6 @@ public final class Settings { } } - public static String getPreferencesName() { - // There is currently no Android API to get the file name of the shared preferences. Let's hardcode - // it without needing a cgeoapplication instance. - return "cgeo.geocaching_preferences"; - } - public static boolean getPlainLogs() { return sharedPrefs.getBoolean(KEY_PLAIN_LOGS, false); } diff --git a/main/src/cgeo/geocaching/backup/CentralBackupAgent.java b/main/src/cgeo/geocaching/backup/CentralBackupAgent.java index f6b9024..28a668c 100644 --- a/main/src/cgeo/geocaching/backup/CentralBackupAgent.java +++ b/main/src/cgeo/geocaching/backup/CentralBackupAgent.java @@ -1,6 +1,6 @@ package cgeo.geocaching.backup; -import cgeo.geocaching.Settings; +import cgeo.geocaching.utils.ApplicationSettings; import android.annotation.TargetApi; import android.app.backup.BackupAgentHelper; @@ -13,7 +13,7 @@ public class CentralBackupAgent extends BackupAgentHelper { @Override public void onCreate() { - final SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, Settings.getPreferencesName()); + final SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, ApplicationSettings.getPreferencesName()); addHelper(PREFS_BACKUP_KEY, helper); } diff --git a/main/src/cgeo/geocaching/utils/ApplicationSettings.java b/main/src/cgeo/geocaching/utils/ApplicationSettings.java new file mode 100644 index 0000000..99d3142 --- /dev/null +++ b/main/src/cgeo/geocaching/utils/ApplicationSettings.java @@ -0,0 +1,24 @@ +package cgeo.geocaching.utils; + +/** + * This utility class contains static settings that do not require a context or + * an application. It may not depend or use any other package from c:geo. + * <br/> + * It is used, for example, to get some settings for the BackupAgent. In this case, + * no application is instantiated by the OS. + */ + +public class ApplicationSettings { + + /** + * Get the name of the preferences file. + * + * @return the name of the shared preferences file without the extension + */ + public static String getPreferencesName() { + // There is currently no Android API to get the file name of the shared preferences. Let's hardcode + // it without needing a cgeoapplication instance. + return "cgeo.geocaching_preferences"; + } + +} |
