summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2016-04-11 19:02:34 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2016-04-11 17:06:55 +0000
commit9e4120e54d07576e4715174ba8a05d7352cd29d1 (patch)
tree08e895ebb81e37f6fce0b23019c36a8fdc4bfa90
parent153dd3f81ae59a31a9ad9e28705ea72a462fd81c (diff)
use PreferenceFragment instead of PreferenceActivity for Settings
PreferenceActivity already was deprecated since v11 initial patch by Aleksandar would have needed a bump of minSdkVersion, but appcompat supports the same way in a downwards compatible way. Change-Id: I4c5776bbf57a2ce62411dcfec18d055f5cb01358 Reviewed-on: https://gerrit.libreoffice.org/23817 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--android/sdremote/mobile/build.gradle1
-rw-r--r--android/sdremote/mobile/src/main/AndroidManifest.xml3
-rw-r--r--android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SettingsActivity.java16
-rw-r--r--android/sdremote/mobile/src/main/res/layout/activity_settings.xml27
-rw-r--r--android/sdremote/mobile/src/main/res/values/themes.xml3
-rw-r--r--android/sdremote/mobile/src/main/res/xml/preferences.xml10
6 files changed, 50 insertions, 10 deletions
diff --git a/android/sdremote/mobile/build.gradle b/android/sdremote/mobile/build.gradle
index 21fd861..33decf1 100644
--- a/android/sdremote/mobile/build.gradle
+++ b/android/sdremote/mobile/build.gradle
@@ -23,6 +23,7 @@ android {
dependencies {
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
+ compile 'com.android.support:preference-v7:23.3.0'
fullCompile 'com.google.android.gms:play-services-wearable:8.4.0'
fullWearApp project(':wear')
}
diff --git a/android/sdremote/mobile/src/main/AndroidManifest.xml b/android/sdremote/mobile/src/main/AndroidManifest.xml
index 0807696..cc75dc7 100644
--- a/android/sdremote/mobile/src/main/AndroidManifest.xml
+++ b/android/sdremote/mobile/src/main/AndroidManifest.xml
@@ -67,7 +67,8 @@
<activity
android:name=".activity.SettingsActivity"
- android:label="@string/title_settings">
+ android:label="@string/title_settings"
+ android:theme="@style/Theme.ImpressRemote.Settings">
</activity>
<activity
diff --git a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SettingsActivity.java b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SettingsActivity.java
index b796429..d2f9417 100644
--- a/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SettingsActivity.java
+++ b/android/sdremote/mobile/src/main/java/org/libreoffice/impressremote/activity/SettingsActivity.java
@@ -9,17 +9,17 @@
package org.libreoffice.impressremote.activity;
import android.os.Bundle;
-import android.preference.PreferenceActivity;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.preference.PreferenceFragmentCompat;
import android.view.MenuItem;
import org.libreoffice.impressremote.R;
-public class SettingsActivity extends PreferenceActivity {
+public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle aSavedInstanceState) {
super.onCreate(aSavedInstanceState);
-
- addPreferencesFromResource(R.xml.preferences);
+ setContentView(R.layout.activity_settings);
}
@Override
@@ -33,6 +33,14 @@ public class SettingsActivity extends PreferenceActivity {
return super.onOptionsItemSelected(aMenuItem);
}
}
+
+ public static class SettingsFragment extends PreferenceFragmentCompat {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String s) {
+ //Load preferences from XML
+ addPreferencesFromResource(R.xml.preferences);
+ }
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/mobile/src/main/res/layout/activity_settings.xml b/android/sdremote/mobile/src/main/res/layout/activity_settings.xml
new file mode 100644
index 0000000..4f55aae
--- /dev/null
+++ b/android/sdremote/mobile/src/main/res/layout/activity_settings.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent" android:layout_height="match_parent">
+ <fragment
+ android:id="@+id/settingsContent"
+ android:name="org.libreoffice.impressremote.activity.SettingsActivity$SettingsFragment"
+ android:tag="SettingsFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"/>
+</FrameLayout> \ No newline at end of file
diff --git a/android/sdremote/mobile/src/main/res/values/themes.xml b/android/sdremote/mobile/src/main/res/values/themes.xml
index d2998dd..ed1e3da 100644
--- a/android/sdremote/mobile/src/main/res/values/themes.xml
+++ b/android/sdremote/mobile/src/main/res/values/themes.xml
@@ -61,4 +61,7 @@
<item name="displayOptions">showCustom</item>
</style>
+ <style name="Theme.ImpressRemote.Settings" parent="Theme.ImpressRemote">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
+ </style>
</resources> \ No newline at end of file
diff --git a/android/sdremote/mobile/src/main/res/xml/preferences.xml b/android/sdremote/mobile/src/main/res/xml/preferences.xml
index 676ce09..84f10d1 100644
--- a/android/sdremote/mobile/src/main/res/xml/preferences.xml
+++ b/android/sdremote/mobile/src/main/res/xml/preferences.xml
@@ -16,24 +16,24 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+<android.support.v7.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
- <CheckBoxPreference
+ <android.support.v7.preference.CheckBoxPreference
android:key="volume_keys_actions"
android:defaultValue="true"
android:title="@string/preferences_volume_keys_actions_title"
android:summary="@string/preferences_volume_keys_actions_summary"/>
- <CheckBoxPreference
+ <android.support.v7.preference.CheckBoxPreference
android:key="keep_screen_on"
android:defaultValue="true"
android:title="@string/preferences_keep_screen_on_title"
android:summary="@string/preferences_keep_screen_on_summary"/>
- <CheckBoxPreference
+ <android.support.v7.preference.CheckBoxPreference
android:key="quiet_mode"
android:defaultValue="false"
android:title="@string/preferences_quiet_mode_title"
android:summary="@string/preferences_quiet_mode_summary"/>
-</PreferenceScreen> \ No newline at end of file
+</android.support.v7.preference.PreferenceScreen> \ No newline at end of file