summaryrefslogtreecommitdiff
path: root/android/source/src
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2015-02-09 12:37:46 +0100
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2015-06-10 17:12:18 +0000
commitd5c9d1dec60085f97eb07402eefcc3fd7a989877 (patch)
tree0dcb966876ee9e0b8d70f1c3f4b716228f4fa34c /android/source/src
parentd6f9e415375f53eba7c5e147c7ff30c03a6db731 (diff)
Android: settings activity for document providers
Creates an activity to manage the settings of any document provider that needs them, and populated it with the settings required by the ownCloud implementation. The settings screen is not yet plugged to the document browser UI but can be launched with this command: adb shell am start -a android.intent.action.MAIN \ -n org.libreoffice/.storage.DocumentProviderSettingsActivity Change-Id: I83cff641fa61078f2bddbb98262af989c06985a9 Reviewed-on: https://gerrit.libreoffice.org/16193 Reviewed-by: Jacobo Aragunde Pérez <jaragunde@igalia.com> Tested-by: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Diffstat (limited to 'android/source/src')
-rw-r--r--android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java37
-rw-r--r--android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java3
2 files changed, 40 insertions, 0 deletions
diff --git a/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java b/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
new file mode 100644
index 000000000000..bb04855ab95c
--- /dev/null
+++ b/android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java
@@ -0,0 +1,37 @@
+/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+package org.libreoffice.storage;
+
+import org.libreoffice.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+public class DocumentProviderSettingsActivity extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Display the fragment as the main content.
+ getFragmentManager().beginTransaction()
+ .replace(android.R.id.content, new SettingsFragment()).commit();
+ }
+
+ public static class SettingsFragment extends PreferenceFragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.documentprovider_preferences);
+ }
+ }
+}
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 7ac40e4f8049..76842ec77357 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -108,7 +108,10 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa
DocumentProviderFactory.initialize(this);
documentProviderFactory = DocumentProviderFactory.getInstance();
+ PreferenceManager.setDefaultValues(this, R.xml.documentprovider_preferences, false);
+
readPreferences();
+
// init UI and populate with contents from the provider
createUI();
switchToDocumentProvider(documentProviderFactory.getDefaultProvider());