Add title and content font size options.

This commit is contained in:
Alex Ning 2019-09-27 00:30:24 +08:00
parent 81c259edcb
commit 837e461451
47 changed files with 413 additions and 41 deletions

View File

@ -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;
});
}
}
}
}

View File

@ -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;
});
}
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -1,8 +1,3 @@
package ml.docilealligator.infinityforreddit;
public class ChangeFontSizeEvent {
public String fontSize;
public ChangeFontSizeEvent(String fontSize) {
this.fontSize = fontSize;
}
}
public class ChangeFontSizeEvent { }

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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";
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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"