diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-09-26 16:30:24 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-09-26 16:30:24 +0000 |
commit | 837e461451a877c581ea38e401863a266a1781ca (patch) | |
tree | 640ec910dde0be8c8da0559b081c0f0a407d6a3e | |
parent | 81c259edcb557e231766e17980bf7a20906ee983 (diff) | |
download | infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.tar infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.tar.gz infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.tar.bz2 infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.tar.lz infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.tar.xz infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.tar.zst infinity-for-reddit-837e461451a877c581ea38e401863a266a1781ca.zip |
Add title and content font size options.
Diffstat (limited to '')
47 files changed, 413 insertions, 41 deletions
diff --git a/app/src/main/java/Settings/FontSizePreferenceFragment.java b/app/src/main/java/Settings/FontSizePreferenceFragment.java new file mode 100644 index 00000000..41000a5a --- /dev/null +++ b/app/src/main/java/Settings/FontSizePreferenceFragment.java @@ -0,0 +1,49 @@ +package Settings; + +import android.app.Activity; +import android.os.Bundle; + +import androidx.preference.ListPreference; +import androidx.preference.PreferenceFragmentCompat; + +import org.greenrobot.eventbus.EventBus; + +import ml.docilealligator.infinityforreddit.ChangeFontSizeEvent; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; + +public class FontSizePreferenceFragment extends PreferenceFragmentCompat { + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + setPreferencesFromResource(R.xml.font_size_preferences, rootKey); + + Activity activity = getActivity(); + if(activity != null) { + ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY); + ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY); + ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY); + + if(fontSizePreference != null) { + fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeFontSizeEvent()); + activity.recreate(); + return true; + }); + } + + if(titleFontSizePreference != null) { + titleFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeFontSizeEvent()); + return true; + }); + } + + if(contentFontSizePreference != null) { + contentFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeFontSizeEvent()); + return true; + }); + } + } + } +} diff --git a/app/src/main/java/Settings/MainPreferenceFragment.java b/app/src/main/java/Settings/MainPreferenceFragment.java index 847112a9..af498294 100644 --- a/app/src/main/java/Settings/MainPreferenceFragment.java +++ b/app/src/main/java/Settings/MainPreferenceFragment.java @@ -15,7 +15,6 @@ import org.greenrobot.eventbus.EventBus; import javax.inject.Inject; -import ml.docilealligator.infinityforreddit.ChangeFontSizeEvent; import ml.docilealligator.infinityforreddit.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.Infinity; @@ -46,7 +45,6 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY); SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY); ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); - ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY); if(nsfwSwitch != null) { nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> { @@ -101,14 +99,6 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { return true; }); } - - if(fontSizePreference != null) { - fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> { - EventBus.getDefault().post(new ChangeFontSizeEvent((String) newValue)); - activity.recreate(); - return true; - }); - } } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java index 3a99ebf1..7cbb44b7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java @@ -73,6 +73,12 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_account_posts); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java index a82a6f7a..367c7439 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java @@ -81,6 +81,12 @@ public class AccountSavedThingActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_account_saved_thing); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java index 78846c79..434ff7a4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java @@ -1,8 +1,3 @@ package ml.docilealligator.infinityforreddit; -public class ChangeFontSizeEvent { - public String fontSize; - public ChangeFontSizeEvent(String fontSize) { - this.fontSize = fontSize; - } -} +public class ChangeFontSizeEvent { } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java index dd914ea3..6c8eb2f0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java @@ -90,6 +90,12 @@ public class CommentActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_comment); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java new file mode 100644 index 00000000..70cdfe9b --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java @@ -0,0 +1,25 @@ +package ml.docilealligator.infinityforreddit; + +public enum ContentFontStyle { + Small(R.style.ContentFontStyle_Small, "Small"), + Normal(R.style.ContentFontStyle_Normal, "Normal"), + Large(R.style.ContentFontStyle_Large, "Large"), + XLarge(R.style.ContentFontStyle_XLarge, "XLarge"), + XXLarge(R.style.ContentFontStyle_XXLarge, "XXLarge"); + + private int resId; + private String title; + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } + + ContentFontStyle(int resId, String title) { + this.resId = resId; + this.title = title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java index 602095ea..242d6315 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java @@ -78,6 +78,12 @@ public class EditCommentActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_edit_comment); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java index d1352cdf..dc2a755b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java @@ -77,6 +77,12 @@ public class EditPostActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_edit_post); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java index 66ce2fcf..d4e67189 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java @@ -84,6 +84,12 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_filtered_thing); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java index 4e2a53d2..641a9b41 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java @@ -172,6 +172,12 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_main); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java index 1e2dc155..9fd5b45e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java @@ -139,6 +139,12 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_post_image); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java index cf384682..e5a2843a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java @@ -116,6 +116,12 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_post_link); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java index 5f1200b3..2997282c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java @@ -116,6 +116,12 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_post_text); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java index f287fd07..df0b5f25 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java @@ -149,6 +149,12 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_post_video); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java index 8923e364..20e3e4d9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java @@ -76,6 +76,12 @@ public class RulesActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_rules); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java index a715014f..a0192e36 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java @@ -73,6 +73,12 @@ public class SearchActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_search); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java index b0640071..5967066b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java @@ -78,6 +78,12 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_search_result); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java index 31118441..f9ed0272 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java @@ -69,6 +69,12 @@ public class SearchSubredditsResultActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_search_subreddits_result); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java index 4e8b0a64..4f91157d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java @@ -48,6 +48,12 @@ public class SettingsActivity extends AppCompatActivity implements getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.settings_activity); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java index 6bc34647..1889aedd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java @@ -24,4 +24,6 @@ public class SharedPreferencesUtils { public static final String REDDIT_ACCOUNT_KEY = "reddit_account"; public static final String SUBREDDIT_KEY = "subreddit"; public static final String FONT_SIZE_KEY = "font_size"; + public static final String TITLE_FONT_SIZE_KEY = "title_font_size"; + public static final String CONTENT_FONT_SIZE_KEY = "content_font_size"; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java index 05925be9..2103994a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java @@ -88,6 +88,12 @@ public class SubredditSelectionActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_subreddit_selection); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java index 15380d86..eb569eaa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java @@ -81,6 +81,12 @@ public class SubscribedThingListingActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_subscribed_thing_listing); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java new file mode 100644 index 00000000..e273917d --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java @@ -0,0 +1,24 @@ +package ml.docilealligator.infinityforreddit; + +public enum TitleFontStyle { + Small(R.style.TitleFontStyle_Small, "Small"), + Normal(R.style.TitleFontStyle_Normal, "Normal"), + Large(R.style.TitleFontStyle_Large, "Large"), + XLarge(R.style.TitleFontStyle_XLarge, "XLarge"); + + private int resId; + private String title; + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } + + TitleFontStyle(int resId, String title) { + this.resId = resId; + this.title = title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java index 2db793e5..6af5beb5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java @@ -91,6 +91,12 @@ public class ViewImageActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_view_image); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java index 5d748643..fd45795d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java @@ -92,6 +92,12 @@ public class ViewMessageActivity extends AppCompatActivity { getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_view_message); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java index accb7542..0a0451a1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java @@ -145,6 +145,12 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_view_post_detail); Bridge.restoreInstanceState(this, savedInstanceState); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java index d6b4fbb9..813801d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java @@ -127,6 +127,12 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_view_subreddit_detail); ButterKnife.bind(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java index 805c5af5..fae233fb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java @@ -133,6 +133,12 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + setContentView(R.layout.activity_view_user_detail); ButterKnife.bind(this); diff --git a/app/src/main/res/layout/activity_comment.xml b/app/src/main/res/layout/activity_comment.xml index f5c5afe1..2a3629d7 100644 --- a/app/src/main/res/layout/activity_comment.xml +++ b/app/src/main/res/layout/activity_comment.xml @@ -37,7 +37,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" - android:textSize="?attr/font_16" /> + android:textSize="?attr/content_font_16" /> <EditText android:id="@+id/comment_edit_text_comment_activity" @@ -46,7 +46,7 @@ android:gravity="top" android:hint="@string/write_comment_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/content_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> diff --git a/app/src/main/res/layout/activity_edit_comment.xml b/app/src/main/res/layout/activity_edit_comment.xml index 94f9b602..10b7241b 100644 --- a/app/src/main/res/layout/activity_edit_comment.xml +++ b/app/src/main/res/layout/activity_edit_comment.xml @@ -29,7 +29,7 @@ android:padding="16dp" android:hint="@string/post_text_content_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/content_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> diff --git a/app/src/main/res/layout/activity_edit_post.xml b/app/src/main/res/layout/activity_edit_post.xml index e7645c5e..1606fc16 100644 --- a/app/src/main/res/layout/activity_edit_post.xml +++ b/app/src/main/res/layout/activity_edit_post.xml @@ -37,7 +37,7 @@ android:layout_height="wrap_content" android:gravity="top" android:padding="16dp" - android:textSize="?attr/font_18" + android:textSize="?attr/title_font_18" android:textColor="@color/primaryTextColor" /> <View @@ -53,7 +53,7 @@ android:padding="16dp" android:hint="@string/post_text_content_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/content_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml index 1cf36a16..93cfcf2b 100644 --- a/app/src/main/res/layout/activity_post_image.xml +++ b/app/src/main/res/layout/activity_post_image.xml @@ -137,7 +137,7 @@ android:padding="16dp" android:hint="@string/post_title_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/title_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml index 23374e78..a9e7c96d 100644 --- a/app/src/main/res/layout/activity_post_link.xml +++ b/app/src/main/res/layout/activity_post_link.xml @@ -137,7 +137,7 @@ android:padding="16dp" android:hint="@string/post_title_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/title_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> @@ -154,7 +154,7 @@ android:padding="16dp" android:hint="@string/post_link_hint" android:inputType="textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/content_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml index b10266f1..dcb00c5c 100644 --- a/app/src/main/res/layout/activity_post_text.xml +++ b/app/src/main/res/layout/activity_post_text.xml @@ -137,7 +137,7 @@ android:padding="16dp" android:hint="@string/post_title_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/title_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> @@ -154,7 +154,7 @@ android:padding="16dp" android:hint="@string/post_text_content_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/content_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml index 086c63b8..9510db6b 100644 --- a/app/src/main/res/layout/activity_post_video.xml +++ b/app/src/main/res/layout/activity_post_video.xml @@ -137,7 +137,7 @@ android:padding="16dp" android:hint="@string/post_title_hint" android:inputType="textCapSentences|textMultiLine" - android:textSize="?attr/font_18" + android:textSize="?attr/title_font_18" android:background="#00000000" android:textColor="@color/primaryTextColor" /> diff --git a/app/src/main/res/layout/dialog_edit_flair.xml b/app/src/main/res/layout/dialog_edit_flair.xml index 5872be15..55efc339 100644 --- a/app/src/main/res/layout/dialog_edit_flair.xml +++ b/app/src/main/res/layout/dialog_edit_flair.xml @@ -10,6 +10,7 @@ android:layout_margin="24dp" android:background="#00000000" android:textColor="@color/primaryTextColor" + android:textSize="?attr/font_default" android:hint="@string/flair" android:maxLength="64" /> diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index c286738a..1cac0a70 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -59,7 +59,7 @@ android:layout_marginEnd="32dp" android:layout_marginBottom="8dp" android:textColor="@color/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/content_font_default" /> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index 3de19829..058d53ae 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -79,7 +79,7 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/font_18" + android:textSize="?attr/title_font_18" android:textColor="@color/primaryTextColor"/> <androidx.constraintlayout.widget.ConstraintLayout diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml index c6dff0a7..09a99591 100644 --- a/app/src/main/res/layout/item_post_detail.xml +++ b/app/src/main/res/layout/item_post_detail.xml @@ -73,7 +73,7 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:textColor="@color/primaryTextColor" - android:textSize="?attr/font_18" /> + android:textSize="?attr/title_font_18" /> <TextView android:id="@+id/content_markdown_view_item_post_detail" @@ -83,7 +83,7 @@ android:paddingEnd="16dp" android:layout_marginTop="16dp" android:visibility="gone" - android:textSize="?attr/font_default" /> + android:textSize="?attr/content_font_default" /> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" diff --git a/app/src/main/res/layout/item_rule.xml b/app/src/main/res/layout/item_rule.xml index 652d53b0..5230295c 100644 --- a/app/src/main/res/layout/item_rule.xml +++ b/app/src/main/res/layout/item_rule.xml @@ -9,7 +9,7 @@ android:layout_height="wrap_content" android:padding="16dp" android:textColor="@color/primaryTextColor" - android:textSize="?attr/font_16" /> + android:textSize="?attr/title_font_16" /> <TextView android:id="@+id/description_markwon_view_item_rule" @@ -18,6 +18,6 @@ android:paddingBottom="16dp" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/font_default" /> + android:textSize="?attr/content_font_default" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 43b955c8..f50fe519 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -70,4 +70,34 @@ <item>Large</item> <item>XLarge</item> </string-array> + + <string-array name="settings_title_font_size"> + <item>Small</item> + <item>Normal</item> + <item>Large</item> + <item>Extra Large</item> + </string-array> + + <string-array name="settings_title_font_size_values"> + <item>Small</item> + <item>Normal</item> + <item>Large</item> + <item>XLarge</item> + </string-array> + + <string-array name="settings_content_font_size"> + <item>Small</item> + <item>Normal</item> + <item>Large</item> + <item>Extra Large</item> + <item>Enormous Large</item> + </string-array> + + <string-array name="settings_content_font_size_values"> + <item>Small</item> + <item>Normal</item> + <item>Large</item> + <item>XLarge</item> + <item>XXLarge</item> + </string-array> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml index 64aa4b9e..201074bd 100644 --- a/app/src/main/res/values/attr.xml +++ b/app/src/main/res/values/attr.xml @@ -9,4 +9,20 @@ <attr name="font_18" format="dimension"/> <attr name="font_20" format="dimension"/> </declare-styleable> + + <declare-styleable name="TitleFontStyle"> + <attr name="title_font_default" format="dimension"/> + <attr name="title_font_12" format="dimension"/> + <attr name="title_font_16" format="dimension"/> + <attr name="title_font_18" format="dimension"/> + <attr name="title_font_20" format="dimension"/> + </declare-styleable> + + <declare-styleable name="ContentFontStyle"> + <attr name="content_font_default" format="dimension"/> + <attr name="content_font_12" format="dimension"/> + <attr name="content_font_16" format="dimension"/> + <attr name="content_font_18" format="dimension"/> + <attr name="content_font_20" format="dimension"/> + </declare-styleable> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6d7b0153..e8cba1f9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -275,6 +275,8 @@ <string name="settings_theme_system_default_summary">Device default</string> <string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string> <string name="settings_font_size_title">Font Size</string> + <string name="settings_title_font_size_title">Title Font Size</string> + <string name="settings_content_font_size_title">Content Font Size</string> <string name="settings_enable_nsfw_title">Enable NSFW</string> <string name="settings_blur_nsfw_title">Blur NSFW images</string> <string name="settings_layout_no_limits_title">Display Under Navigation bar and Status Bar</string> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f066da89..2b6e10bb 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -85,8 +85,7 @@ <item name="android:textSize">?attr/font_default</item> </style> - <style name="FontStyle"> - </style> + <style name="FontStyle" /> <style name="FontStyle.Small"> <item name="font_default">12sp</item> @@ -120,4 +119,80 @@ <item name="font_20">24sp</item> </style> + <style name="TitleFontStyle" /> + + <style name="TitleFontStyle.Small"> + <item name="title_font_default">12sp</item> + <item name="title_font_12">12sp</item> + <item name="title_font_16">14sp</item> + <item name="title_font_18">16sp</item> + <item name="title_font_20">18sp</item> + </style> + + <style name="TitleFontStyle.Normal"> + <item name="title_font_default">14sp</item> + <item name="title_font_12">12sp</item> + <item name="title_font_16">16sp</item> + <item name="title_font_18">18sp</item> + <item name="title_font_20">20sp</item> + </style> + + <style name="TitleFontStyle.Large"> + <item name="font_default">16sp</item> + <item name="title_font_12">14sp</item> + <item name="title_font_16">18sp</item> + <item name="title_font_18">20sp</item> + <item name="title_font_20">22sp</item> + </style> + + <style name="TitleFontStyle.XLarge"> + <item name="title_font_default">18sp</item> + <item name="title_font_12">16sp</item> + <item name="title_font_16">20sp</item> + <item name="title_font_18">22sp</item> + <item name="title_font_20">24sp</item> + </style> + + <style name="ContentFontStyle" /> + + <style name="ContentFontStyle.Small"> + <item name="content_font_default">12sp</item> + <item name="content_font_12">12sp</item> + <item name="content_font_16">14sp</item> + <item name="content_font_18">16sp</item> + <item name="content_font_20">18sp</item> + </style> + + <style name="ContentFontStyle.Normal"> + <item name="content_font_default">14sp</item> + <item name="content_font_12">12sp</item> + <item name="content_font_16">16sp</item> + <item name="content_font_18">18sp</item> + <item name="content_font_20">20sp</item> + </style> + + <style name="ContentFontStyle.Large"> + <item name="content_font_default">16sp</item> + <item name="content_font_12">14sp</item> + <item name="content_font_16">18sp</item> + <item name="content_font_18">20sp</item> + <item name="content_font_20">22sp</item> + </style> + + <style name="ContentFontStyle.XLarge"> + <item name="content_font_default">18sp</item> + <item name="content_font_12">16sp</item> + <item name="content_font_16">20sp</item> + <item name="content_font_18">22sp</item> + <item name="content_font_20">24sp</item> + </style> + + <style name="ContentFontStyle.XXLarge"> + <item name="content_font_default">20sp</item> + <item name="content_font_12">18sp</item> + <item name="content_font_16">22sp</item> + <item name="content_font_18">24sp</item> + <item name="content_font_20">26sp</item> + </style> + </resources> diff --git a/app/src/main/res/xml/font_size_preferences.xml b/app/src/main/res/xml/font_size_preferences.xml new file mode 100644 index 00000000..40695b92 --- /dev/null +++ b/app/src/main/res/xml/font_size_preferences.xml @@ -0,0 +1,29 @@ +<?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="Normal" + android:entries="@array/settings_font_size" + app:entryValues="@array/settings_font_size_values" + app:key="font_size" + app:title="@string/settings_font_size_title" + app:useSimpleSummaryProvider="true" /> + + <ListPreference + app:defaultValue="Normal" + android:entries="@array/settings_title_font_size" + app:entryValues="@array/settings_title_font_size_values" + app:key="title_font_size" + app:title="@string/settings_title_font_size_title" + app:useSimpleSummaryProvider="true" /> + + <ListPreference + app:defaultValue="Normal" + android:entries="@array/settings_content_font_size" + app:entryValues="@array/settings_content_font_size_values" + app:key="content_font_size" + app:title="@string/settings_content_font_size_title" + app:useSimpleSummaryProvider="true" /> + +</PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index e1f8a0a0..6567eb1b 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -24,13 +24,9 @@ app:title="@string/settings_lazy_mode_interval_title" app:useSimpleSummaryProvider="true" /> - <ListPreference - app:defaultValue="Normal" - android:entries="@array/settings_font_size" - app:entryValues="@array/settings_font_size_values" - app:key="font_size" + <Preference app:title="@string/settings_font_size_title" - app:useSimpleSummaryProvider="true" /> + app:fragment="Settings.FontSizePreferenceFragment" /> <SwitchPreference app:defaultValue="false" |