diff --git a/app/build.gradle b/app/build.gradle index d1044e7ef..5a41c477f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,16 +136,18 @@ android { dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.annotation:annotation:1.1.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'com.google.android.material:material:1.1.0' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.palette:palette:1.0.0' - implementation 'androidx.legacy:legacy-preference-v14:1.0.0' + + implementation 'com.google.android.material:material:1.1.0' implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' implementation 'com.google.zxing:core:3.3.3' diff --git a/app/src/basic/res/xml/preferences.xml b/app/src/basic/res/xml/preferences.xml index 858bcb562..b65c0cb0a 100644 --- a/app/src/basic/res/xml/preferences.xml +++ b/app/src/basic/res/xml/preferences.xml @@ -1,30 +1,30 @@ - - + - + - - + + - - + - - + - - + + - + - + - - + - - + - + - + - - + - - + - + diff --git a/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java b/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java index 60269b4c3..7338a624d 100644 --- a/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java +++ b/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java @@ -15,13 +15,14 @@ import android.net.Uri; import android.os.Bundle; import androidx.annotation.ColorInt; import androidx.annotation.Nullable; -import androidx.preference.PreferenceFragment; import androidx.core.content.ContextCompat; import androidx.appcompat.app.AlertDialog; import androidx.preference.CheckBoxPreference; import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceCategory; +import androidx.preference.PreferenceFragmentCompat; + import android.text.TextUtils; import android.util.TypedValue; import info.guardianproject.panic.Panic; @@ -33,7 +34,7 @@ import org.fdroid.fdroid.installer.PrivilegedInstaller; import java.util.ArrayList; import java.util.Set; -public class PanicPreferencesFragment extends PreferenceFragment +public class PanicPreferencesFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { private static final String PREF_APP = "pref_panic_app"; diff --git a/app/src/full/res/xml/preferences_panic.xml b/app/src/full/res/xml/preferences_panic.xml index 390443ee4..827d2496b 100644 --- a/app/src/full/res/xml/preferences_panic.xml +++ b/app/src/full/res/xml/preferences_panic.xml @@ -1,19 +1,19 @@ - - - - - + - - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java b/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java index 39d4573b8..d707e936f 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java +++ b/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java @@ -34,6 +34,7 @@ import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import androidx.preference.PreferenceFragment; +import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; import androidx.preference.CheckBoxPreference; import androidx.preference.EditTextPreference; @@ -59,7 +60,7 @@ import org.fdroid.fdroid.data.RepoProvider; import org.fdroid.fdroid.installer.InstallHistoryService; import org.fdroid.fdroid.installer.PrivilegedInstaller; -public class PreferencesFragment extends PreferenceFragment +public class PreferencesFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { public static final String TAG = "PreferencesFragment"; diff --git a/app/src/main/java/org/fdroid/fdroid/views/main/SettingsView.java b/app/src/main/java/org/fdroid/fdroid/views/main/SettingsView.java index 139a7b021..986878b97 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/main/SettingsView.java +++ b/app/src/main/java/org/fdroid/fdroid/views/main/SettingsView.java @@ -1,14 +1,14 @@ package org.fdroid.fdroid.views.main; import android.annotation.TargetApi; -import android.app.Fragment; -import android.app.FragmentTransaction; import android.content.Context; import androidx.appcompat.app.AppCompatActivity; import android.util.AttributeSet; import android.widget.FrameLayout; +import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentStatePagerAdapter; +import androidx.fragment.app.FragmentTransaction; import org.fdroid.fdroid.R; import org.fdroid.fdroid.views.PreferencesFragment; @@ -58,7 +58,7 @@ public class SettingsView extends FrameLayout { } if (currentTransaction == null) { - currentTransaction = activity.getFragmentManager().beginTransaction(); + currentTransaction = activity.getSupportFragmentManager().beginTransaction(); } currentTransaction.replace(getId(), new PreferencesFragment(), "preferences-fragment"); @@ -76,13 +76,13 @@ public class SettingsView extends FrameLayout { throw new IllegalArgumentException("Cannot add a SettingsView to activities which are not an AppCompatActivity"); } - Fragment existingFragment = activity.getFragmentManager().findFragmentByTag("preferences-fragment"); + Fragment existingFragment = activity.getSupportFragmentManager().findFragmentByTag("preferences-fragment"); if (existingFragment == null) { return; } if (currentTransaction == null) { - currentTransaction = activity.getFragmentManager().beginTransaction(); + currentTransaction = activity.getSupportFragmentManager().beginTransaction(); } currentTransaction.remove(existingFragment); currentTransaction.commitAllowingStateLoss(); diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 026a8891f..36104e8ff 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,30 +1,30 @@ - - + - + - - + + - - + - - + - - + + - + - + - - + - - + - + @@ -100,9 +100,9 @@ android:defaultValue="true" android:title="@string/scan_removable_storage_title" android:summary="@string/scan_removable_storage_summary"/> - + - + - + - - - - + + - - + - +