mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-03-01 05:48:22 +03:00
Merge 'up-10/change-font-feature' into branch
This commit is contained in:
commit
7c550ed177
56 changed files with 842 additions and 78 deletions
|
@ -118,6 +118,10 @@ android {
|
|||
// Disables dependency metadata when building Android App Bundles.
|
||||
includeInBundle = false
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
aidl true // REVIEW up-10
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
|
@ -255,6 +259,10 @@ dependencies {
|
|||
implementation "com.evernote:android-state:$stateSaverVersion"
|
||||
kapt "com.evernote:android-state-processor:$stateSaverVersion"
|
||||
|
||||
// changing fonts
|
||||
implementation 'com.github.MarcinOrlowski:fonty:3.1.5'
|
||||
|
||||
|
||||
// HTML parser
|
||||
implementation "org.jsoup:jsoup:1.17.2"
|
||||
|
||||
|
|
BIN
app/src/main/assets/fonts/Algerian.TTF
Normal file
BIN
app/src/main/assets/fonts/Algerian.TTF
Normal file
Binary file not shown.
BIN
app/src/main/assets/fonts/BELL.TTF
Normal file
BIN
app/src/main/assets/fonts/BELL.TTF
Normal file
Binary file not shown.
BIN
app/src/main/assets/fonts/BROADW.TTF
Normal file
BIN
app/src/main/assets/fonts/BROADW.TTF
Normal file
Binary file not shown.
BIN
app/src/main/assets/fonts/arial.ttf
Normal file
BIN
app/src/main/assets/fonts/arial.ttf
Normal file
Binary file not shown.
BIN
app/src/main/assets/fonts/calibrii.ttf
Normal file
BIN
app/src/main/assets/fonts/calibrii.ttf
Normal file
Binary file not shown.
BIN
app/src/main/assets/fonts/times.ttf
Normal file
BIN
app/src/main/assets/fonts/times.ttf
Normal file
Binary file not shown.
|
@ -120,6 +120,7 @@ public class App extends Application {
|
|||
configureRxJavaErrorHandler();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
|
|
|
@ -57,6 +57,7 @@ import androidx.fragment.app.FragmentManager;
|
|||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.databinding.ActivityMainBinding;
|
||||
import org.schabi.newpipe.databinding.DrawerHeaderBinding;
|
||||
|
@ -130,6 +131,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
// Apply the preferred font globally
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
setUpFont(preferredFont);
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onCreate() called with: "
|
||||
+ "savedInstanceState = [" + savedInstanceState + "]");
|
||||
|
@ -174,6 +178,10 @@ public class MainActivity extends AppCompatActivity {
|
|||
&& ReleaseVersionUtil.INSTANCE.isReleaseApk()) {
|
||||
UpdateSettingsFragment.askForConsentToUpdateChecks(this);
|
||||
}
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,6 +198,50 @@ public class MainActivity extends AppCompatActivity {
|
|||
NewVersionWorker.enqueueNewVersionCheckingWork(app, false);
|
||||
}
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
public void setUpFont(final String preferredFont) {
|
||||
switch (preferredFont) {
|
||||
case "Arial":
|
||||
Fonty.context(this)
|
||||
.normalTypeface("arial.ttf")
|
||||
.build();
|
||||
break;
|
||||
case "Broadway":
|
||||
Fonty.context(this)
|
||||
.normalTypeface("BROADW.TTF")
|
||||
.build();
|
||||
break;
|
||||
case "Algerian":
|
||||
Fonty.context(this)
|
||||
.normalTypeface("Algerian.TTF")
|
||||
.build();
|
||||
break;
|
||||
case "Bell MT":
|
||||
Fonty.context(this)
|
||||
.normalTypeface("BELL.TTF")
|
||||
.build();
|
||||
break;
|
||||
case "Calibri":
|
||||
Fonty.context(this)
|
||||
.normalTypeface("calibrii.ttf")
|
||||
.build();
|
||||
break;
|
||||
case "Time New Roman":
|
||||
Fonty.context(this)
|
||||
.normalTypeface("times.ttf")
|
||||
.build();
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setupDrawer() throws ExtractionException {
|
||||
addDrawerMenuForCurrentService();
|
||||
|
|
|
@ -43,6 +43,7 @@ import androidx.preference.PreferenceManager;
|
|||
|
||||
import com.evernote.android.state.State;
|
||||
import com.livefront.bridge.Bridge;
|
||||
import com.marcinorlowski.fonty.Fonty; // REVIEW up-10
|
||||
|
||||
import org.schabi.newpipe.database.stream.model.StreamEntity;
|
||||
import org.schabi.newpipe.databinding.ListRadioIconItemBinding;
|
||||
|
@ -129,6 +130,7 @@ public class RouterActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
ThemeHelper.setDayNightMode(this);
|
||||
setTheme(ThemeHelper.isLightThemeSelected(this)
|
||||
? R.style.RouterActivityThemeLight : R.style.RouterActivityThemeDark);
|
||||
|
@ -184,7 +186,17 @@ public class RouterActivity extends AppCompatActivity {
|
|||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.schabi.newpipe.about
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MenuItem
|
||||
|
@ -10,8 +11,10 @@ import androidx.annotation.StringRes
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.marcinorlowski.fonty.Fonty
|
||||
import org.schabi.newpipe.BuildConfig
|
||||
import org.schabi.newpipe.R
|
||||
import org.schabi.newpipe.databinding.ActivityAboutBinding
|
||||
|
@ -44,6 +47,15 @@ class AboutActivity : AppCompatActivity() {
|
|||
) { tab, position ->
|
||||
tab.setText(mAboutStateAdapter.getPageTitle(position))
|
||||
}.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 {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.schabi.newpipe.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -10,6 +12,7 @@ import android.view.ViewTreeObserver;
|
|||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.databinding.ActivityDownloaderBinding;
|
||||
|
@ -22,6 +25,8 @@ import us.shandian.giga.ui.fragment.MissionsFragment;
|
|||
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
public class DownloadActivity extends AppCompatActivity {
|
||||
|
||||
private static final String MISSIONS_FRAGMENT_TAG = "fragment_tag";
|
||||
|
@ -63,6 +68,10 @@ public class DownloadActivity extends AppCompatActivity {
|
|||
if (DeviceUtils.isTv(this)) {
|
||||
FocusOverlayView.setupFocusObserver(this);
|
||||
}
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateFragments() {
|
||||
|
@ -73,6 +82,12 @@ public class DownloadActivity extends AppCompatActivity {
|
|||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
|
||||
.commit();
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
|
|
|
@ -41,6 +41,7 @@ import androidx.preference.PreferenceManager;
|
|||
|
||||
import com.evernote.android.state.State;
|
||||
import com.livefront.bridge.Bridge;
|
||||
import com.marcinorlowski.fonty.Fonty; // REVIEW up-10
|
||||
import com.nononsenseapps.filepicker.Utils;
|
||||
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
|
@ -117,7 +118,6 @@ public class DownloadDialog extends DialogFragment
|
|||
private ActionMenuItemView okButton = null;
|
||||
private Context context = null;
|
||||
private boolean askForSavePath;
|
||||
|
||||
private AudioTrackAdapter audioTrackAdapter;
|
||||
private StreamItemAdapter<AudioStream, Stream> audioStreamsAdapter;
|
||||
private StreamItemAdapter<VideoStream, AudioStream> videoStreamsAdapter;
|
||||
|
@ -152,7 +152,6 @@ public class DownloadDialog extends DialogFragment
|
|||
// otherwise InstantiationException will be thrown when fragment is recreated
|
||||
// TODO: Maybe use a custom FragmentFactory instead?
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
@ -245,6 +244,7 @@ public class DownloadDialog extends DialogFragment
|
|||
}, Context.BIND_AUTO_CREATE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the displayed video streams based on the selected audio track.
|
||||
*/
|
||||
|
@ -287,8 +287,20 @@ public class DownloadDialog extends DialogFragment
|
|||
+ "inflater = [" + inflater + "], container = [" + container + "], "
|
||||
+ "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;
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
|
@ -4,6 +4,7 @@ import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -16,8 +17,10 @@ import androidx.appcompat.app.ActionBar;
|
|||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.IntentCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.grack.nanojson.JsonWriter;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.BuildConfig;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -83,6 +86,8 @@ public class ErrorActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
|
||||
assureCorrectAppLanguage(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
@ -127,6 +132,9 @@ public class ErrorActivity extends AppCompatActivity {
|
|||
for (final String e : errorInfo.getStackTraces()) {
|
||||
Log.e(TAG, e);
|
||||
}
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,6 +158,13 @@ public class ErrorActivity extends AppCompatActivity {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void openPrivacyPolicyDialog(final Context context, final String action) {
|
||||
new AlertDialog.Builder(context)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.error;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
@ -20,6 +21,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
import androidx.core.app.NavUtils;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.DownloaderImpl;
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -68,6 +71,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
ThemeHelper.setTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
@ -109,6 +113,10 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||
CookieManager.getInstance().removeAllCookies(null);
|
||||
|
||||
recaptchaBinding.reCaptchaWebView.loadUrl(url);
|
||||
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,6 +137,12 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
|||
public void onBackPressed() {
|
||||
saveCookiesAndFinish();
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package org.schabi.newpipe.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.BaseFragment;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -16,8 +21,19 @@ public class BlankFragment extends BaseFragment {
|
|||
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
setTitle("Tubular");
|
||||
return inflater.inflate(R.layout.fragment_blank, container, false);
|
||||
final View view = inflater.inflate(R.layout.fragment_blank, container, false); // REVIEW
|
||||
final String preferredFont = getPreferredFont(view.getContext()); // up-10
|
||||
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
|
||||
public void onResume() {
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package org.schabi.newpipe.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.BaseFragment;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -20,7 +25,11 @@ public class EmptyFragment extends BaseFragment {
|
|||
emptyFragment.setArguments(bundle);
|
||||
return emptyFragment;
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
|
@ -28,6 +37,11 @@ public class EmptyFragment extends BaseFragment {
|
|||
final View view = inflater.inflate(R.layout.fragment_empty, container, false);
|
||||
view.findViewById(R.id.empty_state_view).setVisibility(
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import androidx.preference.PreferenceManager;
|
|||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.BaseFragment;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -91,13 +92,25 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
|||
mainTabsPositionKey = getString(R.string.main_tabs_position_key);
|
||||
mainTabsPositionBottom = prefs.getBoolean(mainTabsPositionKey, false);
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
@Override
|
||||
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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
|
||||
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.util.text.TextLinkifier.SET_LINK_MOVEMENT_METHOD;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableStringBuilder;
|
||||
|
@ -21,8 +23,10 @@ import androidx.annotation.Nullable;
|
|||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.widget.TooltipCompat;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.chip.Chip;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.BaseFragment;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -53,8 +57,17 @@ public abstract class BaseDescriptionFragment extends BaseFragment {
|
|||
setupDescription();
|
||||
setupMetadata(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();
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
|
|
@ -62,6 +62,7 @@ import com.google.android.exoplayer2.PlaybackParameters;
|
|||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.App;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -361,8 +362,18 @@ public final class VideoDetailFragment
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
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();
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.evernote.android.state.State;
|
|||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.jakewharton.rxbinding4.view.RxView;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.database.subscription.NotificationMode;
|
||||
|
@ -192,8 +193,18 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
@Nullable final ViewGroup container,
|
||||
@Nullable final Bundle savedInstanceState) {
|
||||
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();
|
||||
}
|
||||
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
|
||||
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.schabi.newpipe.fragments.list.channel;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -8,6 +10,9 @@ import android.view.ViewGroup;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
|
||||
|
@ -77,8 +82,19 @@ public class ChannelTabFragment extends BaseListInfoFragment<InfoItem, ChannelTa
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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
|
||||
public void onDestroyView() {
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.schabi.newpipe.fragments.list.comments;
|
|||
|
||||
import static org.schabi.newpipe.util.ServiceHelper.getServiceById;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -11,6 +13,9 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
|
||||
|
@ -66,8 +71,19 @@ public final class CommentRepliesFragment
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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
|
||||
public void onDestroyView() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.schabi.newpipe.fragments.list.comments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -10,6 +12,9 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.error.UserAction;
|
||||
|
@ -55,7 +60,17 @@ public class CommentsFragment extends BaseListInfoFragment<CommentsInfoItem, Com
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.schabi.newpipe.fragments.list.kiosk;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -10,6 +12,9 @@ import android.view.ViewGroup;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
|
||||
|
@ -101,7 +106,11 @@ public class KioskFragment extends BaseListInfoFragment<StreamInfoItem, KioskInf
|
|||
name = kioskTranslatedName;
|
||||
contentCountry = Localization.getPreferredContentCountry(requireContext());
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -121,7 +130,12 @@ public class KioskFragment extends BaseListInfoFragment<StreamInfoItem, KioskInf
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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;
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -6,6 +6,7 @@ import static org.schabi.newpipe.ktx.ViewUtils.animateHideRecyclerViewAllowingSc
|
|||
import static org.schabi.newpipe.util.ServiceHelper.getServiceById;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -19,9 +20,11 @@ import android.view.ViewGroup;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.shape.CornerFamily;
|
||||
import com.google.android.material.shape.ShapeAppearanceModel;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
|
@ -99,7 +102,11 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||
instance.setInitialData(serviceId, url, name);
|
||||
return instance;
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
public PlaylistFragment() {
|
||||
super(UserAction.REQUESTED_PLAYLIST);
|
||||
}
|
||||
|
@ -121,7 +128,12 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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;
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -136,7 +148,6 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||
|
||||
return headerBinding::getRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(final View rootView, final Bundle savedInstanceState) {
|
||||
super.initViews(rootView, savedInstanceState);
|
||||
|
@ -149,7 +160,6 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||
private PlayQueue getPlayQueueStartingAt(final StreamInfoItem infoItem) {
|
||||
return getPlayQueue(Math.max(infoListAdapter.getItemsList().indexOf(infoItem), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showInfoItemDialog(final StreamInfoItem item) {
|
||||
final Context context = getContext();
|
||||
|
@ -187,7 +197,6 @@ public class PlaylistFragment extends BaseListInfoFragment<StreamInfoItem, Playl
|
|||
public void onDestroyView() {
|
||||
headerBinding = null;
|
||||
playlistControlBinding = null;
|
||||
|
||||
super.onDestroyView();
|
||||
if (isBookmarkButtonReady != null) {
|
||||
isBookmarkButtonReady.set(false);
|
||||
|
|
|
@ -42,6 +42,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import com.evernote.android.state.State;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty; //REVIEW up-10
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.databinding.FragmentSearchBinding;
|
||||
import org.schabi.newpipe.error.ErrorInfo;
|
||||
|
@ -210,9 +212,22 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
|||
}
|
||||
|
||||
@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) {
|
||||
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
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
package org.schabi.newpipe.fragments.list.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.ListAdapter;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.databinding.ItemSearchSuggestionBinding;
|
||||
|
||||
|
@ -27,8 +32,19 @@ public class SuggestionListAdapter
|
|||
@Override
|
||||
public SuggestionItemHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
||||
final int viewType) {
|
||||
return new SuggestionItemHolder(ItemSearchSuggestionBinding
|
||||
final SuggestionItemHolder item = new SuggestionItemHolder(ItemSearchSuggestionBinding
|
||||
.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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.schabi.newpipe.fragments.list.videos;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -13,6 +14,8 @@ import androidx.annotation.Nullable;
|
|||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.databinding.RelatedItemsHeaderBinding;
|
||||
import org.schabi.newpipe.error.UserAction;
|
||||
|
@ -60,9 +63,20 @@ public class RelatedItemsFragment extends BaseListInfoFragment<InfoItem, Related
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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
|
||||
public void onDestroyView() {
|
||||
headerBinding = null;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.schabi.newpipe.info_list;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -11,6 +13,8 @@ import androidx.annotation.Nullable;
|
|||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.databinding.PignateFooterBinding;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
|
@ -274,11 +278,19 @@ public class InfoListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", "system");
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
||||
final int type) {
|
||||
final RecyclerView.ViewHolder holder;
|
||||
final String preferredFont;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onCreateViewHolder() called with: "
|
||||
+ "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
|
||||
// is sometimes reused which causes a crash
|
||||
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:
|
||||
return new HFHolder(PignateFooterBinding
|
||||
holder = new HFHolder(PignateFooterBinding
|
||||
.inflate(layoutInflater, parent, false)
|
||||
.getRoot()
|
||||
);
|
||||
preferredFont = getPreferredFont(holder.itemView.getContext());
|
||||
if (!preferredFont.equals("system")) {
|
||||
Fonty.setFonts((ViewGroup) holder.itemView);
|
||||
}
|
||||
return holder;
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.database.LocalItem;
|
||||
import org.schabi.newpipe.database.stream.model.StreamStateEntity;
|
||||
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.RemoteBookmarkPlaylistItemHolder;
|
||||
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.util.FallbackViewHolder;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
|
@ -312,48 +315,95 @@ public class LocalItemListAdapter extends RecyclerView.Adapter<RecyclerView.View
|
|||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
|
||||
final int type) {
|
||||
final RecyclerView.ViewHolder holder;
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onCreateViewHolder() called with: "
|
||||
+ "parent = [" + parent + "], type = [" + type + "]");
|
||||
}
|
||||
switch (type) {
|
||||
case HEADER_TYPE:
|
||||
holder = new HeaderFooterHolder(header);
|
||||
setUpFont(holder);
|
||||
return new HeaderFooterHolder(header);
|
||||
case FOOTER_TYPE:
|
||||
return new HeaderFooterHolder(footer);
|
||||
holder = new HeaderFooterHolder(footer);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new LocalPlaylistGridItemHolder(localItemBuilder, parent);
|
||||
holder = new LocalPlaylistGridItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new LocalBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
||||
holder = new LocalBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new RemotePlaylistGridItemHolder(localItemBuilder, parent);
|
||||
holder = new RemotePlaylistCardItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new RemoteBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
||||
holder = new RemoteBookmarkPlaylistItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new LocalPlaylistStreamGridItemHolder(localItemBuilder, parent);
|
||||
holder = new LocalPlaylistStreamGridItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new LocalStatisticStreamItemHolder(localItemBuilder, parent);
|
||||
holder = new LocalStatisticStreamItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
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:
|
||||
return new LocalStatisticStreamCardItemHolder(localItemBuilder, parent);
|
||||
holder = new LocalStatisticStreamCardItemHolder(localItemBuilder, parent);
|
||||
setUpFont(holder);
|
||||
return holder;
|
||||
default:
|
||||
holder = new FallbackViewHolder(new View(parent.getContext()));
|
||||
setUpFont(holder);
|
||||
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")
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,9 @@ package org.schabi.newpipe.local.bookmark;
|
|||
|
||||
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.InputType;
|
||||
|
@ -16,10 +18,12 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
import com.marcinorlowski.fonty.Fonty; // REVIEW up-10
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
|
@ -98,13 +102,21 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
|
|||
@Override
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@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
|
||||
public void onResume() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.schabi.newpipe.local.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -9,9 +11,12 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.NewPipeDatabase;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.database.playlist.model.PlaylistEntity;
|
||||
|
@ -51,10 +56,22 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
|
|||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.dialog_playlists, container);
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup 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
|
||||
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
||||
|
|
|
@ -45,6 +45,7 @@ import androidx.preference.PreferenceManager
|
|||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.evernote.android.state.State
|
||||
import com.marcinorlowski.fonty.Fonty // REVIEW up-10
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import com.xwray.groupie.Item
|
||||
import com.xwray.groupie.OnItemClickListener
|
||||
|
@ -126,7 +127,14 @@ class FeedFragment : BaseStateFragment<FeedState>() {
|
|||
}
|
||||
|
||||
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?) {
|
||||
|
@ -179,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() {
|
||||
// does everything needed to setup the layouts for grid or list modes
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.local.history;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -13,10 +14,12 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
|
@ -95,8 +98,19 @@ public class StatisticsPlaylistFragment
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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
|
||||
public void onResume() {
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package org.schabi.newpipe.local.holder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.database.LocalItem;
|
||||
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
|
||||
|
@ -24,7 +30,18 @@ public class LocalBookmarkPlaylistItemHolder extends LocalPlaylistItemHolder {
|
|||
final ViewGroup parent) {
|
||||
super(infoItemBuilder, layoutId, parent);
|
||||
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
|
||||
public void updateFromItem(final LocalItem localItem,
|
||||
|
|
|
@ -5,6 +5,7 @@ import static org.schabi.newpipe.ktx.ViewUtils.animate;
|
|||
import static org.schabi.newpipe.util.ThemeHelper.shouldUseGridLayout;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.InputType;
|
||||
|
@ -22,11 +23,13 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
import com.marcinorlowski.fonty.Fonty; //REVIEW up-10
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
|
@ -126,12 +129,21 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||
isLoadingComplete = new AtomicBoolean();
|
||||
debounceSaver = new DebounceSaver(this);
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
@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,8 +19,10 @@ import androidx.activity.result.contract.ActivityResultContracts.StartActivityFo
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.evernote.android.state.State
|
||||
import com.marcinorlowski.fonty.Fonty // REVIEW up-10
|
||||
import com.xwray.groupie.Group
|
||||
import com.xwray.groupie.GroupAdapter
|
||||
import com.xwray.groupie.Section
|
||||
|
@ -106,7 +108,18 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
|
@ -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 android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.text.util.Linkify;
|
||||
|
@ -26,6 +28,9 @@ import androidx.annotation.Nullable;
|
|||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.core.text.util.LinkifyCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
|
||||
|
@ -107,8 +112,19 @@ public class SubscriptionsImportFragment extends BaseFragment {
|
|||
public View onCreateView(@NonNull final LayoutInflater inflater,
|
||||
@Nullable final ViewGroup container,
|
||||
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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.local.subscription.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.view.LayoutInflater
|
||||
|
@ -16,10 +17,12 @@ import androidx.core.widget.doOnTextChanged
|
|||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.evernote.android.state.State
|
||||
import com.livefront.bridge.Bridge
|
||||
import com.marcinorlowski.fonty.Fonty // REVIEW up-10
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import com.xwray.groupie.OnItemClickListener
|
||||
import com.xwray.groupie.Section
|
||||
|
@ -89,7 +92,17 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
|||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): 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 {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.schabi.newpipe.local.subscription.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -7,12 +8,14 @@ import android.view.ViewGroup
|
|||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.ItemTouchHelper.SimpleCallback
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.evernote.android.state.State
|
||||
import com.livefront.bridge.Bridge
|
||||
import com.marcinorlowski.fonty.Fonty // REVIEW up-10
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import com.xwray.groupie.TouchCallback
|
||||
import org.schabi.newpipe.R
|
||||
|
@ -44,7 +47,18 @@ class FeedGroupReorderDialog : DialogFragment() {
|
|||
}
|
||||
|
||||
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?) {
|
||||
|
|
|
@ -5,8 +5,10 @@ import static org.schabi.newpipe.player.helper.PlayerHelper.formatSpeed;
|
|||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.provider.Settings;
|
||||
|
@ -21,11 +23,13 @@ import android.widget.SeekBar;
|
|||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.databinding.ActivityPlayerQueueControlBinding;
|
||||
|
@ -85,6 +89,7 @@ public final class PlayQueueActivity extends AppCompatActivity
|
|||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
assureCorrectAppLanguage(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
|
||||
|
@ -100,6 +105,9 @@ public final class PlayQueueActivity extends AppCompatActivity
|
|||
|
||||
serviceConnection = getServiceConnection();
|
||||
bind();
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,6 +135,12 @@ public final class PlayQueueActivity extends AppCompatActivity
|
|||
}
|
||||
return super.onPrepareOptionsMenu(m);
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package org.schabi.newpipe.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.DownloaderImpl;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -22,6 +24,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||
private String youtubeRestrictedModeEnabledKey;
|
||||
|
||||
private Localization initialSelectedLocalization;
|
||||
private String initialSelectedFont;
|
||||
private ContentCountry initialSelectedContentCountry;
|
||||
private String initialLanguage;
|
||||
|
||||
|
@ -36,7 +39,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||
initialSelectedContentCountry = org.schabi.newpipe.util.Localization
|
||||
.getPreferredContentCountry(requireContext());
|
||||
initialLanguage = defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
||||
|
||||
initialSelectedFont = defaultPreferences
|
||||
.getString(getString(R.string.app_font_key), getString(R.string.default_font_key));
|
||||
final Preference imageQualityPreference = requirePreference(R.string.image_quality_key);
|
||||
imageQualityPreference.setOnPreferenceChangeListener(
|
||||
(preference, newValue) -> {
|
||||
|
@ -78,7 +82,8 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||
.getPreferredContentCountry(requireContext());
|
||||
final String selectedLanguage =
|
||||
defaultPreferences.getString(getString(R.string.app_language_key), "en");
|
||||
|
||||
final String selectedFont =
|
||||
defaultPreferences.getString(getString(R.string.app_font_key), "Arial");
|
||||
if (!selectedLocalization.equals(initialSelectedLocalization)
|
||||
|| !selectedContentCountry.equals(initialSelectedContentCountry)
|
||||
|| !selectedLanguage.equals(initialLanguage)) {
|
||||
|
@ -86,6 +91,14 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
|||
Toast.LENGTH_LONG).show();
|
||||
|
||||
NewPipe.setupLocalization(selectedLocalization, selectedContentCountry);
|
||||
} else if ((!selectedFont.equals(initialSelectedFont))) {
|
||||
Toast.makeText(requireContext(), R.string.font_changes_requires_app_restart,
|
||||
Toast.LENGTH_LONG).show();
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(requireContext());
|
||||
final SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putString("preferred_font", selectedFont);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.schabi.newpipe.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.DownloaderImpl;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -55,7 +57,11 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
|||
clearCookiePref.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(final Preference preference) {
|
||||
if (preference.getKey().equals(cacheWipeKey)) {
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package org.schabi.newpipe.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -49,7 +52,12 @@ public class MainSettingsFragment extends BasePreferenceFragment {
|
|||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
// if no prefered font, return system default
|
||||
return preferences.getString("preferred_font", getString(R.string.default_font_key));
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
// Unlink activity so that we don't get memory problems
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.schabi.newpipe.settings;
|
|||
|
||||
import static org.schabi.newpipe.local.bookmark.MergedPlaylistManager.getMergedOrderedPlaylists;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -12,9 +14,12 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.NewPipeDatabase;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.database.AppDatabase;
|
||||
|
@ -146,8 +151,18 @@ public class SelectPlaylistFragment extends DialogFragment {
|
|||
final int viewType) {
|
||||
final View item = LayoutInflater.from(parent.getContext())
|
||||
.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);
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final SelectPlaylistItemHolder holder,
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.schabi.newpipe.settings;
|
|||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -20,10 +21,12 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.evernote.android.state.State;
|
||||
import com.jakewharton.rxbinding4.widget.RxTextView;
|
||||
import com.livefront.bridge.Bridge;
|
||||
import com.marcinorlowski.fonty.Fonty; // REVIEW up-10
|
||||
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
|
@ -87,6 +90,7 @@ public class SettingsActivity extends AppCompatActivity implements
|
|||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceBundle) {
|
||||
|
||||
setTheme(ThemeHelper.getSettingsThemeStyle(this));
|
||||
assureCorrectAppLanguage(this);
|
||||
|
||||
|
@ -118,6 +122,10 @@ public class SettingsActivity extends AppCompatActivity implements
|
|||
if (DeviceUtils.isTv(this)) {
|
||||
FocusOverlayView.setupFocusObserver(this);
|
||||
}
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -255,6 +263,12 @@ public class SettingsActivity extends AppCompatActivity implements
|
|||
}
|
||||
searchFragment.setSearcher(searcher);
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ensures that the search shows the correct/available search results.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -14,9 +15,11 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.loader.content.Loader;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SortedList;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
|
||||
import com.nononsenseapps.filepicker.FilePickerFragment;
|
||||
|
||||
|
@ -36,12 +39,17 @@ public class FilePickerActivityHelper extends com.nononsenseapps.filepicker.File
|
|||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
if (ThemeHelper.isLightThemeSelected(this)) {
|
||||
this.setTheme(R.style.FilePickerThemeLight);
|
||||
} else {
|
||||
this.setTheme(R.style.FilePickerThemeDark);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,6 +62,13 @@ public class FilePickerActivityHelper extends com.nononsenseapps.filepicker.File
|
|||
currentFragment.goUp();
|
||||
}
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected AbstractFilePickerFragment<File> getFragment(@Nullable final String startPath,
|
||||
|
|
|
@ -129,6 +129,7 @@ public class DownloadManagerService extends Service {
|
|||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
||||
super.onCreate();
|
||||
|
||||
if (DEBUG) {
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package us.shandian.giga.ui.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.marcinorlowski.fonty.Fonty;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
|
@ -12,13 +17,24 @@ public abstract class ToolbarActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
final String preferredFont = getPreferredFont(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getLayoutResource());
|
||||
|
||||
mToolbar = this.findViewById(R.id.toolbar);
|
||||
|
||||
setSupportActionBar(mToolbar);
|
||||
|
||||
if (!preferredFont.equals(getString(R.string.default_font_key))) {
|
||||
Fonty.setFonts(this);
|
||||
}
|
||||
}
|
||||
public String getPreferredFont(final Context context) {
|
||||
final SharedPreferences preferences = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
return preferences.getString("preferred_font", (getString(R.string.default_font_key)));
|
||||
}
|
||||
|
||||
|
||||
protected abstract int getLayoutResource();
|
||||
}
|
||||
|
|
|
@ -92,3 +92,4 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/itemThumbnailView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<!-- REVIEW deleted in up-10, why? -->
|
|
@ -354,6 +354,8 @@
|
|||
|
||||
<string name="app_language_key">app_language_key</string>
|
||||
|
||||
<string name="app_font_key">app_font_key</string>
|
||||
|
||||
<string name="feed_update_threshold_key">feed_update_threshold_key</string>
|
||||
<string name="feed_update_threshold_default_value">300</string>
|
||||
<string name="feed_show_watched_items_key">feed_show_played_items</string>
|
||||
|
@ -502,6 +504,10 @@
|
|||
|
||||
<!-- Localizations -->
|
||||
<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 -->
|
||||
<string-array name="language_codes">
|
||||
<item>@string/default_localization_key</item>
|
||||
|
@ -1343,6 +1349,29 @@
|
|||
<item>正體中文</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
<!--The next two arrays are set to change the app font-->
|
||||
<string-array name="app_font_code">
|
||||
<item>@string/default_localization_key</item>
|
||||
<item>Calibri</item>
|
||||
<item>Algerian</item>
|
||||
<item>Broadway</item>
|
||||
<item>Arial</item>
|
||||
<item>Bell MT</item>
|
||||
<item>Time New Roman</item>
|
||||
</string-array>
|
||||
<string-array name="app_font_name">
|
||||
<item>@string/systems_font</item>
|
||||
<item>Calibri</item>
|
||||
<item>Algerian</item>
|
||||
<item>Broadway</item>
|
||||
<item>Arial</item>
|
||||
<item>Bell MT</item>
|
||||
<item>Time New Roman</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<!-- Limit mobile data usage -->
|
||||
<string name="limit_mobile_data_usage_key">limit_mobile_data_usage</string>
|
||||
<string name="limit_data_usage_none_key">limit_data_usage_none</string>
|
||||
|
|
|
@ -412,6 +412,7 @@
|
|||
<string name="import_settings">Do you want to also import settings?</string>
|
||||
<string name="error_unable_to_load_comments">Could not load comments</string>
|
||||
<string name="localization_changes_requires_app_restart">The language will change once the app is restarted</string>
|
||||
<string name="font_changes_requires_app_restart">The font will change once the app is restarted</string>
|
||||
<!-- Kiosk Names -->
|
||||
<string name="trending">Trending</string>
|
||||
<string name="top_50">Top 50</string>
|
||||
|
@ -660,6 +661,9 @@
|
|||
<string name="choose_instance_prompt">Choose an instance</string>
|
||||
<string name="app_language_title">App language</string>
|
||||
<string name="systems_language">System default</string>
|
||||
<string name="systems_font">System default</string>
|
||||
<string name="app_font_title">App font</string>
|
||||
|
||||
<string name="remove_watched">Remove watched</string>
|
||||
<string name="remove_watched_popup_title">Remove watched videos?</string>
|
||||
<string name="remove_duplicates">Remove duplicates</string>
|
||||
|
|
|
@ -33,6 +33,16 @@
|
|||
app:iconSpaceReserved="false"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="@string/default_localization_key"
|
||||
android:entries="@array/app_font_name"
|
||||
android:entryValues="@array/app_font_code"
|
||||
android:key="@string/app_font_key"
|
||||
android:title="@string/app_font_title"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:fragment="org.schabi.newpipe.settings.tabs.ChooseTabsFragment"
|
||||
android:key="@string/main_page_content_key"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
// the kotlin version might be different from NewPipe main
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.9.25'
|
||||
repositories {
|
||||
|
|
|
@ -6,6 +6,6 @@ include ':app'
|
|||
|
||||
//includeBuild('../NewPipeExtractor') {
|
||||
// dependencySubstitution {
|
||||
// substitute module('com.github.TeamNewPipe:NewPipeExtractor') using project(':extractor')
|
||||
// substitute module('com.github.teamnewpipe:NewPipeExtractor') using project(':extractor')
|
||||
// }
|
||||
//}
|
||||
|
|
Loading…
Add table
Reference in a new issue