aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-12-03 01:32:55 +0100
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-12-03 02:20:20 +0100
commit85c4ca20f2138107f51dbb0cc0119280f809d214 (patch)
tree8a710dfa6d56f1f7edf1655f377c440e146e8b66
parentc652ced262a08ade4e1545aeb7904949501e383d (diff)
downloadBlueGPS-85c4ca20f2138107f51dbb0cc0119280f809d214.zip
BlueGPS-85c4ca20f2138107f51dbb0cc0119280f809d214.tar.gz
BlueGPS-85c4ca20f2138107f51dbb0cc0119280f809d214.tar.bz2
add an "About window"
-rw-r--r--res/drawable/gplv3_icon.pngbin0 -> 2986 bytes
-rw-r--r--res/layout/about.xml68
-rw-r--r--res/values-fr/strings.xml16
-rw-r--r--res/values/about_style.xml29
-rw-r--r--res/values/constants.xml1
-rw-r--r--res/values/strings.xml25
-rw-r--r--res/xml/pref.xml7
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java30
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java1
9 files changed, 123 insertions, 54 deletions
diff --git a/res/drawable/gplv3_icon.png b/res/drawable/gplv3_icon.png
new file mode 100644
index 0000000..b06e043
--- /dev/null
+++ b/res/drawable/gplv3_icon.png
Binary files differ
diff --git a/res/layout/about.xml b/res/layout/about.xml
index f74e710..b5b872d 100644
--- a/res/layout/about.xml
+++ b/res/layout/about.xml
@@ -1,4 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2010 Herbert von Broeuschmeul
+ Copyright (C) 2010 BluetoothGPS4Droid Project
+
+ This file is part of BluetoothGPS4Droid.
+
+ BluetoothGPS4Droid 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, either version 3 of the License, or
+ (at your option) any later version.
+
+ BluetoothGPS4Droid 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. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BluetoothGPS4Droid. If not, see : http://www.gnu.org/licenses/.
+-->
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
@@ -17,53 +36,39 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
+ style="@style/about_text"
android:text="@string/about_version"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
+ style="@style/about_text"
android:text="@string/versionName"
/>
</LinearLayout>
+<!--
<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:paddingTop="16sp"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
- android:autoLink="web"
- android:text="@string/about_copyright"
+ style="@style/about_text"
+ android:text="@string/about_copyright_1"
/>
<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:paddingTop="16sp"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
- android:autoLink="web"
+ style="@style/about_text"
+ android:text="@string/about_copyright_2"
+ />
+-->
+ <TextView
+ style="@style/about_text"
android:text="@string/about_app_desc"
/>
<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:paddingTop="16sp"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
- android:autoLink="web"
- android:text="@string/about_license"
+ android:id="@+id/about_license"
+ style="@style/about_text"
+ android:text="@string/about_license"
+ android:autoLink="none"
/>
<TextView
android:id="@+id/about_sources"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:paddingTop="16sp"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
- android:autoLink="web"
+ style="@style/about_text"
android:text="@string/about_sources"
/><!--
<TextView
@@ -75,5 +80,6 @@
android:autoLink="web"
android:text="@string/about"
/>
- --></LinearLayout>
+ -->
+ </LinearLayout>
</ScrollView> \ No newline at end of file
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index e8f08af..98ec99a 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -34,6 +34,8 @@
<string name="pref_trackfile_directory_summary">Indiquer un répertoire pour les fichiers de traces</string>
<string name="pref_bluetooth_device_title">Sélection du GPS</string>
<string name="pref_bluetooth_device_summary">"Périphérique actuel : %s"</string>
+ <string name="pref_about_title">À propos</string>
+ <string name="pref_about_summary"></string>
<string name="msg_gps_provider_started">GPS Bluetooth... démarré</string>
<string name="msg_gps_provider_stopped">GPS Bluetooth... arrêté</string>
@@ -49,4 +51,18 @@
<string name="foreground_service_started_notification_title">BlueGps</string>
<string name="foreground_gps_provider_started_notification">GPS Bluetooth démarré.</string>
<string name="foreground_nmea_recording_started_notification">Enregistrement des données NMEA en cours.</string>
+
+ <string name="about_title">À propos</string>
+ <string name="about_version">BluetoothGPS4Droid version</string>
+ <string name="about_copyright_1">Copyright (C) 2010 Herbert von Broeuschmeul</string>
+ <string name="about_copyright_2">Copyright (C) 2010 BluetoothGPS4Droid Project</string>
+ <string name="about_app_desc">Bluetooth GPS for Android est une application
+ qui permet d\'utiliser un GPS bluetooth externe avec un terminal Android.
+ </string>
+ <string name="about_license">Il s\'agit d\'un logiciel libre
+ distribué gratuitement et régi par la <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html"><b>Licence publique générale de GNU</b></a>.
+ </string>
+ <string name="about_sources">Le code source est librement téléchargeable à partir du dépot Git sur le site web du projet :
+ http://sourceforge.net/p/bluegps4droid
+ </string>
</resources>
diff --git a/res/values/about_style.xml b/res/values/about_style.xml
new file mode 100644
index 0000000..1555525
--- /dev/null
+++ b/res/values/about_style.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2010 Herbert von Broeuschmeul
+ Copyright (C) 2010 BluetoothGPS4Droid Project
+
+ This file is part of BluetoothGPS4Droid.
+
+ BluetoothGPS4Droid 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, either version 3 of the License, or
+ (at your option) any later version.
+
+ BluetoothGPS4Droid 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. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BluetoothGPS4Droid. If not, see : http://www.gnu.org/licenses/.
+-->
+<resources xmlns:android="http://schemas.android.com/apk/res/android" >
+ <style name="about_text" >
+ <item name="android:layout_width">fill_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:padding">4sp</item>
+ <item name="android:textAppearance">?android:attr/textAppearance</item>
+ <item name="android:autoLink">web</item>
+ </style>
+</resources>
diff --git a/res/values/constants.xml b/res/values/constants.xml
index 7eb25f0..f0abbff 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -26,6 +26,7 @@
<string name="pref_trackfile_directory_key">trackFileDirectory</string>
<string name="pref_trackfile_prefix_key">trackFilePrefix</string>
<string name="pref_bluetooth_device_key">bluetoothDevice</string>
+ <string name="pref_about_key">about</string>
<string name="defaultTrackFileDirectory">/sdcard/nmea</string>
<string name="defaultTrackFilePrefix">btnmeatrack</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c800a6c..808b330 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -34,6 +34,8 @@
<string name="pref_trackfile_directory_summary">Select the directory for the track files</string>
<string name="pref_bluetooth_device_title">Choose Bluetooth GPS</string>
<string name="pref_bluetooth_device_summary">"Current device: %s"</string>
+ <string name="pref_about_title">About</string>
+ <string name="pref_about_summary"></string>
<string name="msg_gps_provider_started">Bluetooth GPS... started</string>
<string name="msg_gps_provider_stopped">Bluetooth GPS... stopped</string>
@@ -50,26 +52,17 @@
<string name="foreground_gps_provider_started_notification">BlueGps service started</string>
<string name="foreground_nmea_recording_started_notification">BlueGps NMEA recording service started</string>
- <string name="aboutTitle">About</string>
- <string name="about_version">BlueGPS4Droid version </string>
- <string name="about_copyright">Copyright (C) 2010 Herbert von Broeuschmeul
- \n\nCopyright (C) 2010 BluetoothGPS4Droid Project
- </string>
+ <string name="about_title">About</string>
+ <string name="about_version">BluetoothGPS4Droid version</string>
+ <string name="about_copyright_1">Copyright (C) 2010 Herbert von Broeuschmeul</string>
+ <string name="about_copyright_2">Copyright (C) 2010 BluetoothGPS4Droid Project</string>
<string name="about_app_desc">Bluetooth GPS for Android is an application
for using an external bluetooth GPS on Android devices.
</string>
- <string name="about_license">BluetoothGPS4Droid (BlueGPS4Droid) is open source software
- distributed free of charge under the terms of the <b>GNU General Public License</b>.
- </string>
- <string name="about_sources">The source code is available from the project\'s Git repository:
- http://sourceforge.net/p/bluegps4droid
+ <string name="about_license">It is open source software
+ distributed free of charge under the terms of the <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html"><b>GNU General Public License</b></a>.
</string>
- <string name="about">Copyright (C) 2010 Herbert von Broeuschmeul
- \n\nCopyright (C) 2010 BluetoothGPS4Droid Project
- \n\nBluetooth GPS for Android is an application for using an external bluetooth GPS on Android devices.
- \n\nBluetoothGPS4Droid (BlueGPS4Droid) is open source software distributed free of charge under the terms of
- the <b>GNU General Public License</b>.
- \n\nThe source code is available from the project\'s Git repository:
+ <string name="about_sources">The source code is available from Git repository on the project website:
http://sourceforge.net/p/bluegps4droid
</string>
</resources>
diff --git a/res/xml/pref.xml b/res/xml/pref.xml
index 92b0838..e49a4a7 100644
--- a/res/xml/pref.xml
+++ b/res/xml/pref.xml
@@ -20,7 +20,7 @@
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
- android:title="@string/app_name">
+ android:title="@string/app_name" >
<ListPreference
android:dialogTitle="@string/pref_bluetooth_device_title"
android:title="@string/pref_bluetooth_device_title"
@@ -54,4 +54,9 @@
android:defaultValue="@string/defaultTrackFilePrefix"
android:summary="@string/pref_trackfile_prefix_summary" />
</PreferenceScreen>
+ <Preference
+ android:key="@string/pref_about_key"
+ android:persistent="false"
+ android:title="@string/pref_about_title"
+ android:summary="@string/pref_about_summary" />
</PreferenceScreen>
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index 1c1eac3..5665aa6 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -20,6 +20,7 @@
package org.broeuschmeul.android.gps.bluetooth.provider;
+import java.util.HashSet;
import java.util.Set;
import android.app.AlertDialog;
@@ -35,6 +36,7 @@ import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.Preference.OnPreferenceChangeListener;
+import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
@@ -61,6 +63,14 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
sharedPref.registerOnSharedPreferenceChangeListener(this);
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ Preference pref = findPreference(BluetoothGpsProviderService.PREF_ABOUT);
+ pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ BluetoothGpsActivity.this.displayAboutDialog();
+ return true;
+ }
+ });
}
/* (non-Javadoc)
@@ -88,7 +98,10 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
updateDevicePreferenceSummary();
// update bluetooth device list
ListPreference prefDevices = (ListPreference)findPreference(BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE);
- Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
+ Set<BluetoothDevice> pairedDevices = new HashSet<BluetoothDevice>();
+ if (bluetoothAdapter != null){
+ pairedDevices = bluetoothAdapter.getBondedDevices();
+ }
String[] entryValues = new String[pairedDevices.size()];
String[] entries = new String[pairedDevices.size()];
int i = 0;
@@ -112,15 +125,22 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
private void displayAboutDialog(){
View messageView = getLayoutInflater().inflate(R.layout.about, null, false);
+ // we need this to enable html links
+ TextView textView = (TextView) messageView.findViewById(R.id.about_license);
+ textView.setMovementMethod(LinkMovementMethod.getInstance());
// When linking text, force to always use default color. This works
// around a pressed color state bug.
- TextView textView = (TextView) messageView.findViewById(R.id.about_sources);
int defaultColor = textView.getTextColors().getDefaultColor();
textView.setTextColor(defaultColor);
+ textView = (TextView) messageView.findViewById(R.id.about_sources);
+ textView.setTextColor(defaultColor);
+
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.aboutTitle);
+ builder.setTitle(R.string.about_title);
+ builder.setIcon(R.drawable.gplv3_icon);
builder.setView(messageView);
+
// CharSequence styledText = Html.fromHtml(getString(R.string.about));
// builder.setMessage(R.string.about);
// builder.setMessage(styledText);
@@ -134,9 +154,7 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
}
@Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
- String key) {
- displayAboutDialog();
+ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (BluetoothGpsProviderService.PREF_START_GPS_PROVIDER.equals(key)){
boolean val = false;
if (val = sharedPreferences.getBoolean(key, false)){
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 242e30a..4f322c0 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -66,6 +66,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String PREF_TRACK_FILE_DIR = "trackFileDirectory";
public static final String PREF_TRACK_FILE_PREFIX = "trackFilePrefix";
public static final String PREF_BLUETOOTH_DEVICE = "bluetoothDevice";
+ public static final String PREF_ABOUT = "about";
private static final String LOG_TAG = "BlueGPS";
// private static final String LOG_TAG = BluetoothGpsProviderService.class.getSimpleName();