summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-05-16 05:26:48 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-05-16 12:13:18 +0200
commit7b0d2829fe691e013486578b6e93cf94ceb0cd36 (patch)
tree4455d44d3fa16dd756afaf6788cc905b52c5a9e5 /android
parentf895ee6de44cddfb86cdb0912693f7aa56cb3340 (diff)
android: Port to non-deprecated androidx PreferenceManager
The `android.preference.PreferenceManager` class was deprecated in API level 29 [1]. Port to `androidx.preference.PreferenceManager` from the AndroidX Preference library instead. All that needs to be done for this is to add the new library dependency and adjust the import, no further code changes needed for this step. (There are uses of more deprecated preferences-related classes, though. Those will have to be dealt with separately.) This addresses depreaction warnings like > Task :compileStrippedUIEditingDebugJavaWithJavac /home/michi/development/git/libreoffice-WORKTREE-android/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java:16: warning: [deprecation] PreferenceManager in android.preference has been deprecated import android.preference.PreferenceManager; ^ [1] https://developer.android.com/reference/android/preference/PreferenceManager Change-Id: Ied168ffbd0591d69e0797e2a0a5bab067e133d22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167716 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'android')
-rw-r--r--android/source/build.gradle1
-rw-r--r--android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java2
-rw-r--r--android/source/src/java/org/libreoffice/LocaleHelper.java3
-rw-r--r--android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java3
4 files changed, 4 insertions, 5 deletions
diff --git a/android/source/build.gradle b/android/source/build.gradle
index 7012c275aa33..6428a0ffcfda 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -35,6 +35,7 @@ dependencies {
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.multidex:multidex:2.0.1"
+ implementation 'androidx.preference:preference:1.2.1'
}
android {
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index cf60ff37c5da..1b0b3915c349 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -13,13 +13,13 @@ import android.graphics.RectF;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
-import android.preference.PreferenceManager;
import android.provider.DocumentsContract;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.snackbar.Snackbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
+import androidx.preference.PreferenceManager;
import android.text.InputType;
import android.util.Log;
import android.view.KeyEvent;
diff --git a/android/source/src/java/org/libreoffice/LocaleHelper.java b/android/source/src/java/org/libreoffice/LocaleHelper.java
index a87c63f09990..e3997f913a32 100644
--- a/android/source/src/java/org/libreoffice/LocaleHelper.java
+++ b/android/source/src/java/org/libreoffice/LocaleHelper.java
@@ -4,8 +4,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.os.Build;
-import android.preference.PreferenceManager;
+import androidx.preference.PreferenceManager;
import java.util.Locale;
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index bc5203d9c6eb..e87779df0eae 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -20,9 +20,7 @@ import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.graphics.drawable.Icon;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
-import android.preference.PreferenceManager;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@@ -31,6 +29,7 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
+import androidx.preference.PreferenceManager;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;