List of usage examples for android.app Activity getSharedPreferences
@Override public SharedPreferences getSharedPreferences(String name, int mode)
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns stored model value for the spinner in the ColorsFragment * * @param a activity calling//from ww w.ja v a 2 s. c om * @return integer value of model */ public static int getModel(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("MODEL", Context.MODE_PRIVATE); return sharedPref.getInt("model", 0); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns stored front color value/*w w w . ja va 2 s . c om*/ * * @param a activity calling * @return integer value of front */ public static int getFrontColor(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("COLORS", Context.MODE_PRIVATE); return sharedPref.getInt("front", 0); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns stored accent color value//from w w w .jav a2s . co m * * @param a activity calling * @return integer value of accent */ public static int getAccentColor(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("COLORS", Context.MODE_PRIVATE); return sharedPref.getInt("accent", 0); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns stored back color value// w w w .j a v a2 s . com * * @param a activity calling * @return integer value of back */ public static int getBackColor(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("COLORS", Context.MODE_PRIVATE); return sharedPref.getInt("back", 0); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns stored value set for bgColor (0=front, 1=back, 2=accent) * * @param a the current activity//from w ww . ja v a 2 s. c o m * @return background color value */ public static int getBackgroundColor(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("WALL_CONFIG", Context.MODE_PRIVATE); return sharedPref.getInt("bgColor", 0); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns stored value set for fgColor (0=front, 1=back, 2=accent) * * @param a the current activity//from w ww . j a v a 2 s .com * @return background color value */ public static int getForegroundColor(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("WALL_CONFIG", Context.MODE_PRIVATE); return sharedPref.getInt("fgColor", 1); //defaults to back color }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Checks if user has purchased a premium license or not * * @param a the current activity/* w w w.jav a 2 s . c o m*/ * @return premium status as a boolean */ public static boolean getPremiumStatus(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("PREMIUM", Context.MODE_PRIVATE); return sharedPref.getBoolean("premium", false); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Returns whether or not this is the first time the app has been opened * * @param a current activity/* w w w . ja va2s. c om*/ * @return if first launch or not */ public static boolean isFirstLaunch(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("FIRST", Context.MODE_PRIVATE); return sharedPref.getBoolean("first", true); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * App has been launched, set first to false */// w w w . ja v a 2 s . co m public static void appHasLaunched(Activity a) { SharedPreferences sharedPref = a.getSharedPreferences("FIRST", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean("first", false); editor.apply(); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Saves device configuration for later//from w w w .ja v a2s.c o m * * @param a the activity doing the save * @param param integer that will be the value stored * @param type determines what type of data is being saved * @param pref the name of the preference */ public static void saveDeviceConfig(Activity a, int param, String type, String pref) { SharedPreferences sharedPref = a.getSharedPreferences(pref, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt(type, param); editor.apply(); }