/** * Reads the photo booth theme preference. * * @param context the {@link Context}. * @return the stored {@link PhotoBoothTheme}. */ public PhotoBoothTheme getPhotoBoothTheme(Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); String theme = preferences.getString(KEY_PHOTO_BOOTH_THEME, PhotoBoothTheme.STRIPES_BLUE.name()); return PhotoBoothTheme.valueOf(theme); }
/** * Stores the photo booth theme preference. * * @param context the {@link Context}. * @param theme one of {@link PhotoBoothTheme}. Must not be null. */ public void storePhotoBoothTheme(Context context, PhotoBoothTheme theme) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); preferences.edit().putString(KEY_PHOTO_BOOTH_THEME, theme.name()).apply(); }