Immersive Interface is now available on Android 8.0. Add ThemePreferenceFragment. Fix theme database.

This commit is contained in:
Alex Ning 2020-03-18 13:33:55 +08:00
parent 21c47eaa4c
commit 71e22b3e36
17 changed files with 353 additions and 234 deletions

View File

@ -65,13 +65,13 @@ public abstract class BaseActivity extends AppCompatActivity {
case 0: case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
getTheme().applyStyle(R.style.Theme_Normal, true); getTheme().applyStyle(R.style.Theme_Normal, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
break; break;
case 1: case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true); getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
} else { } else {
getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true); getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
@ -85,11 +85,11 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) { if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
getTheme().applyStyle(R.style.Theme_Normal, true); getTheme().applyStyle(R.style.Theme_Normal, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
} else { } else {
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true); getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
} else { } else {
getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true); getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
@ -120,8 +120,8 @@ public abstract class BaseActivity extends AppCompatActivity {
window.setStatusBarColor(customThemeWrapper.getColorPrimaryDark()); window.setStatusBarColor(customThemeWrapper.getColorPrimaryDark());
} }
boolean isLightStatusbar = customThemeWrapper.isLightStatusBar(); boolean isLightStatusbar = customThemeWrapper.isLightStatusBar();
boolean isLightNavBar = customThemeWrapper.isLightNavBar();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
boolean isLightNavBar = customThemeWrapper.isLightNavBar();
if (isLightStatusbar) { if (isLightStatusbar) {
if (isLightNavBar) { if (isLightNavBar) {
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;

View File

@ -495,13 +495,13 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
case R.string.light_theme: case R.string.light_theme:
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply(); mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
break; break;
case R.string.dark_theme: case R.string.dark_theme:
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
} else { } else {
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
} }

View File

@ -23,8 +23,8 @@ import ml.docilealligator.infinityforreddit.Activity.SearchActivity;
import ml.docilealligator.infinityforreddit.Activity.SearchResultActivity; import ml.docilealligator.infinityforreddit.Activity.SearchResultActivity;
import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActivity; import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActivity;
import ml.docilealligator.infinityforreddit.Activity.SettingsActivity; import ml.docilealligator.infinityforreddit.Activity.SettingsActivity;
import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity;
import ml.docilealligator.infinityforreddit.Activity.SubredditMultiselectionActivity; import ml.docilealligator.infinityforreddit.Activity.SubredditMultiselectionActivity;
import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity;
import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity; import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity; import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity;
@ -44,9 +44,9 @@ import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListing
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment; import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
import ml.docilealligator.infinityforreddit.Service.SubmitPostService; import ml.docilealligator.infinityforreddit.Service.SubmitPostService;
import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.ThemePreferenceFragment;
@Singleton @Singleton
@Component(modules = AppModule.class) @Component(modules = AppModule.class)
@ -139,5 +139,5 @@ public interface AppComponent {
void inject(SubredditMultiselectionActivity subredditMultiselectionActivity); void inject(SubredditMultiselectionActivity subredditMultiselectionActivity);
void inject(InterfacePreferenceFragment interfacePreferenceFragment); void inject(ThemePreferenceFragment themePreferenceFragment);
} }

View File

@ -107,15 +107,31 @@ class AppModule {
} }
@Provides @Provides
@Named("theme") @Named("light_theme")
@Singleton @Singleton
SharedPreferences provideThemeSharedPreferences() { SharedPreferences provideLightThemeSharedPreferences() {
return mApplication.getSharedPreferences(CustomThemeSharedPreferencesUtils.THEME_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); return mApplication.getSharedPreferences(CustomThemeSharedPreferencesUtils.LIGHT_THEME_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
}
@Provides
@Named("dark_theme")
@Singleton
SharedPreferences provideDarkThemeSharedPreferences() {
return mApplication.getSharedPreferences(CustomThemeSharedPreferencesUtils.DARK_THEME_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
}
@Provides
@Named("amoled_theme")
@Singleton
SharedPreferences provideAmoledThemeSharedPreferences() {
return mApplication.getSharedPreferences(CustomThemeSharedPreferencesUtils.AMOLED_THEME_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
} }
@Provides @Provides
@Singleton @Singleton
CustomThemeWrapper provideCustomThemeWrapper(@Named("theme") SharedPreferences themeSharedPreferences) { CustomThemeWrapper provideCustomThemeWrapper(@Named("light_theme") SharedPreferences lightThemeSharedPreferences,
return new CustomThemeWrapper(themeSharedPreferences); @Named("dark_theme") SharedPreferences darkThemeSharedPreferences,
@Named("amoled_theme") SharedPreferences amoledThemeSharedPreferences) {
return new CustomThemeWrapper(lightThemeSharedPreferences, darkThemeSharedPreferences, amoledThemeSharedPreferences);
} }
} }

View File

@ -11,6 +11,12 @@ public class CustomTheme {
@NonNull @NonNull
@ColumnInfo(name = "name") @ColumnInfo(name = "name")
public String name; public String name;
@ColumnInfo(name = "is_light_theme")
public boolean isLightTheme;
@ColumnInfo(name = "is_dark_theme")
public boolean isDarkTheme;
@ColumnInfo(name = "is_amoled_theme")
public boolean isAmoledTheme;
@ColumnInfo(name = "color_primary") @ColumnInfo(name = "color_primary")
public int colorPrimary; public int colorPrimary;
@ColumnInfo(name = "color_primary_dark") @ColumnInfo(name = "color_primary_dark")
@ -23,12 +29,26 @@ public class CustomTheme {
public int primaryTextColor; public int primaryTextColor;
@ColumnInfo(name = "secondary_text_color") @ColumnInfo(name = "secondary_text_color")
public int secondaryTextColor; public int secondaryTextColor;
@ColumnInfo(name = "post_title_color")
public int postTitleColor;
@ColumnInfo(name = "post_content_color")
public int postContentColor;
@ColumnInfo(name = "comment_color")
public int commentColor;
@ColumnInfo(name = "button_text_color")
public int buttonTextColor;
@ColumnInfo(name = "background_color") @ColumnInfo(name = "background_color")
public int backgroundColor; public int backgroundColor;
@ColumnInfo(name = "rounded_bottom_sheet_primary_background")
public int roundedBottomSheetPrimaryBackground;
@ColumnInfo(name = "card_view_background_color") @ColumnInfo(name = "card_view_background_color")
public int cardViewBackgroundColor; public int cardViewBackgroundColor;
@ColumnInfo(name = "comment_background_color")
public int commentBackgroundColor;
@ColumnInfo(name = "bottom_app_bar_background_color")
public int bottomAppBarBackgroundColor;
@ColumnInfo(name = "primary_icon_color")
public int primaryIconColor;
@ColumnInfo(name = "comment_icon_and_info_color")
public int commentIconAndInfoColor;
@ColumnInfo(name = "toolbar_primary_text_and_icon_color") @ColumnInfo(name = "toolbar_primary_text_and_icon_color")
public int toolbarPrimaryTextAndIconColor; public int toolbarPrimaryTextAndIconColor;
@ColumnInfo(name = "toolbar_and_tab_background_color") @ColumnInfo(name = "toolbar_and_tab_background_color")
@ -53,22 +73,30 @@ public class CustomTheme {
public int upvoted; public int upvoted;
@ColumnInfo(name = "downvoted") @ColumnInfo(name = "downvoted")
public int downvoted; public int downvoted;
@ColumnInfo(name = "post_type") @ColumnInfo(name = "post_type_background_color")
public int postType; public int postTypeBackgroundColor;
@ColumnInfo(name = "spoiler_color") @ColumnInfo(name = "post_type_text_color")
public int spoilerColor; public int postTypeTextColor;
@ColumnInfo(name = "nsfw_color") @ColumnInfo(name = "spoiler_background_color")
public int nsfwColor; public int spoilerBackgroundColor;
@ColumnInfo(name = "flair_color") @ColumnInfo(name = "spoiler_text_color")
public int flairColor; public int spoilerTextColor;
@ColumnInfo(name = "nsfw_background_color")
public int nsfwBackgroundColor;
@ColumnInfo(name = "nsfw_text_color")
public int nsfwTextColor;
@ColumnInfo(name = "flair_background_color")
public int flairBackgroundColor;
@ColumnInfo(name = "flair_text_color")
public int flairTextColor;
@ColumnInfo(name = "archived_tint") @ColumnInfo(name = "archived_tint")
public int archivedTint; public int archivedTint;
@ColumnInfo(name = "locked_icon_tint") @ColumnInfo(name = "locked_icon_tint")
public int lockedIconTint; public int lockedIconTint;
@ColumnInfo(name = "crosspost") @ColumnInfo(name = "crosspost_icon_tint")
public int crosspost; public int crosspostIconTint;
@ColumnInfo(name = "stickied_post") @ColumnInfo(name = "stickied_post_icon_tint")
public int stickiedPost; public int stickiedPostIconTint;
@ColumnInfo(name = "subscribed") @ColumnInfo(name = "subscribed")
public int subscribed; public int subscribed;
@ColumnInfo(name = "unsubscribed") @ColumnInfo(name = "unsubscribed")
@ -83,8 +111,6 @@ public class CustomTheme {
public int submitter; public int submitter;
@ColumnInfo(name = "moderator") @ColumnInfo(name = "moderator")
public int moderator; public int moderator;
@ColumnInfo(name = "notification_icon_color")
public int notificationIconColor;
@ColumnInfo(name = "single_comment_thread_background_color") @ColumnInfo(name = "single_comment_thread_background_color")
public int singleCommentThreadBackgroundColor; public int singleCommentThreadBackgroundColor;
@ColumnInfo(name = "unread_message_background_color") @ColumnInfo(name = "unread_message_background_color")
@ -109,6 +135,16 @@ public class CustomTheme {
public int commentVerticalBarColor6; public int commentVerticalBarColor6;
@ColumnInfo(name = "comment_vertical_bar_color_7") @ColumnInfo(name = "comment_vertical_bar_color_7")
public int commentVerticalBarColor7; public int commentVerticalBarColor7;
@ColumnInfo(name = "fab_icon_color")
public int fabIconColor;
@ColumnInfo(name = "chip_text_color")
public int chipTextColor;
@ColumnInfo(name = "is_light_status_bar")
public int isLightStatusBar;
@ColumnInfo(name = "is_light_nav_bar")
public int isLightNavBar;
@ColumnInfo(name = "is_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface")
public int isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface;
public CustomTheme(@NonNull String name) { public CustomTheme(@NonNull String name) {
this.name = name; this.name = name;

View File

@ -5,22 +5,39 @@ import android.graphics.Color;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.AMOLED_DARK; import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.AMOLED;
import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.DARK; import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.DARK;
public class CustomThemeWrapper { public class CustomThemeWrapper {
private SharedPreferences themeSharedPreferences; private SharedPreferences lightThemeSharedPreferences;
private SharedPreferences darkThemeSharedPreferences;
private SharedPreferences amoledThemeSharedPreferences;
private int themeType; private int themeType;
public CustomThemeWrapper(SharedPreferences themeSharedPreferences) { public CustomThemeWrapper(SharedPreferences lightThemeSharedPreferences,
this.themeSharedPreferences = themeSharedPreferences; SharedPreferences darkThemeSharedPreferences,
SharedPreferences amoledThemeSharedPreferences) {
this.lightThemeSharedPreferences = lightThemeSharedPreferences;
this.darkThemeSharedPreferences = darkThemeSharedPreferences;
this.amoledThemeSharedPreferences = amoledThemeSharedPreferences;
}
private SharedPreferences getThemeSharedPreferences() {
switch (themeType) {
case DARK:
return darkThemeSharedPreferences;
case AMOLED:
return amoledThemeSharedPreferences;
default:
return lightThemeSharedPreferences;
}
} }
private int getDefaultColor(String normalHex, String darkHex, String amoledDarkHex) { private int getDefaultColor(String normalHex, String darkHex, String amoledDarkHex) {
switch (themeType) { switch (themeType) {
case DARK: case DARK:
return Color.parseColor(darkHex); return Color.parseColor(darkHex);
case AMOLED_DARK: case AMOLED:
return Color.parseColor(amoledDarkHex); return Color.parseColor(amoledDarkHex);
default: default:
return Color.parseColor(normalHex); return Color.parseColor(normalHex);
@ -31,327 +48,326 @@ public class CustomThemeWrapper {
this.themeType = themeType; this.themeType = themeType;
} }
public boolean isLightStatusBar() {
return themeSharedPreferences.getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_STATUS_BAR, false);
}
public boolean isLightNavBar() {
return themeSharedPreferences.getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_NAV_BAR, false);
}
public boolean isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface() {
return themeSharedPreferences.getBoolean(
CustomThemeSharedPreferencesUtils.CHANGE_STATUS_BAR_ICON_COLOR_AFTER_TOOLBAR_COLLAPSED_IN_IMMERSIVE_INTERFACE,
true);
}
public int getColorPrimary() { public int getColorPrimary() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY,
getDefaultColor("#1565C0", "#242424", "#000000")); getDefaultColor("#1565C0", "#242424", "#000000"));
} }
public int getColorPrimaryDark() { public int getColorPrimaryDark() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_DARK, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_DARK,
getDefaultColor("#0D47A1", "#121212", "#000000")); getDefaultColor("#0D47A1", "#121212", "#000000"));
} }
public int getColorAccent() { public int getColorAccent() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_ACCENT, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COLOR_ACCENT,
getDefaultColor("#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getColorPrimaryLightTheme() { public int getColorPrimaryLightTheme() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_LIGHT_THEME, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_LIGHT_THEME,
getDefaultColor("#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getPostTitleColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TITLE_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
}
public int getPostContentColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_CONTENT_COLOR,
getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
}
public int getCommentColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
}
public int getPrimaryTextColor() { public int getPrimaryTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.PRIMARY_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.PRIMARY_TEXT_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
} }
public int getSecondaryTextColor() { public int getSecondaryTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SECONDARY_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SECONDARY_TEXT_COLOR,
getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getPostTitleColor() {
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_TITLE_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
}
public int getPostContentColor() {
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_CONTENT_COLOR,
getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
}
public int getCommentColor() {
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
}
public int getButtonTextColor() { public int getButtonTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BUTTON_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.BUTTON_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getBackgroundColor() { public int getBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.BACKGROUND_COLOR,
getDefaultColor("#FFFFFF", "#121212", "#000000")); getDefaultColor("#FFFFFF", "#121212", "#000000"));
} }
public int getCardViewBackgroundColor() { public int getCardViewBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CARD_VIEW_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.CARD_VIEW_BACKGROUND_COLOR,
getDefaultColor("#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getCommentBackgroundColor() { public int getCommentBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_BACKGROUND_COLOR,
getDefaultColor("#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getBottomAppBarBackgroundColor() { public int getBottomAppBarBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BOTTOM_APP_BAR_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.BOTTOM_APP_BAR_BACKGROUND_COLOR,
getDefaultColor("#FFFFFF", "#121212", "#000000")); getDefaultColor("#FFFFFF", "#121212", "#000000"));
} }
public int getPrimaryIconColor() { public int getPrimaryIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.PRIMARY_ICON_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.PRIMARY_ICON_COLOR,
getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
} }
public int getPostIconAndInfoColor() { public int getPostIconAndInfoColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR,
getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getCommentIconAndInfoColor() { public int getCommentIconAndInfoColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_ICON_AND_INFO_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_ICON_AND_INFO_COLOR,
getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getToolbarPrimaryTextAndIconColor() { public int getToolbarPrimaryTextAndIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getToolbarAndTabBackgroundColor() { public int getToolbarAndTabBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_AND_TAB_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_AND_TAB_BACKGROUND_COLOR,
getDefaultColor("#1565C0", "#282828", "#000000")); getDefaultColor("#1565C0", "#282828", "#000000"));
} }
public int getCircularProgressBarBackground() { public int getCircularProgressBarBackground() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CIRCULAR_PROGRESS_BAR_BACKGROUND, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.CIRCULAR_PROGRESS_BAR_BACKGROUND,
getDefaultColor("#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getTabLayoutWithExpandedCollapsingToolbarTabBackground() { public int getTabLayoutWithExpandedCollapsingToolbarTabBackground() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_BACKGROUND, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_BACKGROUND,
getDefaultColor("#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getTabLayoutWithExpandedCollapsingToolbarTextColor() { public int getTabLayoutWithExpandedCollapsingToolbarTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TEXT_COLOR,
getDefaultColor("#1565C0", "#FFFFFF", "#FFFFFF")); getDefaultColor("#1565C0", "#FFFFFF", "#FFFFFF"));
} }
public int getTabLayoutWithExpandedCollapsingToolbarTabIndicator() { public int getTabLayoutWithExpandedCollapsingToolbarTabIndicator() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_INDICATOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_INDICATOR,
getDefaultColor("#1565C0", "#FFFFFF", "#FFFFFF")); getDefaultColor("#1565C0", "#FFFFFF", "#FFFFFF"));
} }
public int getTabLayoutWithCollapsedCollapsingToolbarTabBackground() { public int getTabLayoutWithCollapsedCollapsingToolbarTabBackground() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_BACKGROUND, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_BACKGROUND,
getDefaultColor("#1565C0", "#242424", "#000000")); getDefaultColor("#1565C0", "#242424", "#000000"));
} }
public int getTabLayoutWithCollapsedCollapsingToolbarTextColor() { public int getTabLayoutWithCollapsedCollapsingToolbarTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getTabLayoutWithCollapsedCollapsingToolbarTabIndicator() { public int getTabLayoutWithCollapsedCollapsingToolbarTabIndicator() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_INDICATOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_INDICATOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getNavBarColor() { public int getNavBarColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR,
getDefaultColor("#FFFFFF", "#121212", "#000000")); getDefaultColor("#FFFFFF", "#121212", "#000000"));
} }
public int getUpvoted() { public int getUpvoted() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UPVOTED, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.UPVOTED,
getDefaultColor("#E91E63", "#E91E63", "#E91E63")); getDefaultColor("#E91E63", "#E91E63", "#E91E63"));
} }
public int getDownvoted() { public int getDownvoted() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DOWNVOTED, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.DOWNVOTED,
getDefaultColor("#007DDE", "#007DDE", "#007DDE")); getDefaultColor("#007DDE", "#007DDE", "#007DDE"));
} }
public int getPostTypeBackgroundColor() { public int getPostTypeBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_BACKGROUND_COLOR,
getDefaultColor("#0D47A1", "#1565C0", "#1565C0")); getDefaultColor("#0D47A1", "#1565C0", "#1565C0"));
} }
public int getPostTypeTextColor() { public int getPostTypeTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getSpoilerBackgroundColor() { public int getSpoilerBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SPOILER_BACKGROUND_COLOR,
getDefaultColor("#EE02EB", "#EE02EB", "#EE02EB")); getDefaultColor("#EE02EB", "#EE02EB", "#EE02EB"));
} }
public int getSpoilerTextColor() { public int getSpoilerTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SPOILER_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getNsfwBackgroundColor() { public int getNsfwBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NSFW_BACKGROUND_COLOR,
getDefaultColor("#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getNsfwTextColor() { public int getNsfwTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NSFW_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getFlairBackgroundColor() { public int getFlairBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.FLAIR_BACKGROUND_COLOR,
getDefaultColor("#00AA8C", "#00AA8C", "#00AA8C")); getDefaultColor("#00AA8C", "#00AA8C", "#00AA8C"));
} }
public int getFlairTextColor() { public int getFlairTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.FLAIR_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getArchivedTint() { public int getArchivedTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_TINT, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_TINT,
getDefaultColor("#B4009F", "#B4009F", "#B4009F")); getDefaultColor("#B4009F", "#B4009F", "#B4009F"));
} }
public int getLockedIconTint() { public int getLockedIconTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.LOCKED_ICON_TINT, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.LOCKED_ICON_TINT,
getDefaultColor("#EE7302", "#EE7302", "#EE7302")); getDefaultColor("#EE7302", "#EE7302", "#EE7302"));
} }
public int getCrosspostIconTint() { public int getCrosspostIconTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CROSSPOST_ICON_TINT, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.CROSSPOST_ICON_TINT,
getDefaultColor("#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getStickiedPostIconTint() { public int getStickiedPostIconTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.STICKIED_POST_ICON_TINT, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.STICKIED_POST_ICON_TINT,
getDefaultColor("#0D47A1", "#1565C0", "#1565C0")); getDefaultColor("#0D47A1", "#1565C0", "#1565C0"));
} }
public int getSubscribed() { public int getSubscribed() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBSCRIBED, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SUBSCRIBED,
getDefaultColor("#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getUnsubscribed() { public int getUnsubscribed() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UNSUBSCRIBED, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.UNSUBSCRIBED,
getDefaultColor("#0D47A1", "#1565C0", "#1565C0")); getDefaultColor("#0D47A1", "#1565C0", "#1565C0"));
} }
public int getUsername() { public int getUsername() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.USERNAME, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.USERNAME,
getDefaultColor("#0D47A1", "#1E88E5", "#1E88E5")); getDefaultColor("#0D47A1", "#1E88E5", "#1E88E5"));
} }
public int getSubreddit() { public int getSubreddit() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBREDDIT, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SUBREDDIT,
getDefaultColor("#E91E63", "#E91E63", "#E91E63")); getDefaultColor("#E91E63", "#E91E63", "#E91E63"));
} }
public int getAuthorFlairTextColor() { public int getAuthorFlairTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.AUTHOR_FLAIR_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.AUTHOR_FLAIR_TEXT_COLOR,
getDefaultColor("#EE02C4", "#EE02C4", "#EE02C4")); getDefaultColor("#EE02C4", "#EE02C4", "#EE02C4"));
} }
public int getSubmitter() { public int getSubmitter() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBMITTER, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SUBMITTER,
getDefaultColor("#EE8A02", "#EE8A02", "#EE8A02")); getDefaultColor("#EE8A02", "#EE8A02", "#EE8A02"));
} }
public int getModerator() { public int getModerator() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.MODERATOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.MODERATOR,
getDefaultColor("#00BA81", "#00BA81", "#00BA81")); getDefaultColor("#00BA81", "#00BA81", "#00BA81"));
} }
public int getSingleCommentThreadBackgroundColor() { public int getSingleCommentThreadBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND,
getDefaultColor("#B3E5F9", "#123E77", "#123E77")); getDefaultColor("#B3E5F9", "#123E77", "#123E77"));
} }
public int getUnreadMessageBackgroundColor() { public int getUnreadMessageBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UNREAD_MESSAGE_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.UNREAD_MESSAGE_BACKGROUND_COLOR,
getDefaultColor("#B3E5F9", "#123E77", "#123E77")); getDefaultColor("#B3E5F9", "#123E77", "#123E77"));
} }
public int getDividerColor() { public int getDividerColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DIVIDER_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.DIVIDER_COLOR,
getDefaultColor("#E0E0E0", "#69666C", "#69666C")); getDefaultColor("#E0E0E0", "#69666C", "#69666C"));
} }
public int getNoPreviewLinkBackgroundColor() { public int getNoPreviewLinkBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NO_PREVIEW_LINK_BACKGROUND_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NO_PREVIEW_LINK_BACKGROUND_COLOR,
getDefaultColor("#E0E0E0", "#424242", "#424242")); getDefaultColor("#E0E0E0", "#424242", "#424242"));
} }
public int getVoteAndReplyUnavailableVoteButtonColor() { public int getVoteAndReplyUnavailableVoteButtonColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.VOTE_AND_REPLY_UNAVAILABLE_VOTE_BUTTON_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.VOTE_AND_REPLY_UNAVAILABLE_VOTE_BUTTON_COLOR,
getDefaultColor("#F0F0F0", "#3C3C3C", "#3C3C3C")); getDefaultColor("#F0F0F0", "#3C3C3C", "#3C3C3C"));
} }
public int getCommentVerticalBarColor1() { public int getCommentVerticalBarColor1() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_1, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_1,
getDefaultColor("#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getCommentVerticalBarColor2() { public int getCommentVerticalBarColor2() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_2, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_2,
getDefaultColor("#EE02BE", "#C300B3", "#C300B3")); getDefaultColor("#EE02BE", "#C300B3", "#C300B3"));
} }
public int getCommentVerticalBarColor3() { public int getCommentVerticalBarColor3() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_3, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_3,
getDefaultColor("#02DFEE", "#00B8DA", "#00B8DA")); getDefaultColor("#02DFEE", "#00B8DA", "#00B8DA"));
} }
public int getCommentVerticalBarColor4() { public int getCommentVerticalBarColor4() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_4, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_4,
getDefaultColor("#EED502", "#EDCA00", "#EDCA00")); getDefaultColor("#EED502", "#EDCA00", "#EDCA00"));
} }
public int getCommentVerticalBarColor5() { public int getCommentVerticalBarColor5() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_5, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_5,
getDefaultColor("#EE0220", "#EE0219", "#EE0219")); getDefaultColor("#EE0220", "#EE0219", "#EE0219"));
} }
public int getCommentVerticalBarColor6() { public int getCommentVerticalBarColor6() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_6, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_6,
getDefaultColor("#02EE6E", "#00B925", "#00B925")); getDefaultColor("#02EE6E", "#00B925", "#00B925"));
} }
public int getCommentVerticalBarColor7() { public int getCommentVerticalBarColor7() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_7, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_7,
getDefaultColor("#EE4602", "#EE4602", "#EE4602")); getDefaultColor("#EE4602", "#EE4602", "#EE4602"));
} }
public int getFABIconColor() { public int getFABIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FAB_ICON_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.FAB_ICON_COLOR,
getDefaultColor("#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getChipTextColor() { public int getChipTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CHIP_TEXT_COLOR, return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.CHIP_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public boolean isLightStatusBar() {
return getThemeSharedPreferences().getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_STATUS_BAR, false);
}
public boolean isLightNavBar() {
return getThemeSharedPreferences().getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_NAV_BAR, true);
}
public boolean isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface() {
return getThemeSharedPreferences().getBoolean(
CustomThemeSharedPreferencesUtils.CHANGE_STATUS_BAR_ICON_COLOR_AFTER_TOOLBAR_COLLAPSED_IN_IMMERSIVE_INTERFACE, true);
}
} }

