/** * Reads the photo booth mode preference. * * @param context the {@link Context}. * @return the stored {@link PhotoBoothMode}. */ public PhotoBoothMode getPhotoBoothMode(Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); String mode = preferences.getString(KEY_PHOTO_BOOTH_MODE, PhotoBoothMode.SELF_SERVE.name()); return PhotoBoothMode.valueOf(mode); }
/** * Stores the photo booth mode preference. * * @param context the {@link Context}. * @param mode one of {@link PhotoBoothMode}. Must not be null. */ public void storePhotoBoothMode(Context context, PhotoBoothMode mode) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); preferences.edit().putString(KEY_PHOTO_BOOTH_MODE, mode.name()).apply(); }