mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-03-01 05:48:22 +03:00
Merge remote-tracking branch 'up-10/dev' into 10-feature-request-change-font
This commit is contained in:
commit
caaab12372
4 changed files with 8 additions and 2 deletions
|
@ -204,6 +204,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// build the relevant font TypeFace
|
||||||
public void setUpFont(final String preferredFont) {
|
public void setUpFont(final String preferredFont) {
|
||||||
switch (preferredFont) {
|
switch (preferredFont) {
|
||||||
case "Arial":
|
case "Arial":
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
initialSelectedContentCountry = org.schabi.newpipe.util.Localization
|
initialSelectedContentCountry = org.schabi.newpipe.util.Localization
|
||||||
.getPreferredContentCountry(requireContext());
|
.getPreferredContentCountry(requireContext());
|
||||||
initialLanguage = defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
initialLanguage = defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
||||||
|
//saving the initial font as system default
|
||||||
initialSelectedFont = defaultPreferences
|
initialSelectedFont = defaultPreferences
|
||||||
.getString(getString(R.string.app_font_key), getString(R.string.default_font_key));
|
.getString(getString(R.string.app_font_key), getString(R.string.default_font_key));
|
||||||
final Preference imageQualityPreference = requirePreference(R.string.image_quality_key);
|
final Preference imageQualityPreference = requirePreference(R.string.image_quality_key);
|
||||||
|
@ -82,6 +83,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
.getPreferredContentCountry(requireContext());
|
.getPreferredContentCountry(requireContext());
|
||||||
final String selectedLanguage =
|
final String selectedLanguage =
|
||||||
defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
||||||
|
// getting the selectedFont from SharedPreference
|
||||||
final String selectedFont =
|
final String selectedFont =
|
||||||
defaultPreferences.getString(getString(R.string.app_font_key), "Arial");
|
defaultPreferences.getString(getString(R.string.app_font_key), "Arial");
|
||||||
if (!selectedLocalization.equals(initialSelectedLocalization)
|
if (!selectedLocalization.equals(initialSelectedLocalization)
|
||||||
|
@ -91,9 +93,13 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
NewPipe.setupLocalization(selectedLocalization, selectedContentCountry);
|
NewPipe.setupLocalization(selectedLocalization, selectedContentCountry);
|
||||||
|
// checking if the font is changed from the initial
|
||||||
} else if ((!selectedFont.equals(initialSelectedFont))) {
|
} else if ((!selectedFont.equals(initialSelectedFont))) {
|
||||||
|
// showing toast to prompt restarting app
|
||||||
Toast.makeText(requireContext(), R.string.font_changes_requires_app_restart,
|
Toast.makeText(requireContext(), R.string.font_changes_requires_app_restart,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
// saving the font selected into SharedPreference
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(requireContext());
|
.getDefaultSharedPreferences(requireContext());
|
||||||
final SharedPreferences.Editor editor = preferences.edit();
|
final SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="@string/default_localization_key"
|
android:defaultValue="@string/default_font_key"
|
||||||
android:entries="@array/app_font_name"
|
android:entries="@array/app_font_name"
|
||||||
android:entryValues="@array/app_font_code"
|
android:entryValues="@array/app_font_code"
|
||||||
android:key="@string/app_font_key"
|
android:key="@string/app_font_key"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
// the kotlin version might be different from NewPipe main
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.9.25'
|
ext.kotlin_version = '1.9.25'
|
||||||
repositories {
|
repositories {
|
||||||
|
|
Loading…
Add table
Reference in a new issue