[Libreoffice-commits] core.git: android/source
Jacobo Aragunde Pérez
jaragunde at igalia.com
Wed Jun 10 10:12:47 PDT 2015
android/source/AndroidManifest.xml.in | 8 ++
android/source/res/values/strings.xml | 8 ++
android/source/res/xml/documentprovider_preferences.xml | 26 +++++++
android/source/src/java/org/libreoffice/storage/DocumentProviderSettingsActivity.java | 37 ++++++++++
android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 3
5 files changed, 82 insertions(+)
New commits:
commit d5c9d1dec60085f97eb07402eefcc3fd7a989877
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date: Mon Feb 9 12:37:46 2015 +0100
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 at igalia.com>
Tested-by: Jacobo Aragunde Pérez <jaragunde at igalia.com>
diff --git a/android/source/AndroidManifest.xml.in b/android/source/AndroidManifest.xml.in
index 06b8089..b459182 100644
--- a/android/source/AndroidManifest.xml.in
+++ b/android/source/AndroidManifest.xml.in
@@ -106,6 +106,14 @@
</intent-filter>
</activity>
+ <!-- Document Provider Settings Activity -->
+ <activity android:name=".storage.DocumentProviderSettingsActivity"
+ android:label="@string/storage_provider_settings">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+ </activity>
+
</application>
</manifest>
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index d978413..d2970b2 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -57,4 +57,12 @@
<string name="action_keyboard">Show keyboard</string>
<string name="action_save">Save</string>
+ <!-- Document provider settings -->
+ <string name="storage_provider_settings">Storage provider settings</string>
+ <string name="owncloud_settings">ownCloud settings</string>
+ <string name="server_url">Server URL</string>
+ <string name="server_url_and_port">URL and port of the ownCloud server.</string>
+ <string name="user_name">User name</string>
+ <string name="password">Password</string>
+
</resources>
diff --git a/android/source/res/xml/documentprovider_preferences.xml b/android/source/res/xml/documentprovider_preferences.xml
new file mode 100644
index 0000000..a359d14
--- /dev/null
+++ b/android/source/res/xml/documentprovider_preferences.xml
@@ -0,0 +1,26 @@
+<?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/.
+ -->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <PreferenceCategory
+ android:title="@string/owncloud_settings"
+ android:key="pref_key_owncloud_settings">
+ <EditTextPreference
+ android:key="pref_server_url"
+ android:title="@string/server_url"
+ android:summary="@string/server_url_and_port"
+ android:defaultValue="http://" />
+ <EditTextPreference
+ android:key="pref_user_name"
+ android:title="@string/user_name"
+ android:defaultValue="" />
+ <EditTextPreference
+ android:key="pref_password"
+ android:title="@string/password"
+ android:defaultValue="" />
+ </PreferenceCategory>
+</PreferenceScreen>
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 0000000..bb04855
--- /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 7ac40e4..76842ec 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());
More information about the Libreoffice-commits
mailing list