diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java index 1eb8aa0a..883d0ce8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -27,11 +27,14 @@ import com.google.android.material.tabs.TabLayout; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; -import ml.docilealligator.infinityforreddit.ContentFontStyle; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontFamily; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontFamily; +import ml.docilealligator.infinityforreddit.Font.FontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontFamily; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; @@ -113,6 +116,15 @@ public abstract class BaseActivity extends AppCompatActivity { getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); + Window window = getWindow(); View decorView = window.getDecorView(); if (!hasDrawerLayout) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java index c9a08f48..015f0a37 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java @@ -41,15 +41,15 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; -import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeSettingsItem; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.FontStyle; import ml.docilealligator.infinityforreddit.Fragment.ThemePreviewCommentsFragment; import ml.docilealligator.infinityforreddit.Fragment.ThemePreviewPostsFragment; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java index 8bdc82fe..59521940 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java @@ -47,11 +47,11 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.AsyncTask.SaveGIFToFileAsyncTask; import ml.docilealligator.infinityforreddit.BuildConfig; -import ml.docilealligator.infinityforreddit.ContentFontStyle; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontStyle; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import pl.droidsonroids.gif.GifImageView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java index 779d7fe7..6db185e0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java @@ -49,11 +49,11 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.AsyncTask.SaveImageToFileAsyncTask; import ml.docilealligator.infinityforreddit.BuildConfig; -import ml.docilealligator.infinityforreddit.ContentFontStyle; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontStyle; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; public class ViewImageActivity extends AppCompatActivity { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java index 9e0b95e7..7d776ed6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java @@ -33,14 +33,14 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.API.ImgurAPI; -import ml.docilealligator.infinityforreddit.ContentFontStyle; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontStyle; import ml.docilealligator.infinityforreddit.Fragment.ViewImgurImageFragment; import ml.docilealligator.infinityforreddit.Fragment.ViewImgurVideoFragment; import ml.docilealligator.infinityforreddit.ImgurMedia; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.APIUtils; import ml.docilealligator.infinityforreddit.Utils.JSONUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java new file mode 100644 index 00000000..1ef28bbe --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java @@ -0,0 +1,25 @@ +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; + +public enum ContentFontFamily { + Default(R.style.ContentFontFamily, "Default"), + BalsamiqSans(R.style.ContentFontFamily_BalsamiqSans, "BalsamiqSans"), + NotoSans(R.style.ContentFontFamily_NotoSans, "NotoSans"); + + private int resId; + private String title; + + ContentFontFamily(int resId, String title) { + this.resId = resId; + this.title = title; + } + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java similarity index 85% rename from app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java rename to app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java index 4eee6b53..654cff07 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; public enum ContentFontStyle { Small(R.style.ContentFontStyle_Small, "Small"), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java new file mode 100644 index 00000000..f33873b2 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java @@ -0,0 +1,25 @@ +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; + +public enum FontFamily { + Default(R.style.FontFamily, "Default"), + BalsamiqSans(R.style.FontFamily_BalsamiqSans, "BalsamiqSans"), + NotoSans(R.style.FontFamily_NotoSans, "NotoSans"); + + private int resId; + private String title; + + FontFamily(int resId, String title) { + this.resId = resId; + this.title = title; + } + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java similarity index 83% rename from app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java rename to app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java index 61d4cfb8..101b17b4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; public enum FontStyle { Small(R.style.FontStyle_Small, "Small"), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java new file mode 100644 index 00000000..2b9a73b0 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java @@ -0,0 +1,25 @@ +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; + +public enum TitleFontFamily { + Default(R.style.TitleFontFamily, "Default"), + BalsamiqSans(R.style.TitleFontFamily_BalsamiqSans, "BalsamiqSans"), + NotoSans(R.style.TitleFontFamily_NotoSans, "NotoSans"); + + private int resId; + private String title; + + TitleFontFamily(int resId, String title) { + this.resId = resId; + this.title = title; + } + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java similarity index 83% rename from app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java rename to app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java index 5dc32c9d..9ac48525 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; public enum TitleFontStyle { Small(R.style.TitleFontStyle_Small, "Small"), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java index a51c9e0b..b29ff3ed 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -29,6 +29,9 @@ public class SharedPreferencesUtils { 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"; + public static final String FONT_FAMILY_KEY = "font_family"; + public static final String TITLE_FONT_FAMILY_KEY = "title_font_family"; + public static final String CONTENT_FONT_FAMILY_KEY = "content_font_family"; public static final String AMOLED_DARK_KEY = "amoled_dark"; public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface"; public static final String IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY = "immersive_interface_ignore_nav_bar"; diff --git a/app/src/main/res/font/balsamiq_sans.xml b/app/src/main/res/font/balsamiq_sans.xml new file mode 100644 index 00000000..01faaeb6 --- /dev/null +++ b/app/src/main/res/font/balsamiq_sans.xml @@ -0,0 +1,22 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/font/balsamiq_sans_bold.ttf b/app/src/main/res/font/balsamiq_sans_bold.ttf new file mode 100644 index 00000000..840ff319 Binary files /dev/null and b/app/src/main/res/font/balsamiq_sans_bold.ttf differ diff --git a/app/src/main/res/font/balsamiq_sans_bold_italic.ttf b/app/src/main/res/font/balsamiq_sans_bold_italic.ttf new file mode 100644 index 00000000..9a8d7567 Binary files /dev/null and b/app/src/main/res/font/balsamiq_sans_bold_italic.ttf differ diff --git a/app/src/main/res/font/balsamiq_sans_italic.ttf b/app/src/main/res/font/balsamiq_sans_italic.ttf new file mode 100644 index 00000000..6c749d45 Binary files /dev/null and b/app/src/main/res/font/balsamiq_sans_italic.ttf differ diff --git a/app/src/main/res/font/balsamiq_sans_regular.ttf b/app/src/main/res/font/balsamiq_sans_regular.ttf new file mode 100644 index 00000000..5f3febff Binary files /dev/null and b/app/src/main/res/font/balsamiq_sans_regular.ttf differ diff --git a/app/src/main/res/font/noto_sans.xml b/app/src/main/res/font/noto_sans.xml new file mode 100644 index 00000000..5fe68106 --- /dev/null +++ b/app/src/main/res/font/noto_sans.xml @@ -0,0 +1,22 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/font/noto_sans_bold.ttf b/app/src/main/res/font/noto_sans_bold.ttf new file mode 100644 index 00000000..54ad879b Binary files /dev/null and b/app/src/main/res/font/noto_sans_bold.ttf differ diff --git a/app/src/main/res/font/noto_sans_bold_italic.ttf b/app/src/main/res/font/noto_sans_bold_italic.ttf new file mode 100644 index 00000000..530a8283 Binary files /dev/null and b/app/src/main/res/font/noto_sans_bold_italic.ttf differ diff --git a/app/src/main/res/font/noto_sans_italic.ttf b/app/src/main/res/font/noto_sans_italic.ttf new file mode 100644 index 00000000..27ff1ed6 Binary files /dev/null and b/app/src/main/res/font/noto_sans_italic.ttf differ diff --git a/app/src/main/res/font/noto_sans_regular.ttf b/app/src/main/res/font/noto_sans_regular.ttf new file mode 100644 index 00000000..10589e27 Binary files /dev/null and b/app/src/main/res/font/noto_sans_regular.ttf differ diff --git a/app/src/main/res/layout/activity_comment.xml b/app/src/main/res/layout/activity_comment.xml index 33b9cfc3..0fb6ef04 100644 --- a/app/src/main/res/layout/activity_comment.xml +++ b/app/src/main/res/layout/activity_comment.xml @@ -37,7 +37,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp" - android:textSize="?attr/title_font_16" /> + android:textSize="?attr/title_font_16" + android:fontFamily="?attr/content_font_family" /> + android:textSize="?attr/content_font_18" + android:fontFamily="?attr/content_font_family" /> diff --git a/app/src/main/res/layout/activity_create_multi_reddit.xml b/app/src/main/res/layout/activity_create_multi_reddit.xml index a3a6f916..b606221d 100644 --- a/app/src/main/res/layout/activity_create_multi_reddit.xml +++ b/app/src/main/res/layout/activity_create_multi_reddit.xml @@ -51,6 +51,7 @@ android:textSize="?attr/font_default" android:background="#00000000" android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" android:maxLength="50" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> diff --git a/app/src/main/res/layout/activity_edit_comment.xml b/app/src/main/res/layout/activity_edit_comment.xml index 305c9578..79bc90f3 100644 --- a/app/src/main/res/layout/activity_edit_comment.xml +++ b/app/src/main/res/layout/activity_edit_comment.xml @@ -33,6 +33,7 @@ android:padding="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/content_font_18" + android:fontFamily="?attr/content_font_family" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_edit_multi_reddit.xml b/app/src/main/res/layout/activity_edit_multi_reddit.xml index c95ea6d1..c037daea 100644 --- a/app/src/main/res/layout/activity_edit_multi_reddit.xml +++ b/app/src/main/res/layout/activity_edit_multi_reddit.xml @@ -59,6 +59,7 @@ android:textSize="?attr/font_default" android:background="#00000000" android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" android:maxLength="50" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/title_font_family" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/content_font_family" /> diff --git a/app/src/main/res/layout/activity_multi_reddit_listing.xml b/app/src/main/res/layout/activity_multi_reddit_listing.xml index 6fdd794a..308374b2 100644 --- a/app/src/main/res/layout/activity_multi_reddit_listing.xml +++ b/app/src/main/res/layout/activity_multi_reddit_listing.xml @@ -66,7 +66,8 @@ android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no_multi_reddits" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml index 8360f4b9..c6367aa1 100644 --- a/app/src/main/res/layout/activity_post_image.xml +++ b/app/src/main/res/layout/activity_post_image.xml @@ -57,7 +57,8 @@ android:layout_toStartOf="@id/rules_button_post_image_activity" android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_image_activity" android:text="@string/choose_a_subreddit" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" />