From a78e266a26efd0d8289d448712f9e97f47a9756c Mon Sep 17 00:00:00 2001 From: Charles Lombardo Date: Sun, 23 Oct 2022 22:23:00 -0400 Subject: [PATCH] Android: Use androidx preference manager --- Source/Android/app/build.gradle | 4 ++++ .../dolphinemu/dolphinemu/activities/EmulationActivity.java | 2 +- .../features/settings/model/view/InputBindingSetting.java | 3 ++- .../settings/ui/viewholder/InputBindingSettingViewHolder.java | 2 +- .../settings/ui/viewholder/RumbleBindingViewHolder.java | 2 +- .../java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java | 3 ++- .../dolphinemu/dolphinemu/utils/DirectoryInitialization.java | 2 +- .../java/org/dolphinemu/dolphinemu/utils/StartupHandler.java | 2 +- .../java/org/dolphinemu/dolphinemu/utils/ThemeHelper.java | 2 +- 9 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index db568618a5..ea24d270f6 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -104,6 +104,10 @@ dependencies { implementation 'androidx.slidingpanelayout:slidingpanelayout:1.2.0' implementation 'com.google.android.material:material:1.6.1' implementation 'androidx.core:core-splashscreen:1.0.0' + implementation 'androidx.preference:preference:1.2.0' + + // Force dependency version to solve build conflict with androidx preferences + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" // Android TV UI libraries. implementation 'androidx.leanback:leanback:1.0.0' diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index 9106d8d81c..f40de0be3d 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -9,7 +9,6 @@ import android.content.SharedPreferences; import android.graphics.Rect; import android.os.Build; import android.os.Bundle; -import android.preference.PreferenceManager; import android.util.SparseIntArray; import android.view.InputDevice; import android.view.KeyEvent; @@ -30,6 +29,7 @@ import androidx.appcompat.widget.PopupMenu; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; +import androidx.preference.PreferenceManager; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputBindingSetting.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputBindingSetting.java index 1ff1600186..175986d3ba 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputBindingSetting.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/InputBindingSetting.java @@ -4,10 +4,11 @@ package org.dolphinemu.dolphinemu.features.settings.model.view; import android.content.Context; import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.view.InputDevice; import android.view.KeyEvent; +import androidx.preference.PreferenceManager; + import org.dolphinemu.dolphinemu.DolphinApplication; import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; import org.dolphinemu.dolphinemu.features.settings.model.Settings; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java index 1e2f287cb5..ba861cb814 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/InputBindingSettingViewHolder.java @@ -4,11 +4,11 @@ package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; import android.content.Context; import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.view.View; import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.preference.PreferenceManager; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.features.settings.model.view.InputBindingSetting; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java index 4ffc43f44d..4646dfa37a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RumbleBindingViewHolder.java @@ -4,11 +4,11 @@ package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; import android.content.Context; import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.view.View; import android.widget.TextView; import androidx.annotation.Nullable; +import androidx.preference.PreferenceManager; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.features.settings.model.view.RumbleBindingSetting; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java index 07bd95495c..4923398082 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java @@ -15,7 +15,6 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.preference.PreferenceManager; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.Display; @@ -25,6 +24,8 @@ import android.view.View; import android.view.View.OnTouchListener; import android.widget.Toast; +import androidx.preference.PreferenceManager; + import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.NativeLibrary.ButtonType; import org.dolphinemu.dolphinemu.R; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java index 7810b5c607..f872802a9f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java @@ -9,13 +9,13 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Build; import android.os.Environment; -import android.preference.PreferenceManager; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; +import androidx.preference.PreferenceManager; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java index 918a6859c3..1cb332636e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java @@ -8,10 +8,10 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; -import android.preference.PreferenceManager; import android.text.TextUtils; import androidx.fragment.app.FragmentActivity; +import androidx.preference.PreferenceManager; import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.activities.EmulationActivity; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ThemeHelper.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ThemeHelper.java index 5d9a1a9c5b..ff96e033c0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ThemeHelper.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/ThemeHelper.java @@ -5,13 +5,13 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Color; import android.os.Build; -import android.preference.PreferenceManager; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; +import androidx.preference.PreferenceManager; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.MaterialToolbar;