Use AndroidX preference

This commit is contained in:
TacoTheDank 2020-08-27 16:55:57 -04:00 committed by Stypox
parent 79e2bb382f
commit ba6c7de35a
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
42 changed files with 86 additions and 86 deletions

View file

@ -2,7 +2,7 @@ package org.schabi.newpipe.settings;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import android.view.View;
import androidx.annotation.Nullable;
@ -20,7 +20,7 @@ public abstract class BasePreferenceFragment extends PreferenceFragmentCompat {
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
super.onCreate(savedInstanceState);
}

View file

@ -7,7 +7,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;
@ -74,7 +74,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
initialSelectedContentCountry = org.schabi.newpipe.util.Localization
.getPreferredContentCountry(requireContext());
initialLanguage = PreferenceManager
.getDefaultSharedPreferences(getContext()).getString("app_language_key", "en");
.getDefaultSharedPreferences(requireContext()).getString("app_language_key", "en");
}
@Override
@ -148,7 +148,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
final ContentCountry selectedContentCountry = org.schabi.newpipe.util.Localization
.getPreferredContentCountry(requireContext());
final String selectedLanguage = PreferenceManager
.getDefaultSharedPreferences(getContext()).getString("app_language_key", "en");
.getDefaultSharedPreferences(requireContext()).getString("app_language_key", "en");
if (!selectedLocalization.equals(initialSelectedLocalization)
|| !selectedContentCountry.equals(initialSelectedContentCountry)
@ -217,7 +217,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
try {
output = new ObjectOutputStream(new FileOutputStream(dst));
final SharedPreferences pref
= PreferenceManager.getDefaultSharedPreferences(getContext());
= PreferenceManager.getDefaultSharedPreferences(requireContext());
output.writeObject(pref.getAll());
} catch (final IOException e) {
@ -299,7 +299,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
try {
input = new ObjectInputStream(new FileInputStream(src));
final SharedPreferences.Editor prefEdit = PreferenceManager
.getDefaultSharedPreferences(getContext()).edit();
.getDefaultSharedPreferences(requireContext()).edit();
prefEdit.clear();
final Map<String, ?> entries = (Map<String, ?>) input.readObject();
for (final Map.Entry<String, ?> entry : entries.entrySet()) {

View file

@ -4,7 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.Menu;

View file

@ -2,7 +2,7 @@ package org.schabi.newpipe.settings.tabs;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import androidx.preference.PreferenceManager;
import android.widget.Toast;
import org.schabi.newpipe.R;