Add FontPreviewFragment. Add some fonts and delete some.

This commit is contained in:
Alex Ning 2020-06-17 09:38:36 +08:00
parent 66f4db6b40
commit 72f176201e
33 changed files with 219 additions and 89 deletions

View File

@ -23,10 +23,11 @@
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:replace="android:label"> tools:replace="android:label">
<service <service
android:name=".Service.DownloadRedditVideoService" android:name=".Service.DownloadRedditVideoService"
android:enabled="true" android:enabled="true"
android:exported="false"></service> android:exported="false" />
<activity <activity
android:name=".Activity.ViewImgurMediaActivity" android:name=".Activity.ViewImgurMediaActivity"

View File

@ -26,6 +26,7 @@ import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.FontPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
@ -83,6 +84,8 @@ public class SettingsActivity extends BaseActivity implements
setTitle(R.string.settings_about_master_title); setTitle(R.string.settings_about_master_title);
} else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) { } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) {
setTitle(R.string.settings_interface_title); setTitle(R.string.settings_interface_title);
} else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof FontPreferenceFragment) {
setTitle(R.string.settings_font_title);
} }
}); });
} }

View File

@ -8,10 +8,11 @@ public enum ContentFontFamily {
NotoSans(R.style.ContentFontFamily_NotoSans, "NotoSans"), NotoSans(R.style.ContentFontFamily_NotoSans, "NotoSans"),
RobotoCondensed(R.style.ContentFontFamily_RobotoCondensed, "RobotoCondensed"), RobotoCondensed(R.style.ContentFontFamily_RobotoCondensed, "RobotoCondensed"),
HarmoniaSans(R.style.ContentFontFamily_HarmoniaSans, "HarmoniaSans"), HarmoniaSans(R.style.ContentFontFamily_HarmoniaSans, "HarmoniaSans"),
Selawk(R.style.ContentFontFamily_Selawk, "Selawk"),
Inter(R.style.ContentFontFamily_Inter, "Inter"), Inter(R.style.ContentFontFamily_Inter, "Inter"),
Manrope(R.style.ContentFontFamily_Manrope, "Manrope"), 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 int resId;
private String title; private String title;

View File

@ -8,10 +8,11 @@ public enum FontFamily {
NotoSans(R.style.FontFamily_NotoSans, "NotoSans"), NotoSans(R.style.FontFamily_NotoSans, "NotoSans"),
RobotoCondensed(R.style.FontFamily_RobotoCondensed, "RobotoCondensed"), RobotoCondensed(R.style.FontFamily_RobotoCondensed, "RobotoCondensed"),
HarmoniaSans(R.style.FontFamily_HarmoniaSans, "HarmoniaSans"), HarmoniaSans(R.style.FontFamily_HarmoniaSans, "HarmoniaSans"),
Selawk(R.style.FontFamily_Selawk, "Selawk"),
Inter(R.style.FontFamily_Inter, "Inter"), Inter(R.style.FontFamily_Inter, "Inter"),
Manrope(R.style.FontFamily_Manrope, "Manrope"), 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 int resId;
private String title; private String title;

View File

@ -8,10 +8,11 @@ public enum TitleFontFamily {
NotoSans(R.style.TitleFontFamily_NotoSans, "NotoSans"), NotoSans(R.style.TitleFontFamily_NotoSans, "NotoSans"),
RobotoCondensed(R.style.TitleFontFamily_RobotoCondensed, "RobotoCondensed"), RobotoCondensed(R.style.TitleFontFamily_RobotoCondensed, "RobotoCondensed"),
HarmoniaSans(R.style.TitleFontFamily_HarmoniaSans, "HarmoniaSans"), HarmoniaSans(R.style.TitleFontFamily_HarmoniaSans, "HarmoniaSans"),
Selawk(R.style.TitleFontFamily_Selawk, "Selawk"),
Inter(R.style.TitleFontFamily_Inter, "Inter"), Inter(R.style.TitleFontFamily_Inter, "Inter"),
Manrope(R.style.TitleFontFamily_Manrope, "Manrope"), 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 int resId;
private String title; private String title;

View File

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

Binary file not shown.

View File

@ -3,15 +3,10 @@
<font <font
app:fontStyle="normal" app:fontStyle="normal"
app:fontWeight="400" app:fontWeight="400"
app:font="@font/selawk_regular" /> app:font="@font/caveat_regular" />
<font <font
app:fontStyle="normal" app:fontStyle="normal"
app:fontWeight="700" app:fontWeight="700"
app:font="@font/selawk_bold" /> app:font="@font/caveat_bold" />
<font
app:fontStyle="normal"
app:fontWeight="300"
app:font="@font/selawk_light" />
</font-family> </font-family>

Binary file not shown.

Binary file not shown.

View File

@ -9,9 +9,4 @@
app:fontStyle="normal" app:fontStyle="normal"
app:fontWeight="700" app:fontWeight="700"
app:font="@font/inter_bold" /> app:font="@font/inter_bold" />
<font
app:fontStyle="normal"
app:fontWeight="300"
app:font="@font/inter_light" />
</font-family> </font-family>

View File

@ -9,9 +9,4 @@
app:fontStyle="normal" app:fontStyle="normal"
app:fontWeight="700" app:fontWeight="700"
app:font="@font/manrope_bold" /> app:font="@font/manrope_bold" />
<font
app:fontStyle="normal"
app:fontWeight="300"
app:font="@font/manrope_light" />
</font-family> </font-family>

View File

@ -10,16 +10,6 @@
app:fontWeight="700" app:fontWeight="700"
app:font="@font/roboto_condensed_bold" /> app:font="@font/roboto_condensed_bold" />
<font
app:fontStyle="normal"
app:fontWeight="300"
app:font="@font/roboto_condensed_light" />
<font
app:fontStyle="italic"
app:fontWeight="300"
app:font="@font/roboto_condensed_light_italic" />
<font <font
app:fontStyle="italic" app:fontStyle="italic"
app:fontWeight="400" app:fontWeight="400"

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/rubik_regular" />
<font
app:fontStyle="normal"
app:fontWeight="700"
app:font="@font/rubik_bold" />
<font
app:fontStyle="normal"
app:fontWeight="300"
app:font="@font/rubik_light" />
<font
app:fontStyle="italic"
app:fontWeight="300"
app:font="@font/rubik_light_italic" />
<font
app:fontStyle="italic"
app:fontWeight="400"
app:font="@font/rubik_italic" />
<font
app:fontStyle="italic"
app:fontWeight="700"
app:font="@font/rubik_bold_italic" />
</font-family>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Settings.FontPreviewFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/default_font_font_preview"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Balsamiq Sans"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/balsamiq_sans" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Noto Sans"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/noto_sans" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Roboto Condensed"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/roboto_condensed" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Harmonia Sans"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/harmonia_sans" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Inter"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/inter" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Manrope"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/manrope" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Caveat"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/caveat" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Bad Script"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/bad_script_regular" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="Sriracha"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="@font/sriracha_regular" />
</LinearLayout>

View File

@ -129,10 +129,11 @@
<item>Noto Sans</item> <item>Noto Sans</item>
<item>Roboto Condensed</item> <item>Roboto Condensed</item>
<item>Harmonia Sans</item> <item>Harmonia Sans</item>
<item>Selawk</item>
<item>Inter</item> <item>Inter</item>
<item>Manrope</item> <item>Manrope</item>
<item>Rubik</item> <item>Caveat</item>
<item>Bad Script</item>
<item>Sriracha</item>
</string-array> </string-array>
<string-array name="settings_font_family_values"> <string-array name="settings_font_family_values">
@ -141,10 +142,11 @@
<item>NotoSans</item> <item>NotoSans</item>
<item>RobotoCondensed</item> <item>RobotoCondensed</item>
<item>HarmoniaSans</item> <item>HarmoniaSans</item>
<item>Selawk</item>
<item>Inter</item> <item>Inter</item>
<item>Manrope</item> <item>Manrope</item>
<item>Rubik</item> <item>Caveat</item>
<item>BadScript</item>
<item>Sriracha</item>
</string-array> </string-array>
<string-array name="settings_tab_post_type"> <string-array name="settings_tab_post_type">

View File

@ -352,6 +352,7 @@
<string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">Swipe Up to Hide Jump to Next Top-level Comment Button</string> <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">Swipe Up to Hide Jump to Next Top-level Comment Button</string>
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string> <string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
<string name="settings_font_title">Font</string> <string name="settings_font_title">Font</string>
<string name="settings_preview_font_title">Font Preview</string>
<string name="settings_font_summary">Font</string> <string name="settings_font_summary">Font</string>
<string name="settings_title_font_summary">Title</string> <string name="settings_title_font_summary">Title</string>
<string name="settings_content_font_summary">Content</string> <string name="settings_content_font_summary">Content</string>
@ -772,4 +773,8 @@
<string name="set_to_lock_screen">Set to Lock Screen</string> <string name="set_to_lock_screen">Set to Lock Screen</string>
<string name="set_to_both">Set to Both</string> <string name="set_to_both">Set to Both</string>
<string name="default_font_font_preview">Default</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources> </resources>

View File

@ -254,10 +254,6 @@
<item name="font_family">@font/harmonia_sans</item> <item name="font_family">@font/harmonia_sans</item>
</style> </style>
<style name="FontFamily.Selawk">
<item name="font_family">@font/selawk</item>
</style>
<style name="FontFamily.Inter"> <style name="FontFamily.Inter">
<item name="font_family">@font/inter</item> <item name="font_family">@font/inter</item>
</style> </style>
@ -266,8 +262,16 @@
<item name="font_family">@font/manrope</item> <item name="font_family">@font/manrope</item>
</style> </style>
<style name="FontFamily.Rubik"> <style name="FontFamily.Caveat">
<item name="font_family">@font/rubik</item> <item name="font_family">@font/caveat</item>
</style>
<style name="FontFamily.BadScript">
<item name="font_family">@font/bad_script_regular</item>
</style>
<style name="FontFamily.Sriracha">
<item name="font_family">@font/sriracha_regular</item>
</style> </style>
<style name="TitleFontFamily" /> <style name="TitleFontFamily" />
@ -292,10 +296,6 @@
<item name="title_font_family">@font/harmonia_sans</item> <item name="title_font_family">@font/harmonia_sans</item>
</style> </style>
<style name="TitleFontFamily.Selawk">
<item name="title_font_family">@font/selawk</item>
</style>
<style name="TitleFontFamily.Inter"> <style name="TitleFontFamily.Inter">
<item name="title_font_family">@font/inter</item> <item name="title_font_family">@font/inter</item>
</style> </style>
@ -304,8 +304,16 @@
<item name="title_font_family">@font/manrope</item> <item name="title_font_family">@font/manrope</item>
</style> </style>
<style name="TitleFontFamily.Rubik"> <style name="TitleFontFamily.Caveat">
<item name="title_font_family">@font/rubik</item> <item name="title_font_family">@font/caveat</item>
</style>
<style name="TitleFontFamily.BadScript">
<item name="title_font_family">@font/bad_script_regular</item>
</style>
<style name="TitleFontFamily.Sriracha">
<item name="title_font_family">@font/sriracha_regular</item>
</style> </style>
<style name="ContentFontFamily" /> <style name="ContentFontFamily" />
@ -330,10 +338,6 @@
<item name="content_font_family">@font/harmonia_sans</item> <item name="content_font_family">@font/harmonia_sans</item>
</style> </style>
<style name="ContentFontFamily.Selawk">
<item name="content_font_family">@font/selawk</item>
</style>
<style name="ContentFontFamily.Inter"> <style name="ContentFontFamily.Inter">
<item name="content_font_family">@font/inter</item> <item name="content_font_family">@font/inter</item>
</style> </style>
@ -342,8 +346,16 @@
<item name="content_font_family">@font/manrope</item> <item name="content_font_family">@font/manrope</item>
</style> </style>
<style name="ContentFontFamily.Rubik"> <style name="ContentFontFamily.Caveat">
<item name="content_font_family">@font/rubik</item> <item name="content_font_family">@font/caveat</item>
</style>
<style name="ContentFontFamily.BadScript">
<item name="content_font_family">@font/bad_script_regular</item>
</style>
<style name="ContentFontFamily.Sriracha">
<item name="content_font_family">@font/sriracha_regular</item>
</style> </style>
<style name="Theme" /> <style name="Theme" />

View File

@ -2,6 +2,10 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference
app:title="@string/settings_preview_font_title"
app:fragment="ml.docilealligator.infinityforreddit.Settings.FontPreviewFragment" />
<PreferenceCategory <PreferenceCategory
app:title="@string/settings_font_summary" /> app:title="@string/settings_font_summary" />