View File

@ -116,12 +116,16 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase database) { public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("CREATE TABLE custom_themes" + database.execSQL("CREATE TABLE custom_themes" +
"(name TEXT NOT NULL PRIMARY KEY, color_primary INTEGER NOT NULL," + "(name TEXT NOT NULL PRIMARY KEY, is_light_theme INTEGER NOT NULL," +
"is_dark_theme INTEGER NOT NULL, is_amoled_theme INTEGER NOT NULL, color_primary INTEGER NOT NULL," +
"color_primary_dark INTEGER NOT NULL, color_accent INTEGER NOT NULL," + "color_primary_dark INTEGER NOT NULL, color_accent INTEGER NOT NULL," +
"color_primary_light_theme INTEGER NOT NULL, primary_text_color INTEGER NOT NULL," + "color_primary_light_theme INTEGER NOT NULL, primary_text_color INTEGER NOT NULL," +
"secondary_text_color INTEGER NOT NULL, background_color INTEGER NOT NULL," + "secondary_text_color INTEGER NOT NULL, post_title_color INTEGER NOT NULL," +
"rounded_bottom_sheet_primary_background INTEGER NOT NULL," + "post_content_color INTEGER NOT NULL, comment_color INTEGER NOT NULL," +
"card_view_background_color INTEGER NOT NULL, toolbar_primary_text_and_icon_color INTEGER NOT NULL," + "button_text_color INTEGER NOT NULL, background_color INTEGER NOT NULL," +
"card_view_background_color INTEGER NOT NULL, comment_background_color INTEGER NOT NULL," +
"bottom_app_bar_background_color INTEGER NOT NULL, primary_icon_color INTEGER NOT NULL," +
"comment_icon_and_info_color INTEGER NOT NULL, toolbar_primary_text_and_icon_color INTEGER NOT NULL," +
"toolbar_and_tab_background_color INTEGER NOT NULL, circular_progress_bar_background INTEGER NOT NULL," + "toolbar_and_tab_background_color INTEGER NOT NULL, circular_progress_bar_background INTEGER NOT NULL," +
"tab_layout_with_expanded_collapsing_toolbar_tab_background INTEGER NOT NULL," + "tab_layout_with_expanded_collapsing_toolbar_tab_background INTEGER NOT NULL," +
"tab_layout_with_expanded_collapsing_toolbar_text_color INTEGER NOT NULL," + "tab_layout_with_expanded_collapsing_toolbar_text_color INTEGER NOT NULL," +
@ -130,9 +134,12 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
"tab_layout_with_collapsed_collapsing_toolbar_text_color INTEGER NOT NULL," + "tab_layout_with_collapsed_collapsing_toolbar_text_color INTEGER NOT NULL," +
"tab_layout_with_collapsed_collapsing_toolbar_tab_indicator INTEGER NOT NULL," + "tab_layout_with_collapsed_collapsing_toolbar_tab_indicator INTEGER NOT NULL," +
"nav_bar_color INTEGER NOT NULL, upvoted INTEGER NOT NULL, downvoted INTEGER NOT NULL," + "nav_bar_color INTEGER NOT NULL, upvoted INTEGER NOT NULL, downvoted INTEGER NOT NULL," +
"post_type INTEGER NOT NULL, spoiler_color INTEGER NOT NULL, nsfw_color INTEGER NOT NULL," + "post_type_background_color INTEGER NOT NULL, post_type_text_color INTEGER NOT NULL," +
"flair_color INTEGER NOT NULL, archived_tint INTEGER NOT NULL, locked_icon_tint INTEGER NOT NULL," + "spoiler_background_color INTEGER NOT NULL, spoiler_text_color INTEGER NOT NULL," +
"crosspost INTEGER NOT NULL, stickied_post INTEGER NOT NULL, subscribed INTEGER NOT NULL," + "nsfw_background_color INTEGER NOT NULL, nsfw_text_color INTEGER NOT NULL," +
"flair_background_color INTEGER NOT NULL, flair_text_color INTEGER NOT NULL," +
"archived_tint INTEGER NOT NULL, locked_icon_tint INTEGER NOT NULL," +
"crosspost_icon_tint INTEGER NOT NULL, stickied_post_icon_tint INTEGER NOT NULL, subscribed INTEGER NOT NULL," +
"unsubscribed INTEGER NOT NULL, username INTEGER NOT NULL, subreddit INTEGER NOT NULL," + "unsubscribed INTEGER NOT NULL, username INTEGER NOT NULL, subreddit INTEGER NOT NULL," +
"author_flair_text_color INTEGER NOT NULL, submitter INTEGER NOT NULL," + "author_flair_text_color INTEGER NOT NULL, submitter INTEGER NOT NULL," +
"moderator INTEGER NOT NULL, notification_icon_color INTEGER NOT NULL," + "moderator INTEGER NOT NULL, notification_icon_color INTEGER NOT NULL," +
@ -143,7 +150,10 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
"comment_vertical_bar_color_1 INTEGER NOT NULL, comment_vertical_bar_color_2 INTEGER NOT NULL," + "comment_vertical_bar_color_1 INTEGER NOT NULL, comment_vertical_bar_color_2 INTEGER NOT NULL," +
"comment_vertical_bar_color_3 INTEGER NOT NULL, comment_vertical_bar_color_4 INTEGER NOT NULL," + "comment_vertical_bar_color_3 INTEGER NOT NULL, comment_vertical_bar_color_4 INTEGER NOT NULL," +
"comment_vertical_bar_color_5 INTEGER NOT NULL, comment_vertical_bar_color_6 INTEGER NOT NULL," + "comment_vertical_bar_color_5 INTEGER NOT NULL, comment_vertical_bar_color_6 INTEGER NOT NULL," +
"comment_vertical_bar_color_7 INTEGER NOT NULL)"); "comment_vertical_bar_color_7 INTEGER NOT NULL, fab_icon_color INTEGER NOT NULL," +
"chip_text_color INTEGER NOT NULL, is_light_status_bar INTEGER NOT NULL," +
"is_light_nav_bar INTEGER NOT NULL," +
"is_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface INTEGER NOT NULL)");
} }
}; };
} }

