Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/data/PreferencesHolder.java
Show All 22 Lines | |||||
import static android.content.Context.MODE_PRIVATE; | import static android.content.Context.MODE_PRIVATE; | ||||
/** | /** | ||||
* Static class for commonly used SharedPreference operations | * Static class for commonly used SharedPreference operations | ||||
*/ | */ | ||||
public abstract class PreferencesHolder { | public abstract class PreferencesHolder { | ||||
public static final String PREF_GTFS_DB_VERSION = "gtfs_db_version"; | |||||
public static SharedPreferences getMainSharedPreferences(Context context){ | public static SharedPreferences getMainSharedPreferences(Context context){ | ||||
return context.getSharedPreferences(context.getString(R.string.mainSharedPreferences), MODE_PRIVATE); | return context.getSharedPreferences(context.getString(R.string.mainSharedPreferences), MODE_PRIVATE); | ||||
} | } | ||||
public static int getGtfsDBVersion(SharedPreferences pref){ | |||||
return pref.getInt(PREF_GTFS_DB_VERSION,-1); | |||||
} | |||||
public static void setGtfsDBVersion(SharedPreferences pref,int version){ | |||||
SharedPreferences.Editor ed = pref.edit(); | |||||
ed.putInt(PREF_GTFS_DB_VERSION,version); | |||||
ed.apply(); | |||||
} | |||||
} | } |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register