mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-03-01 05:48:22 +03:00
make change to the font of other stuffs
This commit is contained in:
parent
bca9fa7b7f
commit
71c161ce0f
43 changed files with 584 additions and 99 deletions
|
@ -118,6 +118,7 @@ public class App extends Application {
|
||||||
configureRxJavaErrorHandler();
|
configureRxJavaErrorHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTerminate() {
|
public void onTerminate() {
|
||||||
super.onTerminate();
|
super.onTerminate();
|
||||||
|
|
|
@ -179,12 +179,13 @@ public class MainActivity extends AppCompatActivity {
|
||||||
&& ReleaseVersionUtil.INSTANCE.isReleaseApk()) {
|
&& ReleaseVersionUtil.INSTANCE.isReleaseApk()) {
|
||||||
UpdateSettingsFragment.askForConsentToUpdateChecks(this);
|
UpdateSettingsFragment.askForConsentToUpdateChecks(this);
|
||||||
}
|
}
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(final Bundle savedInstanceState) {
|
protected void onPostCreate(final Bundle savedInstanceState) {
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
|
|
||||||
|
@ -201,7 +202,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpFont(final String preferredFont) {
|
public void setUpFont(final String preferredFont) {
|
||||||
|
|
|
@ -187,14 +187,14 @@ public class RouterActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.schabi.newpipe.about
|
package org.schabi.newpipe.about
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
|
@ -10,8 +11,10 @@ import androidx.annotation.StringRes
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
import com.google.android.material.tabs.TabLayoutMediator
|
||||||
|
import com.marcinorlowski.fonty.Fonty
|
||||||
import org.schabi.newpipe.BuildConfig
|
import org.schabi.newpipe.BuildConfig
|
||||||
import org.schabi.newpipe.R
|
import org.schabi.newpipe.R
|
||||||
import org.schabi.newpipe.databinding.ActivityAboutBinding
|
import org.schabi.newpipe.databinding.ActivityAboutBinding
|
||||||
|
@ -44,6 +47,15 @@ class AboutActivity : AppCompatActivity() {
|
||||||
) { tab, position ->
|
) { tab, position ->
|
||||||
tab.setText(mAboutStateAdapter.getPageTitle(position))
|
tab.setText(mAboutStateAdapter.getPageTitle(position))
|
||||||
}.attach()
|
}.attach()
|
||||||
|
val preferredFont = getPreferredFont(this)
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun getPreferredFont(context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context!!)
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class DownloadActivity extends AppCompatActivity {
|
||||||
FocusOverlayView.setupFocusObserver(this);
|
FocusOverlayView.setupFocusObserver(this);
|
||||||
}
|
}
|
||||||
final String preferredFont = getPreferredFont(this);
|
final String preferredFont = getPreferredFont(this);
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public class DownloadActivity extends AppCompatActivity {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import androidx.documentfile.provider.DocumentFile;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
import com.nononsenseapps.filepicker.Utils;
|
import com.nononsenseapps.filepicker.Utils;
|
||||||
|
|
||||||
import org.schabi.newpipe.MainActivity;
|
import org.schabi.newpipe.MainActivity;
|
||||||
|
@ -117,7 +118,6 @@ public class DownloadDialog extends DialogFragment
|
||||||
private ActionMenuItemView okButton = null;
|
private ActionMenuItemView okButton = null;
|
||||||
private Context context = null;
|
private Context context = null;
|
||||||
private boolean askForSavePath;
|
private boolean askForSavePath;
|
||||||
|
|
||||||
private AudioTrackAdapter audioTrackAdapter;
|
private AudioTrackAdapter audioTrackAdapter;
|
||||||
private StreamItemAdapter<AudioStream, Stream> audioStreamsAdapter;
|
private StreamItemAdapter<AudioStream, Stream> audioStreamsAdapter;
|
||||||
private StreamItemAdapter<VideoStream, AudioStream> videoStreamsAdapter;
|
private StreamItemAdapter<VideoStream, AudioStream> videoStreamsAdapter;
|
||||||
|
@ -152,7 +152,6 @@ public class DownloadDialog extends DialogFragment
|
||||||
// otherwise InstantiationException will be thrown when fragment is recreated
|
// otherwise InstantiationException will be thrown when fragment is recreated
|
||||||
// TODO: Maybe use a custom FragmentFactory instead?
|
// TODO: Maybe use a custom FragmentFactory instead?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new download dialog with the video, audio and subtitle streams from the provided
|
* Create a new download dialog with the video, audio and subtitle streams from the provided
|
||||||
* stream info. Video streams and video-only streams will be put into a single list menu,
|
* stream info. Video streams and video-only streams will be put into a single list menu,
|
||||||
|
@ -245,6 +244,7 @@ public class DownloadDialog extends DialogFragment
|
||||||
}, Context.BIND_AUTO_CREATE);
|
}, Context.BIND_AUTO_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the displayed video streams based on the selected audio track.
|
* Update the displayed video streams based on the selected audio track.
|
||||||
*/
|
*/
|
||||||
|
@ -287,10 +287,22 @@ public class DownloadDialog extends DialogFragment
|
||||||
+ "inflater = [" + inflater + "], container = [" + container + "], "
|
+ "inflater = [" + inflater + "], container = [" + container + "], "
|
||||||
+ "savedInstanceState = [" + savedInstanceState + "]");
|
+ "savedInstanceState = [" + savedInstanceState + "]");
|
||||||
}
|
}
|
||||||
return inflater.inflate(R.layout.download_dialog, container);
|
final View view = inflater.inflate(R.layout.download_dialog, container);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public String getPreferredFont(final Context cont) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(cont);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onViewCreated(@NonNull final View view,
|
public void onViewCreated(@NonNull final View view,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class ErrorActivity extends AppCompatActivity {
|
||||||
for (final String e : errorInfo.getStackTraces()) {
|
for (final String e : errorInfo.getStackTraces()) {
|
||||||
Log.e(TAG, e);
|
Log.e(TAG, e);
|
||||||
}
|
}
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ public class ErrorActivity extends AppCompatActivity {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
||||||
|
|
||||||
recaptchaBinding.reCaptchaWebView.loadUrl(url);
|
recaptchaBinding.reCaptchaWebView.loadUrl(url);
|
||||||
|
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package org.schabi.newpipe.fragments;
|
package org.schabi.newpipe.fragments;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -16,8 +21,19 @@ public class BlankFragment extends BaseFragment {
|
||||||
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
||||||
final Bundle savedInstanceState) {
|
final Bundle savedInstanceState) {
|
||||||
setTitle("NewPipe");
|
setTitle("NewPipe");
|
||||||
return inflater.inflate(R.layout.fragment_blank, container, false);
|
final View view = inflater.inflate(R.layout.fragment_blank, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
|
|
@ -10,6 +10,8 @@ import android.view.ViewGroup;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
|
||||||
|
@ -26,7 +28,7 @@ public class EmptyFragment extends BaseFragment {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
||||||
|
@ -35,6 +37,11 @@ public class EmptyFragment extends BaseFragment {
|
||||||
final View view = inflater.inflate(R.layout.fragment_empty, container, false);
|
final View view = inflater.inflate(R.layout.fragment_empty, container, false);
|
||||||
view.findViewById(R.id.empty_state_view).setVisibility(
|
view.findViewById(R.id.empty_state_view).setVisibility(
|
||||||
showMessage ? View.VISIBLE : View.GONE);
|
showMessage ? View.VISIBLE : View.GONE);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import androidx.preference.PreferenceManager;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -94,14 +95,22 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_main, container, false);
|
final View view = inflater.inflate(R.layout.fragment_main, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import static android.text.TextUtils.isEmpty;
|
||||||
import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
|
import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
|
||||||
import static org.schabi.newpipe.util.text.TextLinkifier.SET_LINK_MOVEMENT_METHOD;
|
import static org.schabi.newpipe.util.text.TextLinkifier.SET_LINK_MOVEMENT_METHOD;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
|
@ -21,8 +23,10 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.appcompat.widget.TooltipCompat;
|
import androidx.appcompat.widget.TooltipCompat;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.google.android.material.chip.Chip;
|
import com.google.android.material.chip.Chip;
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -53,8 +57,17 @@ public abstract class BaseDescriptionFragment extends BaseFragment {
|
||||||
setupDescription();
|
setupDescription();
|
||||||
setupMetadata(inflater, binding.detailMetadataLayout);
|
setupMetadata(inflater, binding.detailMetadataLayout);
|
||||||
addTagsMetadataItem(inflater, binding.detailMetadataLayout);
|
addTagsMetadataItem(inflater, binding.detailMetadataLayout);
|
||||||
|
final String preferredFont = getPreferredFont(binding.getRoot().getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) binding.getRoot());
|
||||||
|
}
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
|
|
@ -61,6 +61,7 @@ import com.google.android.exoplayer2.PlaybackParameters;
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.App;
|
import org.schabi.newpipe.App;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -333,8 +334,18 @@ public final class VideoDetailFragment
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
|
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
|
||||||
final Bundle savedInstanceState) {
|
final Bundle savedInstanceState) {
|
||||||
binding = FragmentVideoDetailBinding.inflate(inflater, container, false);
|
binding = FragmentVideoDetailBinding.inflate(inflater, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(binding.getRoot().getContext());
|
||||||
|
if (preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) binding.getRoot());
|
||||||
|
}
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import androidx.preference.PreferenceManager;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
import com.jakewharton.rxbinding4.view.RxView;
|
import com.jakewharton.rxbinding4.view.RxView;
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.database.subscription.NotificationMode;
|
import org.schabi.newpipe.database.subscription.NotificationMode;
|
||||||
|
@ -192,8 +193,18 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
binding = FragmentChannelBinding.inflate(inflater, container, false);
|
binding = FragmentChannelBinding.inflate(inflater, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(binding.getRoot().getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) binding.getRoot());
|
||||||
|
}
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override // called from onViewCreated in BaseFragment.onViewCreated
|
@Override // called from onViewCreated in BaseFragment.onViewCreated
|
||||||
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.schabi.newpipe.fragments.list.channel;
|
package org.schabi.newpipe.fragments.list.channel;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -8,6 +10,9 @@ import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.databinding.PlaylistControlBinding;
|
import org.schabi.newpipe.databinding.PlaylistControlBinding;
|
||||||
|
@ -75,8 +80,19 @@ public class ChannelTabFragment extends BaseListInfoFragment<InfoItem, ChannelTa
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_channel_tab, container, false);
|
final View view = inflater.inflate(R.layout.fragment_channel_tab, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.schabi.newpipe.fragments.list.comments;
|
||||||
|
|
||||||
import static org.schabi.newpipe.util.ServiceHelper.getServiceById;
|
import static org.schabi.newpipe.util.ServiceHelper.getServiceById;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -11,6 +13,9 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.databinding.CommentRepliesHeaderBinding;
|
import org.schabi.newpipe.databinding.CommentRepliesHeaderBinding;
|
||||||
|
@ -65,8 +70,19 @@ public final class CommentRepliesFragment
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_comments, container, false);
|
final View view = inflater.inflate(R.layout.fragment_comments, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.schabi.newpipe.fragments.list.comments;
|
package org.schabi.newpipe.fragments.list.comments;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -10,6 +12,9 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.error.UserAction;
|
import org.schabi.newpipe.error.UserAction;
|
||||||
|
@ -55,7 +60,17 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfoItem, Com
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_comments, container, false);
|
final View view = inflater.inflate(R.layout.fragment_comments, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,6 +14,8 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.error.ErrorInfo;
|
import org.schabi.newpipe.error.ErrorInfo;
|
||||||
import org.schabi.newpipe.error.UserAction;
|
import org.schabi.newpipe.error.UserAction;
|
||||||
|
@ -106,7 +108,7 @@ public class KioskFragment extends BaseListInfoFragment<StreamInfoItem, KioskInf
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
@ -127,7 +129,12 @@ public class KioskFragment extends BaseListInfoFragment<StreamInfoItem, KioskInf
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_kiosk, container, false);
|
final View view = inflater.inflate(R.layout.fragment_kiosk, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
public PlaylistFragment() {
|
public PlaylistFragment() {
|
||||||
super(UserAction.REQUESTED_PLAYLIST);
|
super(UserAction.REQUESTED_PLAYLIST);
|
||||||
|
@ -129,7 +129,7 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
final View view = inflater.inflate(R.layout.fragment_playlist, container, false);
|
final View view = inflater.inflate(R.layout.fragment_playlist, container, false);
|
||||||
final String preferredFont = getPreferredFont(view.getContext());
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts((ViewGroup) view);
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
|
@ -147,7 +147,6 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||||
|
|
||||||
return headerBinding::getRoot;
|
return headerBinding::getRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
||||||
super.initViews(rootView, savedInstanceState);
|
super.initViews(rootView, savedInstanceState);
|
||||||
|
@ -160,7 +159,6 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||||
private PlayQueue getPlayQueueStartingAt(final StreamInfoItem infoItem) {
|
private PlayQueue getPlayQueueStartingAt(final StreamInfoItem infoItem) {
|
||||||
return getPlayQueue(Math.max(infoListAdapter.getItemsList().indexOf(infoItem), 0));
|
return getPlayQueue(Math.max(infoListAdapter.getItemsList().indexOf(infoItem), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showInfoItemDialog(final StreamInfoItem item) {
|
protected void showInfoItemDialog(final StreamInfoItem item) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
|
@ -198,7 +196,6 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
headerBinding = null;
|
headerBinding = null;
|
||||||
playlistControlBinding = null;
|
playlistControlBinding = null;
|
||||||
|
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
if (isBookmarkButtonReady != null) {
|
if (isBookmarkButtonReady != null) {
|
||||||
isBookmarkButtonReady.set(false);
|
isBookmarkButtonReady.set(false);
|
||||||
|
|
|
@ -40,6 +40,9 @@ import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.databinding.FragmentSearchBinding;
|
import org.schabi.newpipe.databinding.FragmentSearchBinding;
|
||||||
import org.schabi.newpipe.error.ErrorInfo;
|
import org.schabi.newpipe.error.ErrorInfo;
|
||||||
|
@ -209,9 +212,22 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_search, container, false);
|
final ViewGroup view = (ViewGroup) inflater
|
||||||
|
.inflate(R.layout.fragment_search, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts(view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
package org.schabi.newpipe.fragments.list.search;
|
package org.schabi.newpipe.fragments.list.search;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.DiffUtil;
|
import androidx.recyclerview.widget.DiffUtil;
|
||||||
import androidx.recyclerview.widget.ListAdapter;
|
import androidx.recyclerview.widget.ListAdapter;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.databinding.ItemSearchSuggestionBinding;
|
import org.schabi.newpipe.databinding.ItemSearchSuggestionBinding;
|
||||||
|
|
||||||
|
@ -27,8 +32,19 @@ public class SuggestionListAdapter
|
||||||
@Override
|
@Override
|
||||||
public SuggestionItemHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
public SuggestionItemHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
||||||
final int viewType) {
|
final int viewType) {
|
||||||
return new SuggestionItemHolder(ItemSearchSuggestionBinding
|
final SuggestionItemHolder item = new SuggestionItemHolder(ItemSearchSuggestionBinding
|
||||||
.inflate(LayoutInflater.from(parent.getContext()), parent, false));
|
.inflate(LayoutInflater.from(parent.getContext()), parent, false));
|
||||||
|
final String preferredFont = getPreferredFont(item.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) item.itemView);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", "system");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.schabi.newpipe.fragments.list.videos;
|
package org.schabi.newpipe.fragments.list.videos;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -12,6 +13,8 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.databinding.RelatedItemsHeaderBinding;
|
import org.schabi.newpipe.databinding.RelatedItemsHeaderBinding;
|
||||||
import org.schabi.newpipe.error.UserAction;
|
import org.schabi.newpipe.error.UserAction;
|
||||||
|
@ -57,9 +60,20 @@ public class RelatedItemsFragment extends BaseListInfoFragment<InfoItem, Related
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_related_items, container, false);
|
final View view = inflater
|
||||||
|
.inflate(R.layout.fragment_related_items, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
headerBinding = null;
|
headerBinding = null;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.schabi.newpipe.info_list;
|
package org.schabi.newpipe.info_list;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -11,6 +13,8 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.databinding.PignateFooterBinding;
|
import org.schabi.newpipe.databinding.PignateFooterBinding;
|
||||||
import org.schabi.newpipe.extractor.InfoItem;
|
import org.schabi.newpipe.extractor.InfoItem;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||||
|
@ -274,11 +278,19 @@ public class InfoListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", "system");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
||||||
final int type) {
|
final int type) {
|
||||||
|
final RecyclerView.ViewHolder holder;
|
||||||
|
final String preferredFont;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "onCreateViewHolder() called with: "
|
Log.d(TAG, "onCreateViewHolder() called with: "
|
||||||
+ "parent = [" + parent + "], type = [" + type + "]");
|
+ "parent = [" + parent + "], type = [" + type + "]");
|
||||||
|
@ -288,40 +300,120 @@ public class InfoListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||||
// Always create a new instance otherwise the same instance
|
// Always create a new instance otherwise the same instance
|
||||||
// is sometimes reused which causes a crash
|
// is sometimes reused which causes a crash
|
||||||
case HEADER_TYPE:
|
case HEADER_TYPE:
|
||||||
return new HFHolder(headerSupplier.get());
|
holder = new HFHolder(headerSupplier.get());
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case FOOTER_TYPE:
|
case FOOTER_TYPE:
|
||||||
return new HFHolder(PignateFooterBinding
|
holder = new HFHolder(PignateFooterBinding
|
||||||
.inflate(layoutInflater, parent, false)
|
.inflate(layoutInflater, parent, false)
|
||||||
.getRoot()
|
.getRoot()
|
||||||
);
|
);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case MINI_STREAM_HOLDER_TYPE:
|
case MINI_STREAM_HOLDER_TYPE:
|
||||||
return new StreamMiniInfoItemHolder(infoItemBuilder, parent);
|
holder = new StreamMiniInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case STREAM_HOLDER_TYPE:
|
case STREAM_HOLDER_TYPE:
|
||||||
return new StreamInfoItemHolder(infoItemBuilder, parent);
|
holder = new StreamInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case GRID_STREAM_HOLDER_TYPE:
|
case GRID_STREAM_HOLDER_TYPE:
|
||||||
return new StreamGridInfoItemHolder(infoItemBuilder, parent);
|
holder = new StreamGridInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case CARD_STREAM_HOLDER_TYPE:
|
case CARD_STREAM_HOLDER_TYPE:
|
||||||
return new StreamCardInfoItemHolder(infoItemBuilder, parent);
|
holder = new StreamCardInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case MINI_CHANNEL_HOLDER_TYPE:
|
case MINI_CHANNEL_HOLDER_TYPE:
|
||||||
return new ChannelMiniInfoItemHolder(infoItemBuilder, parent);
|
holder = new ChannelMiniInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case CHANNEL_HOLDER_TYPE:
|
case CHANNEL_HOLDER_TYPE:
|
||||||
return new ChannelInfoItemHolder(infoItemBuilder, parent);
|
holder = new ChannelInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case CARD_CHANNEL_HOLDER_TYPE:
|
case CARD_CHANNEL_HOLDER_TYPE:
|
||||||
return new ChannelCardInfoItemHolder(infoItemBuilder, parent);
|
holder = new ChannelCardInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case GRID_CHANNEL_HOLDER_TYPE:
|
case GRID_CHANNEL_HOLDER_TYPE:
|
||||||
return new ChannelGridInfoItemHolder(infoItemBuilder, parent);
|
holder = new ChannelGridInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case MINI_PLAYLIST_HOLDER_TYPE:
|
case MINI_PLAYLIST_HOLDER_TYPE:
|
||||||
return new PlaylistMiniInfoItemHolder(infoItemBuilder, parent);
|
holder = new PlaylistMiniInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case PLAYLIST_HOLDER_TYPE:
|
case PLAYLIST_HOLDER_TYPE:
|
||||||
return new PlaylistInfoItemHolder(infoItemBuilder, parent);
|
holder = new PlaylistInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case GRID_PLAYLIST_HOLDER_TYPE:
|
case GRID_PLAYLIST_HOLDER_TYPE:
|
||||||
return new PlaylistGridInfoItemHolder(infoItemBuilder, parent);
|
holder = new PlaylistGridInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case CARD_PLAYLIST_HOLDER_TYPE:
|
case CARD_PLAYLIST_HOLDER_TYPE:
|
||||||
return new PlaylistCardInfoItemHolder(infoItemBuilder, parent);
|
holder = new PlaylistCardInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
case COMMENT_HOLDER_TYPE:
|
case COMMENT_HOLDER_TYPE:
|
||||||
return new CommentInfoItemHolder(infoItemBuilder, parent);
|
holder = new CommentInfoItemHolder(infoItemBuilder, parent);
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
default:
|
default:
|
||||||
return new FallbackViewHolder(new View(parent.getContext()));
|
holder = new FallbackViewHolder(new View(parent.getContext()));
|
||||||
|
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
package org.schabi.newpipe.local;
|
package org.schabi.newpipe.local;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.database.LocalItem;
|
import org.schabi.newpipe.database.LocalItem;
|
||||||
import org.schabi.newpipe.database.stream.model.StreamStateEntity;
|
import org.schabi.newpipe.database.stream.model.StreamStateEntity;
|
||||||
import org.schabi.newpipe.info_list.ItemViewMode;
|
import org.schabi.newpipe.info_list.ItemViewMode;
|
||||||
|
@ -27,7 +31,6 @@ import org.schabi.newpipe.local.holder.LocalStatisticStreamGridItemHolder;
|
||||||
import org.schabi.newpipe.local.holder.LocalStatisticStreamItemHolder;
|
import org.schabi.newpipe.local.holder.LocalStatisticStreamItemHolder;
|
||||||
import org.schabi.newpipe.local.holder.RemoteBookmarkPlaylistItemHolder;
|
import org.schabi.newpipe.local.holder.RemoteBookmarkPlaylistItemHolder;
|
||||||
import org.schabi.newpipe.local.holder.RemotePlaylistCardItemHolder;
|
import org.schabi.newpipe.local.holder.RemotePlaylistCardItemHolder;
|
||||||
import org.schabi.newpipe.local.holder.RemotePlaylistGridItemHolder;
|
|
||||||
import org.schabi.newpipe.local.holder.RemotePlaylistItemHolder;
|
import org.schabi.newpipe.local.holder.RemotePlaylistItemHolder;
|
||||||
import org.schabi.newpipe.util.FallbackViewHolder;
|
import org.schabi.newpipe.util.FallbackViewHolder;
|
||||||
import org.schabi.newpipe.util.Localization;
|
import org.schabi.newpipe.util.Localization;
|
||||||
|
@ -312,48 +315,95 @@ public class LocalItemListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
||||||
final int type) {
|
final int type) {
|
||||||
|
final RecyclerView.ViewHolder holder;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "onCreateViewHolder() called with: "
|
Log.d(TAG, "onCreateViewHolder() called with: "
|
||||||
+ "parent = [" + parent + "], type = [" + type + "]");
|
+ "parent = [" + parent + "], type = [" + type + "]");
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case HEADER_TYPE:
|
case HEADER_TYPE:
|
||||||
|
holder = new HeaderFooterHolder(header);
|
||||||
|
setUpFont(holder);
|
||||||
return new HeaderFooterHolder(header);
|
return new HeaderFooterHolder(header);
|
||||||
case FOOTER_TYPE:
|
case FOOTER_TYPE:
|
||||||
return new HeaderFooterHolder(footer);
|
holder = new HeaderFooterHolder(footer);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case LOCAL_PLAYLIST_HOLDER_TYPE:
|
case LOCAL_PLAYLIST_HOLDER_TYPE:
|
||||||
return new LocalPlaylistItemHolder(localItemBuilder, parent);
|
holder = new LocalPlaylistItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case LOCAL_PLAYLIST_GRID_HOLDER_TYPE:
|
case LOCAL_PLAYLIST_GRID_HOLDER_TYPE:
|
||||||
return new LocalPlaylistGridItemHolder(localItemBuilder, parent);
|
holder = new LocalPlaylistGridItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case LOCAL_PLAYLIST_CARD_HOLDER_TYPE:
|
case LOCAL_PLAYLIST_CARD_HOLDER_TYPE:
|
||||||
return new LocalPlaylistCardItemHolder(localItemBuilder, parent);
|
holder = new LocalPlaylistCardItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case LOCAL_BOOKMARK_PLAYLIST_HOLDER_TYPE:
|
case LOCAL_BOOKMARK_PLAYLIST_HOLDER_TYPE:
|
||||||
return new LocalBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
holder = new LocalBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case REMOTE_PLAYLIST_HOLDER_TYPE:
|
case REMOTE_PLAYLIST_HOLDER_TYPE:
|
||||||
return new RemotePlaylistItemHolder(localItemBuilder, parent);
|
holder = new RemotePlaylistItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case REMOTE_PLAYLIST_GRID_HOLDER_TYPE:
|
case REMOTE_PLAYLIST_GRID_HOLDER_TYPE:
|
||||||
return new RemotePlaylistGridItemHolder(localItemBuilder, parent);
|
holder = new RemotePlaylistCardItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case REMOTE_PLAYLIST_CARD_HOLDER_TYPE:
|
case REMOTE_PLAYLIST_CARD_HOLDER_TYPE:
|
||||||
return new RemotePlaylistCardItemHolder(localItemBuilder, parent);
|
holder = new HeaderFooterHolder(footer);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case REMOTE_BOOKMARK_PLAYLIST_HOLDER_TYPE:
|
case REMOTE_BOOKMARK_PLAYLIST_HOLDER_TYPE:
|
||||||
return new RemoteBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
holder = new RemoteBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case STREAM_PLAYLIST_HOLDER_TYPE:
|
case STREAM_PLAYLIST_HOLDER_TYPE:
|
||||||
return new LocalPlaylistStreamItemHolder(localItemBuilder, parent);
|
holder = new LocalPlaylistStreamItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case STREAM_PLAYLIST_GRID_HOLDER_TYPE:
|
case STREAM_PLAYLIST_GRID_HOLDER_TYPE:
|
||||||
return new LocalPlaylistStreamGridItemHolder(localItemBuilder, parent);
|
holder = new LocalPlaylistStreamGridItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case STREAM_PLAYLIST_CARD_HOLDER_TYPE:
|
case STREAM_PLAYLIST_CARD_HOLDER_TYPE:
|
||||||
return new LocalPlaylistStreamCardItemHolder(localItemBuilder, parent);
|
holder = new LocalPlaylistStreamCardItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case STREAM_STATISTICS_HOLDER_TYPE:
|
case STREAM_STATISTICS_HOLDER_TYPE:
|
||||||
return new LocalStatisticStreamItemHolder(localItemBuilder, parent);
|
holder = new LocalStatisticStreamItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case STREAM_STATISTICS_GRID_HOLDER_TYPE:
|
case STREAM_STATISTICS_GRID_HOLDER_TYPE:
|
||||||
return new LocalStatisticStreamGridItemHolder(localItemBuilder, parent);
|
holder = new LocalStatisticStreamGridItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
case STREAM_STATISTICS_CARD_HOLDER_TYPE:
|
case STREAM_STATISTICS_CARD_HOLDER_TYPE:
|
||||||
return new LocalStatisticStreamCardItemHolder(localItemBuilder, parent);
|
holder = new LocalStatisticStreamCardItemHolder(localItemBuilder, parent);
|
||||||
|
setUpFont(holder);
|
||||||
|
return holder;
|
||||||
default:
|
default:
|
||||||
|
holder = new FallbackViewHolder(new View(parent.getContext()));
|
||||||
|
setUpFont(holder);
|
||||||
Log.e(TAG, "No view type has been considered for holder: [" + type + "]");
|
Log.e(TAG, "No view type has been considered for holder: [" + type + "]");
|
||||||
return new FallbackViewHolder(new View(parent.getContext()));
|
return holder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void setUpFont(final RecyclerView.ViewHolder holder) {
|
||||||
|
final View view = holder.itemView;
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", "system");
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("FinalParameters")
|
@SuppressWarnings("FinalParameters")
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,9 @@ package org.schabi.newpipe.local.bookmark;
|
||||||
|
|
||||||
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
|
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
|
@ -16,9 +18,12 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.reactivestreams.Subscriber;
|
import org.reactivestreams.Subscriber;
|
||||||
import org.reactivestreams.Subscription;
|
import org.reactivestreams.Subscription;
|
||||||
import org.schabi.newpipe.NewPipeDatabase;
|
import org.schabi.newpipe.NewPipeDatabase;
|
||||||
|
@ -97,13 +102,21 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
|
final View view = inflater.inflate(R.layout.fragment_bookmarks, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!useAsFrontPage) {
|
|
||||||
setTitle(activity.getString(R.string.tab_bookmarks));
|
|
||||||
}
|
|
||||||
return inflater.inflate(R.layout.fragment_bookmarks, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.schabi.newpipe.local.dialog;
|
package org.schabi.newpipe.local.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -9,9 +11,12 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.NewPipeDatabase;
|
import org.schabi.newpipe.NewPipeDatabase;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.database.playlist.model.PlaylistEntity;
|
import org.schabi.newpipe.database.playlist.model.PlaylistEntity;
|
||||||
|
@ -51,10 +56,22 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
final Bundle savedInstanceState) {
|
@Nullable final ViewGroup container,
|
||||||
return inflater.inflate(R.layout.dialog_playlists, container);
|
@Nullable final Bundle savedInstanceState) {
|
||||||
|
final View view = inflater.inflate(R.layout.dialog_playlists, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.marcinorlowski.fonty.Fonty
|
||||||
import com.xwray.groupie.GroupieAdapter
|
import com.xwray.groupie.GroupieAdapter
|
||||||
import com.xwray.groupie.Item
|
import com.xwray.groupie.Item
|
||||||
import com.xwray.groupie.OnItemClickListener
|
import com.xwray.groupie.OnItemClickListener
|
||||||
|
@ -124,13 +125,16 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
||||||
PreferenceManager.getDefaultSharedPreferences(activity)
|
PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
.registerOnSharedPreferenceChangeListener(onSettingsChangeListener)
|
.registerOnSharedPreferenceChangeListener(onSettingsChangeListener)
|
||||||
}
|
}
|
||||||
// fun getPreferredFont(context: Context?): String? {
|
|
||||||
// val preferences = PreferenceManager
|
|
||||||
// .getDefaultSharedPreferences(context!!)
|
|
||||||
// return preferences.getString("preferred_font", "default_font_name")
|
|
||||||
// }
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
return inflater.inflate(R.layout.fragment_feed, container, false)
|
val curView = inflater.inflate(R.layout.fragment_feed, container, false) as ViewGroup
|
||||||
|
|
||||||
|
// Apply the preferred font globally
|
||||||
|
val preferredFont = getPreferredFont(curView.context)
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts(curView)
|
||||||
|
}
|
||||||
|
return curView
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(rootView: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(rootView: View, savedInstanceState: Bundle?) {
|
||||||
|
@ -183,6 +187,11 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fun getPreferredFont(context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context!!)
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)))
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupListViewMode() {
|
private fun setupListViewMode() {
|
||||||
// does everything needed to setup the layouts for grid or list modes
|
// does everything needed to setup the layouts for grid or list modes
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.schabi.newpipe.local.history;
|
package org.schabi.newpipe.local.history;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -13,9 +14,11 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.viewbinding.ViewBinding;
|
import androidx.viewbinding.ViewBinding;
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.reactivestreams.Subscriber;
|
import org.reactivestreams.Subscriber;
|
||||||
import org.reactivestreams.Subscription;
|
import org.reactivestreams.Subscription;
|
||||||
|
@ -95,8 +98,19 @@ public class StatisticsPlaylistFragment
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_playlist, container, false);
|
final View view = inflater.inflate(R.layout.fragment_playlist, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
package org.schabi.newpipe.local.holder;
|
package org.schabi.newpipe.local.holder;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.database.LocalItem;
|
import org.schabi.newpipe.database.LocalItem;
|
||||||
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
|
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
|
||||||
|
@ -24,7 +30,18 @@ public class LocalBookmarkPlaylistItemHolder extends LocalPlaylistItemHolder {
|
||||||
final ViewGroup parent) {
|
final ViewGroup parent) {
|
||||||
super(infoItemBuilder, layoutId, parent);
|
super(infoItemBuilder, layoutId, parent);
|
||||||
itemHandleView = itemView.findViewById(R.id.itemHandle);
|
itemHandleView = itemView.findViewById(R.id.itemHandle);
|
||||||
|
|
||||||
|
final String preferredFont = getPreferredFont(itemHandleView.getContext());
|
||||||
|
if (!preferredFont.equals("system")) {
|
||||||
|
Fonty.setFonts((ViewGroup) itemHandleView);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", "system");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFromItem(final LocalItem localItem,
|
public void updateFromItem(final LocalItem localItem,
|
||||||
|
|
|
@ -28,6 +28,8 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.viewbinding.ViewBinding;
|
import androidx.viewbinding.ViewBinding;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.reactivestreams.Subscriber;
|
import org.reactivestreams.Subscriber;
|
||||||
import org.reactivestreams.Subscription;
|
import org.reactivestreams.Subscription;
|
||||||
import org.schabi.newpipe.NewPipeDatabase;
|
import org.schabi.newpipe.NewPipeDatabase;
|
||||||
|
@ -130,13 +132,18 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
@Nullable final Bundle savedInstanceState) {
|
@Nullable final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_playlist, container, false);
|
final View view = inflater.inflate(R.layout.fragment_playlist, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -19,7 +19,9 @@ import androidx.activity.result.contract.ActivityResultContracts.StartActivityFo
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.marcinorlowski.fonty.Fonty
|
||||||
import com.xwray.groupie.Group
|
import com.xwray.groupie.Group
|
||||||
import com.xwray.groupie.GroupAdapter
|
import com.xwray.groupie.GroupAdapter
|
||||||
import com.xwray.groupie.Section
|
import com.xwray.groupie.Section
|
||||||
|
@ -106,7 +108,18 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
return inflater.inflate(R.layout.fragment_subscription, container, false)
|
val curView = inflater.inflate(R.layout.fragment_subscription, container, false) as ViewGroup
|
||||||
|
val preferredFont = getPreferredFont(curView.context)
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts(curView)
|
||||||
|
}
|
||||||
|
|
||||||
|
return curView
|
||||||
|
}
|
||||||
|
fun getPreferredFont(context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context!!)
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
|
|
@ -7,7 +7,9 @@ import static org.schabi.newpipe.local.subscription.services.SubscriptionsImport
|
||||||
import static org.schabi.newpipe.local.subscription.services.SubscriptionsImportService.KEY_VALUE;
|
import static org.schabi.newpipe.local.subscription.services.SubscriptionsImportService.KEY_VALUE;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
|
@ -26,6 +28,9 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.core.text.util.LinkifyCompat;
|
import androidx.core.text.util.LinkifyCompat;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.BaseFragment;
|
import org.schabi.newpipe.BaseFragment;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -107,8 +112,19 @@ public class SubscriptionsImportFragment extends BaseFragment {
|
||||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||||
@Nullable final ViewGroup container,
|
@Nullable final ViewGroup container,
|
||||||
final Bundle savedInstanceState) {
|
final Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.fragment_import, container, false);
|
final View view = inflater.inflate(R.layout.fragment_import, container, false);
|
||||||
|
final String preferredFont = getPreferredFont(view.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) view);
|
||||||
}
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*/////////////////////////////////////////////////////////////////////////
|
/*/////////////////////////////////////////////////////////////////////////
|
||||||
// Fragment Views
|
// Fragment Views
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.schabi.newpipe.local.subscription.dialog
|
package org.schabi.newpipe.local.subscription.dialog
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -16,8 +17,10 @@ import androidx.core.widget.doOnTextChanged
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.marcinorlowski.fonty.Fonty
|
||||||
import com.xwray.groupie.GroupieAdapter
|
import com.xwray.groupie.GroupieAdapter
|
||||||
import com.xwray.groupie.OnItemClickListener
|
import com.xwray.groupie.OnItemClickListener
|
||||||
import com.xwray.groupie.Section
|
import com.xwray.groupie.Section
|
||||||
|
@ -89,7 +92,17 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
return inflater.inflate(R.layout.dialog_feed_group_create, container)
|
val curView = inflater.inflate(R.layout.dialog_feed_group_create, container) as ViewGroup
|
||||||
|
val preferredFont = getPreferredFont(curView.context)
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts(curView)
|
||||||
|
}
|
||||||
|
return curView
|
||||||
|
}
|
||||||
|
fun getPreferredFont(context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context!!)
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.schabi.newpipe.local.subscription.dialog
|
package org.schabi.newpipe.local.subscription.dialog
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -7,10 +8,12 @@ import android.view.ViewGroup
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper
|
import androidx.recyclerview.widget.ItemTouchHelper
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper.SimpleCallback
|
import androidx.recyclerview.widget.ItemTouchHelper.SimpleCallback
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.marcinorlowski.fonty.Fonty
|
||||||
import com.xwray.groupie.GroupieAdapter
|
import com.xwray.groupie.GroupieAdapter
|
||||||
import com.xwray.groupie.TouchCallback
|
import com.xwray.groupie.TouchCallback
|
||||||
import icepick.Icepick
|
import icepick.Icepick
|
||||||
|
@ -48,7 +51,18 @@ class FeedGroupReorderDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
return inflater.inflate(R.layout.dialog_feed_group_reorder, container)
|
val curView = (inflater.inflate(R.layout.dialog_feed_group_reorder, container)) as ViewGroup
|
||||||
|
val preferredFont = getPreferredFont(curView.context)
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts(curView)
|
||||||
|
}
|
||||||
|
|
||||||
|
return curView
|
||||||
|
}
|
||||||
|
fun getPreferredFont(context: Context?): String? {
|
||||||
|
val preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context!!)
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ public final class PlayQueueActivity extends AppCompatActivity
|
||||||
|
|
||||||
serviceConnection = getServiceConnection();
|
serviceConnection = getServiceConnection();
|
||||||
bind();
|
bind();
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ public final class PlayQueueActivity extends AppCompatActivity
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||||
.getPreferredContentCountry(requireContext());
|
.getPreferredContentCountry(requireContext());
|
||||||
initialLanguage = defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
initialLanguage = defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
||||||
initialSelectedFont = defaultPreferences
|
initialSelectedFont = defaultPreferences
|
||||||
.getString(getString(R.string.app_font_key), "Default");
|
.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);
|
||||||
imageQualityPreference.setOnPreferenceChangeListener(
|
imageQualityPreference.setOnPreferenceChangeListener(
|
||||||
(preference, newValue) -> {
|
(preference, newValue) -> {
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(final Preference preference) {
|
public boolean onPreferenceTreeClick(final Preference preference) {
|
||||||
|
|
|
@ -64,7 +64,8 @@ public class MainSettingsFragment extends BasePreferenceFragment {
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
// if no prefered font, return system default
|
||||||
|
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.schabi.newpipe.settings;
|
||||||
|
|
||||||
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
|
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -12,9 +14,12 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.marcinorlowski.fonty.Fonty;
|
||||||
|
|
||||||
import org.schabi.newpipe.NewPipeDatabase;
|
import org.schabi.newpipe.NewPipeDatabase;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.database.AppDatabase;
|
import org.schabi.newpipe.database.AppDatabase;
|
||||||
|
@ -146,8 +151,18 @@ public class SelectPlaylistFragment extends DialogFragment {
|
||||||
final int viewType) {
|
final int viewType) {
|
||||||
final View item = LayoutInflater.from(parent.getContext())
|
final View item = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.list_playlist_mini_item, parent, false);
|
.inflate(R.layout.list_playlist_mini_item, parent, false);
|
||||||
|
final String preferredFont = getPreferredFont(item.getContext());
|
||||||
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
|
Fonty.setFonts((ViewGroup) item);
|
||||||
|
}
|
||||||
return new SelectPlaylistItemHolder(item);
|
return new SelectPlaylistItemHolder(item);
|
||||||
}
|
}
|
||||||
|
public String getPreferredFont(final Context context) {
|
||||||
|
final SharedPreferences preferences = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(context);
|
||||||
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull final SelectPlaylistItemHolder holder,
|
public void onBindViewHolder(@NonNull final SelectPlaylistItemHolder holder,
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||||
FocusOverlayView.setupFocusObserver(this);
|
FocusOverlayView.setupFocusObserver(this);
|
||||||
}
|
}
|
||||||
final String preferredFont = getPreferredFont(this);
|
final String preferredFont = getPreferredFont(this);
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class FilePickerActivityHelper extends com.nononsenseapps.filepicker.File
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class FilePickerActivityHelper extends com.nononsenseapps.filepicker.File
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,14 @@ public abstract class ToolbarActivity extends AppCompatActivity {
|
||||||
|
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
|
|
||||||
if (preferredFont != "default_font_name") {
|
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||||
Fonty.setFonts(this);
|
Fonty.setFonts(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public String getPreferredFont(final Context context) {
|
public String getPreferredFont(final Context context) {
|
||||||
final SharedPreferences preferences = PreferenceManager
|
final SharedPreferences preferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
return preferences.getString("preferred_font", "default_font_name");
|
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -504,6 +504,10 @@
|
||||||
|
|
||||||
<!-- Localizations -->
|
<!-- Localizations -->
|
||||||
<string name="default_localization_key">system</string>
|
<string name="default_localization_key">system</string>
|
||||||
|
<!-- Font-->
|
||||||
|
<string name="default_font_key">system</string>
|
||||||
|
<string name="preferred_font_key">preferred_font</string>
|
||||||
|
|
||||||
<!-- alternatively, load these from some local android data store -->
|
<!-- alternatively, load these from some local android data store -->
|
||||||
<string-array name="language_codes">
|
<string-array name="language_codes">
|
||||||
<item>@string/default_localization_key</item>
|
<item>@string/default_localization_key</item>
|
||||||
|
|
Loading…
Add table
Reference in a new issue