openlp-android team mailing list archive
-
openlp-android team
-
Mailing list archive
-
Message #00146
[Merge] lp:~trb143/openlp/android_05 into lp:openlp/android
Tim Bentley has proposed merging lp:~trb143/openlp/android_05 into lp:openlp/android.
Requested reviews:
OpenLP Android Developers (openlp-android)
For more details, see:
https://code.launchpad.net/~trb143/openlp/android_05/+merge/106445
About dialogue in preferences
--
https://code.launchpad.net/~trb143/openlp/android_05/+merge/106445
Your team OpenLP Android Developers is requested to review the proposed merge of lp:~trb143/openlp/android_05 into lp:openlp/android.
=== modified file 'AndroidManifest.xml'
--- AndroidManifest.xml 2012-05-05 17:29:57 +0000
+++ AndroidManifest.xml 2012-05-18 18:09:19 +0000
@@ -34,7 +34,7 @@
<activity android:name=".activity.Preferences" android:label="@string/preferences"/>
<activity android:name=".activity.PagerActivity"/>
- <service android:name=".service.PingIntent"/>
+ <service android:name=".service.PingIntent"/>
<service android:name=".service.ApiCallIntent"/>
<meta-data
=== modified file 'OpenLP.apk'
Binary files OpenLP.apk 2012-05-06 15:53:56 +0000 and OpenLP.apk 2012-05-18 18:09:19 +0000 differ
=== modified file 'res/values/strings.xml'
--- res/values/strings.xml 2012-05-05 17:29:57 +0000
+++ res/values/strings.xml 2012-05-18 18:09:19 +0000
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <string name="about">About</string>
+ <string name="about_text">Version</string>
+ <string name="about_display_1">OpenLP is free church presentation software. Find out more about OpenLP.</string>
+ <string name="about_display_3">Website</string>
+ <string name="about_display_4">Copyright</string>
+ <string name="about_display_5">Portions copyright</string>
+ <string name="about_display_6">License</string>
+ <string name="about_display_7">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.</string>
+ <string name="about_display_8">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</string>
<string name="app_name">OpenLP</string>
<string name="settings">Settings</string>
<string name="preferences">Preferences</string>
=== modified file 'src/org/openlp/android/activity/Preferences.java'
--- src/org/openlp/android/activity/Preferences.java 2012-05-05 17:29:57 +0000
+++ src/org/openlp/android/activity/Preferences.java 2012-05-18 18:09:19 +0000
@@ -20,30 +20,107 @@
*******************************************************************************/
package org.openlp.android.activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.net.Uri;
import android.os.Bundle;
-import android.preference.PreferenceActivity;
+import android.preference.*;
import android.util.Log;
import org.openlp.android.R;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
/**
* Credits: http://www.kaloer.com/android-preferences
* http://androidpartaker.wordpress.com/2010/07/11/android-preferences/
*/
public class Preferences extends PreferenceActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Log.d(LOG_TAG, "Launching preferences");
- getPreferenceManager().setSharedPreferencesName(
- getString(R.string.keySharedPreferences));
- addPreferencesFromResource(R.xml.preferences);
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- Log.d(LOG_TAG, "Destroying preferences");
- }
-
- private final String LOG_TAG = Preferences.class.getName();
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.d(LOG_TAG, "Launching preferences");
+ getPreferenceManager().setSharedPreferencesName(
+ getString(R.string.keySharedPreferences));
+ addPreferencesFromResource(R.xml.preferences);
+
+ PackageManager manager = this.getPackageManager();
+ String version = "";
+ try {
+ PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
+ version = info.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ // Nop as version defined
+ }
+ Date date = new Date();
+ SimpleDateFormat simpleDateformat = new SimpleDateFormat("yyyy");
+
+ /* Preferences time! (we build the preferences) */
+ Preference about = getPreference(getResources().getString(R.string.about_text), version, null);
+ Preference openlpLink = getPreference(getResources().getString(R.string.about_display_3), getResources().getString(R.string.about_display_1), new Intent(Intent.ACTION_VIEW, Uri.parse("http://openlp.org/")));
+
+ StringBuffer html = new StringBuffer();
+ html.append(getResources().getString(R.string.about_display_4));
+ html.append(" © 2004-");
+ html.append(simpleDateformat.format(date));
+ html.append(" Raoul Snyman\n");
+ html.append(getResources().getString(R.string.about_display_5));
+ html.append(" © 2004-");
+ html.append(simpleDateformat.format(date));
+ html.append("\nTim Bentley, Johan Mynhardt, Samuel Sjöbergsson");
+ Preference copyright = getPreference(getResources().getString(R.string.about_display_4), html.toString(), null);
+
+ DialogPreference license = new MyDialogPreference(this, getResources().getString(R.string.about_display_6), getResources().getString(R.string.about_display_7) + "\n" + getResources().getString(R.string.about_display_8));
+
+ PreferenceScreen preferenceScreen = getPreferenceScreen();
+ addPreferenceCategory(preferenceScreen, getResources().getString(R.string.about), about, openlpLink, copyright, license);
+ this.setPreferenceScreen(preferenceScreen);
+ }
+
+ private boolean addPreferenceCategory(PreferenceScreen preferenceScreen,
+ String titleCategory, Preference... preferences) {
+ boolean addPreference = false;
+ for (Preference preference : preferences) {
+ if (preference != null)
+ addPreference = true;
+ }
+ if (addPreference) {
+ PreferenceCategory preferenceCategory = new PreferenceCategory(this);
+ preferenceCategory.setTitle(titleCategory);
+ preferenceScreen.addPreference(preferenceCategory);
+ for (Preference preference : preferences) {
+ if (preference != null)
+ preferenceCategory.addPreference(preference);
+ }
+ return true;
+ } else
+ return false;
+ }
+
+ private Preference getPreference(String title, String summary, Intent intent) {
+ Preference pref = new Preference(this);
+ pref.setTitle(title);
+ pref.setSummary(summary);
+ if (intent != null)
+ pref.setIntent(intent);
+ return pref;
+ }
+
+ public class MyDialogPreference extends DialogPreference {
+ public MyDialogPreference(Context context, String title, String text) {
+ super(context, null);
+ this.setTitle(title);
+ this.setDialogMessage(text);
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Log.d(LOG_TAG, "Destroying preferences");
+ }
+
+ private final String LOG_TAG = Preferences.class.getName();
}
=== modified file 'src/org/openlp/android/service/ApiCallIntent.java'
--- src/org/openlp/android/service/ApiCallIntent.java 2012-05-06 15:53:56 +0000
+++ src/org/openlp/android/service/ApiCallIntent.java 2012-05-18 18:09:19 +0000
@@ -34,8 +34,8 @@
import java.net.URISyntaxException;
/**
- * The purpose of this class is to provide a service that is separate from the UI, and assist in fetching informatin from
- * a server.
+ * The purpose of this class is to provide a service that is separate from the UI, and assist in fetching information
+ * from an OpenLP server.
*/
public class ApiCallIntent extends IntentService implements SearchService {
public static final String API_CALL_RECEIVE =
Follow ups