[Libreoffice-commits] online.git: android/app

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue May 7 15:41:07 UTC 2019


 android/app/src/main/AndroidManifest.xml                                                           |    2 
 android/app/src/main/java/org/libreoffice/androidapp/storage/DocumentProviderSettingsActivity.java |   20 ++---
 android/app/src/main/res/xml/documentprovider_preferences.xml                                      |   37 +++++-----
 3 files changed, 30 insertions(+), 29 deletions(-)

New commits:
commit b67e0d45ddac7cc20ba830adefcd9c29bf90ac20
Author:     kaishu-sahu <kaishusahu101 at gmail.com>
AuthorDate: Sun Apr 28 00:32:05 2019 +0530
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue May 7 17:40:49 2019 +0200

    android: resolve the deprecation of PreferenceFragment in DocumentProviderSettingsAcitvity
    
    Change-Id: I736807d6bb47df7b3766a849ce77f87968ebda05
    Reviewed-on: https://gerrit.libreoffice.org/71435
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index e6df34af6..8bf4c1120 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -105,7 +105,7 @@
 
         <!-- Document Provider Settings Activity -->
         <activity android:name=".storage.DocumentProviderSettingsActivity"
-            android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
+            android:theme="@style/Theme.AppCompat.Light"
             android:label="@string/storage_provider_settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/android/app/src/main/java/org/libreoffice/androidapp/storage/DocumentProviderSettingsActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/storage/DocumentProviderSettingsActivity.java
index 58b3107ee..243198d95 100644
--- a/android/app/src/main/java/org/libreoffice/androidapp/storage/DocumentProviderSettingsActivity.java
+++ b/android/app/src/main/java/org/libreoffice/androidapp/storage/DocumentProviderSettingsActivity.java
@@ -12,10 +12,7 @@ package org.libreoffice.androidapp.storage;
 import android.content.Intent;
 import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceFragment;
 import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
 
 import org.libreoffice.androidapp.R;
 import org.libreoffice.androidapp.storage.external.BrowserSelectorActivity;
@@ -23,6 +20,8 @@ import org.libreoffice.androidapp.storage.external.BrowserSelectorActivity;
 import java.util.Set;
 
 import androidx.appcompat.app.AppCompatActivity;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
 
 public class DocumentProviderSettingsActivity extends AppCompatActivity {
 
@@ -38,7 +37,7 @@ public class DocumentProviderSettingsActivity extends AppCompatActivity {
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         // Display the fragment as the main content.
-        getFragmentManager().beginTransaction()
+        getSupportFragmentManager().beginTransaction()
                 .replace(android.R.id.content, new SettingsFragment()).commit();
     }
 
@@ -61,17 +60,15 @@ public class DocumentProviderSettingsActivity extends AppCompatActivity {
         }
     }
 
-    public static class SettingsFragment extends PreferenceFragment {
+    public static class SettingsFragment extends PreferenceFragmentCompat {
+
         @Override
-        public void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
+        public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
             // Load the preferences from an XML resource
             addPreferencesFromResource(R.xml.documentprovider_preferences);
 
-            PreferenceScreen extSDPreference =
-                    (PreferenceScreen)findPreference(KEY_PREF_EXTERNAL_SD_PATH_URI);
-            PreferenceScreen otgPreference =
-                    (PreferenceScreen)findPreference(KEY_PREF_OTG_PATH_URI);
+            Preference extSDPreference = findPreference(KEY_PREF_EXTERNAL_SD_PATH_URI);
+            Preference otgPreference = findPreference(KEY_PREF_OTG_PATH_URI);
 
             extSDPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                 @Override
@@ -89,7 +86,6 @@ public class DocumentProviderSettingsActivity extends AppCompatActivity {
                     return true;
                 }
             });
-
         }
 
         private void startBrowserSelectorActivity(String prefKey, String mode) {
diff --git a/android/app/src/main/res/xml/documentprovider_preferences.xml b/android/app/src/main/res/xml/documentprovider_preferences.xml
index bb5f087dd..2c95da294 100644
--- a/android/app/src/main/res/xml/documentprovider_preferences.xml
+++ b/android/app/src/main/res/xml/documentprovider_preferences.xml
@@ -3,36 +3,41 @@
  This file is part of the LibreOffice project.
  This Source Code Form is subject to the terms of the Mozilla Public
  License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
- -->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
     <PreferenceCategory
+        android:key="pref_key_owncloud_settings"
         android:title="@string/owncloud_settings"
-        android:key="pref_key_owncloud_settings">
+        app:iconSpaceReserved="false">
         <EditTextPreference
+            android:hint="https://server:port/"
             android:key="pref_server_url"
-            android:title="@string/server_url"
             android:summary="@string/server_url_and_port"
-            android:hint="https://server:port/" />
+            android:title="@string/server_url"
+            app:iconSpaceReserved="false" />
         <EditTextPreference
             android:key="pref_user_name"
-            android:title="@string/user_name" />
+            android:title="@string/user_name"
+            app:iconSpaceReserved="false" />
         <EditTextPreference
             android:key="pref_password"
+            android:password="true"
             android:title="@string/password"
-            android:password="true" />
+            app:iconSpaceReserved="false" />
     </PreferenceCategory>
     <PreferenceCategory
-        android:title="@string/physical_storage_settings">
-        <PreferenceScreen
+        android:title="@string/physical_storage_settings"
+        app:iconSpaceReserved="false">
+        <Preference
+            android:key="pref_extsd_path_uri"
             android:title="@string/external_sd_path"
-            android:key="pref_extsd_path_uri">
-        </PreferenceScreen>
-        <PreferenceScreen
-            android:title="@string/otg_device_path"
+            app:iconSpaceReserved="false" />
+        <Preference
             android:key="pref_otg_path_uri"
-            android:summary="@string/otg_warning">
-        </PreferenceScreen>
+            android:summary="@string/otg_warning"
+            android:title="@string/otg_device_path"
+            app:iconSpaceReserved="false" />
     </PreferenceCategory>
 
 </PreferenceScreen>


More information about the Libreoffice-commits mailing list