View File

@ -1,14 +1,9 @@
package ml.docilealligator.infinityforreddit.Settings; package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.preference.ListPreference; import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
@ -16,42 +11,24 @@ import androidx.preference.SwitchPreference;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.ChangeDefaultPostLayoutEvent; import ml.docilealligator.infinityforreddit.Event.ChangeDefaultPostLayoutEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeShowAbsoluteNumberOfVotesEvent; import ml.docilealligator.infinityforreddit.Event.ChangeShowAbsoluteNumberOfVotesEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent; import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent; import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent; import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
*/ */
public class InterfacePreferenceFragment extends PreferenceFragmentCompat { public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Inject
CustomThemeWrapper customThemeWrapper;
@Override @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.interface_preference, rootKey); setPreferencesFromResource(R.xml.interface_preference, rootKey);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY); SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY); SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
@ -60,63 +37,8 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT); SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT);
SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES); SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
if (themePreference != null && amoledDarkSwitch != null) {
if (systemDefault) {
themePreference.setEntries(R.array.settings_theme_q);
} else {
themePreference.setEntries(R.array.settings_theme);
}
themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
int option = Integer.parseInt((String) newValue);
switch (option) {
case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
break;
case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if (amoledDarkSwitch.isChecked()) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
}
break;
case 2:
if (systemDefault) {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
} else {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
}
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
} else {
if (amoledDarkSwitch.isChecked()) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
}
}
}
return true;
});
}
if (amoledDarkSwitch != null) {
amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
EventBus.getDefault().post(new RecreateActivityEvent());
activity.recreate();
}
return true;
});
}
if (immersiveInterfaceSwitch != null) { if (immersiveInterfaceSwitch != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
immersiveInterfaceSwitch.setVisible(true); immersiveInterfaceSwitch.setVisible(true);
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> { immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent()); EventBus.getDefault().post(new RecreateActivityEvent());
@ -169,10 +91,4 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
}); });
} }
} }
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
} }

