From 72f176201ee4bdb2b7057f5b5443cf232debd0c2 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 17 Jun 2020 09:38:36 +0800 Subject: Add FontPreviewFragment. Add some fonts and delete some. --- .../Activity/SettingsActivity.java | 3 +++ .../infinityforreddit/Font/ContentFontFamily.java | 5 ++-- .../infinityforreddit/Font/FontFamily.java | 5 ++-- .../infinityforreddit/Font/TitleFontFamily.java | 5 ++-- .../Settings/FontPreviewFragment.java | 29 ++++++++++++++++++++++ 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java index ef91f34a..3c50caf8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java @@ -26,6 +26,7 @@ import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment; +import ml.docilealligator.infinityforreddit.Settings.FontPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; @@ -83,6 +84,8 @@ public class SettingsActivity extends BaseActivity implements setTitle(R.string.settings_about_master_title); } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) { setTitle(R.string.settings_interface_title); + } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof FontPreferenceFragment) { + setTitle(R.string.settings_font_title); } }); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java index cad7a532..f1659d68 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java @@ -8,10 +8,11 @@ public enum ContentFontFamily { NotoSans(R.style.ContentFontFamily_NotoSans, "NotoSans"), RobotoCondensed(R.style.ContentFontFamily_RobotoCondensed, "RobotoCondensed"), HarmoniaSans(R.style.ContentFontFamily_HarmoniaSans, "HarmoniaSans"), - Selawk(R.style.ContentFontFamily_Selawk, "Selawk"), Inter(R.style.ContentFontFamily_Inter, "Inter"), Manrope(R.style.ContentFontFamily_Manrope, "Manrope"), - Rubik(R.style.ContentFontFamily_Rubik, "Rubik"); + Caveat(R.style.ContentFontFamily_Caveat, "Caveat"), + BadScript(R.style.ContentFontFamily_BadScript, "BadScript"), + Sriracha(R.style.ContentFontFamily_Sriracha, "Sriracha"); private int resId; private String title; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java index 88e89660..debd9b73 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java @@ -8,10 +8,11 @@ public enum FontFamily { NotoSans(R.style.FontFamily_NotoSans, "NotoSans"), RobotoCondensed(R.style.FontFamily_RobotoCondensed, "RobotoCondensed"), HarmoniaSans(R.style.FontFamily_HarmoniaSans, "HarmoniaSans"), - Selawk(R.style.FontFamily_Selawk, "Selawk"), Inter(R.style.FontFamily_Inter, "Inter"), Manrope(R.style.FontFamily_Manrope, "Manrope"), - Rubik(R.style.FontFamily_Rubik, "Rubik"); + Caveat(R.style.FontFamily_Caveat, "Caveat"), + BadScript(R.style.FontFamily_BadScript, "BadScript"), + Sriracha(R.style.FontFamily_Sriracha, "Sriracha"); private int resId; private String title; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java index 17ebf3bd..0548f4e0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java @@ -8,10 +8,11 @@ public enum TitleFontFamily { NotoSans(R.style.TitleFontFamily_NotoSans, "NotoSans"), RobotoCondensed(R.style.TitleFontFamily_RobotoCondensed, "RobotoCondensed"), HarmoniaSans(R.style.TitleFontFamily_HarmoniaSans, "HarmoniaSans"), - Selawk(R.style.TitleFontFamily_Selawk, "Selawk"), Inter(R.style.TitleFontFamily_Inter, "Inter"), Manrope(R.style.TitleFontFamily_Manrope, "Manrope"), - Rubik(R.style.TitleFontFamily_Rubik, "Rubik"); + Caveat(R.style.TitleFontFamily_Caveat, "Caveat"), + BadScript(R.style.TitleFontFamily_BadScript, "BadScript"), + Sriracha(R.style.TitleFontFamily_Sriracha, "Sriracha"); private int resId; private String title; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java new file mode 100644 index 00000000..9cd93e01 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java @@ -0,0 +1,29 @@ +package ml.docilealligator.infinityforreddit.Settings; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.fragment.app.Fragment; + +import ml.docilealligator.infinityforreddit.R; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link FontPreviewFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class FontPreviewFragment extends Fragment { + + public FontPreviewFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_font_preview, container, false); + return rootView; + } +} \ No newline at end of file -- cgit v1.2.3