View File

@ -0,0 +1,110 @@
package ml.docilealligator.infinityforreddit.Settings;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.Fragment;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.SwitchPreference;
import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
/**
* A simple {@link Fragment} subclass.
*/
public class ThemePreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Inject
CustomThemeWrapper customThemeWrapper;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.theme_preferences, rootKey);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
if (themePreference != null && amoledDarkSwitch != null) {
if (systemDefault) {
themePreference.setEntries(R.array.settings_theme_q);
} else {
themePreference.setEntries(R.array.settings_theme);
}
themePreference.setOnPreferenceChangeListener((preference, newValue) -> {
int option = Integer.parseInt((String) newValue);
switch (option) {
case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
break;
case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if (amoledDarkSwitch.isChecked()) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
} else {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
}
break;
case 2:
if (systemDefault) {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
} else {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
}
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT);
} else {
if (amoledDarkSwitch.isChecked()) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED);
} else {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
}
}
}
return true;
});
}
if (amoledDarkSwitch != null) {
amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
EventBus.getDefault().post(new RecreateActivityEvent());
activity.recreate();
}
return true;
});
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity) context;
}
}

View File

@ -1,10 +1,12 @@
package ml.docilealligator.infinityforreddit.Utils; package ml.docilealligator.infinityforreddit.Utils;
public class CustomThemeSharedPreferencesUtils { public class CustomThemeSharedPreferencesUtils {
public static final int NORMAL = 0; public static final int LIGHT = 0;
public static final int DARK = 1; public static final int DARK = 1;
public static final int AMOLED_DARK = 2; public static final int AMOLED = 2;
public static final String THEME_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.theme"; public static final String LIGHT_THEME_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.light_theme";
public static final String DARK_THEME_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.dark_theme";
public static final String AMOLED_THEME_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.amoled_theme";
public static final String LIGHT_STATUS_BAR = "lightStatusBar"; public static final String LIGHT_STATUS_BAR = "lightStatusBar";
public static final String LIGHT_NAV_BAR = "lightNavBar"; public static final String LIGHT_NAV_BAR = "lightNavBar";
public static final String CHANGE_STATUS_BAR_ICON_COLOR_AFTER_TOOLBAR_COLLAPSED_IN_IMMERSIVE_INTERFACE = "changeStatusBarIconColorImmersive"; public static final String CHANGE_STATUS_BAR_ICON_COLOR_AFTER_TOOLBAR_COLLAPSED_IN_IMMERSIVE_INTERFACE = "changeStatusBarIconColorImmersive";

View File

@ -44,7 +44,7 @@ public class Utils {
return context.getString(R.string.elapsed_time_a_minute_ago); return context.getString(R.string.elapsed_time_a_minute_ago);
} else if (diff < 50 * MINUTE_MILLIS) { } else if (diff < 50 * MINUTE_MILLIS) {
return context.getString(R.string.elapsed_time_minutes_ago, diff / MINUTE_MILLIS); return context.getString(R.string.elapsed_time_minutes_ago, diff / MINUTE_MILLIS);
} else if (diff < 90 * MINUTE_MILLIS) { } else if (diff < 120 * MINUTE_MILLIS) {
return context.getString(R.string.elapsed_time_an_hour_ago); return context.getString(R.string.elapsed_time_an_hour_ago);
} else if (diff < 24 * HOUR_MILLIS) { } else if (diff < 24 * HOUR_MILLIS) {
return context.getString(R.string.elapsed_time_hours_ago, diff / HOUR_MILLIS); return context.getString(R.string.elapsed_time_hours_ago, diff / HOUR_MILLIS);

View File

@ -459,4 +459,7 @@
<string name="cannot_get_storage">Cannot access the app storage</string> <string name="cannot_get_storage">Cannot access the app storage</string>
<string name="save_image_before_sharing">Saving the image. Please wait.</string> <string name="save_image_before_sharing">Saving the image. Please wait.</string>
<string name="save_gif_before_sharing">Saving the gif. Please wait.</string> <string name="save_gif_before_sharing">Saving the gif. Please wait.</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>

View File

@ -2,19 +2,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
app:defaultValue="2"
app:entryValues="@array/settings_theme_values"
app:key="theme"
app:icon="@drawable/ic_outline_color_lens_24px"
app:title="@string/settings_theme_title"
app:useSimpleSummaryProvider="true" />
<SwitchPreference
app:defaultValue="false"
app:key="amoled_dark"
app:title="@string/settings_amoled_dark_title" />
<Preference <Preference
app:title="@string/settings_font_size_title" app:title="@string/settings_font_size_title"
app:icon="@drawable/ic_font_size_24dp" app:icon="@drawable/ic_font_size_24dp"

View File

@ -12,6 +12,11 @@
app:title="@string/settings_interface_title" app:title="@string/settings_interface_title"
app:fragment="ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment" /> app:fragment="ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment" />
<Preference
app:title="@string/settings_theme_title"
app:icon="@drawable/ic_outline_color_lens_24dp"
app:fragment="ml.docilealligator.infinityforreddit.Settings.ThemePreferenceFragment" />
<Preference <Preference
app:icon="@drawable/ic_gesture_24dp" app:icon="@drawable/ic_gesture_24dp"
app:title="@string/settings_gestures_and_buttons_title" app:title="@string/settings_gestures_and_buttons_title"

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
app:defaultValue="2"
app:entryValues="@array/settings_theme_values"
app:key="theme"
app:icon="@drawable/ic_outline_color_lens_24dp"
app:title="@string/settings_theme_title"
app:useSimpleSummaryProvider="true" />
<SwitchPreference
app:defaultValue="false"
app:key="amoled_dark"
app:title="@string/settings_amoled_dark_title" />
</PreferenceScreen>