diff options
-rw-r--r-- | res/drawable/gplv3_icon.png | bin | 0 -> 2986 bytes | |||
-rw-r--r-- | res/layout/about.xml | 68 | ||||
-rw-r--r-- | res/values-fr/strings.xml | 16 | ||||
-rw-r--r-- | res/values/about_style.xml | 29 | ||||
-rw-r--r-- | res/values/constants.xml | 1 | ||||
-rw-r--r-- | res/values/strings.xml | 25 | ||||
-rw-r--r-- | res/xml/pref.xml | 7 | ||||
-rw-r--r-- | src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java | 34 | ||||
-rw-r--r-- | src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java | 1 |
9 files changed, 125 insertions, 56 deletions
diff --git a/res/drawable/gplv3_icon.png b/res/drawable/gplv3_icon.png Binary files differnew file mode 100644 index 0000000..b06e043 --- /dev/null +++ b/res/drawable/gplv3_icon.png 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 8aca5cc..b00db70 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -43,6 +43,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>
@@ -67,4 +69,18 @@ </plurals>
<string name="service_closed_because_connection_problem_notification_title">BlueGps arrêté</string>
<string name="service_closed_because_connection_problem_notification">"Motif : %s"</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 005ff50..6ac5ca9 100644 --- a/res/values/constants.xml +++ b/res/values/constants.xml @@ -30,6 +30,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="defaultConnectionRetries">0</string>
<string name="defaultTrackFileDirectory">/sdcard/nmea</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml index 598677d..62902d3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -46,6 +46,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>
@@ -71,26 +73,17 @@ <string name="service_closed_because_connection_problem_notification_title">BlueGps stopped</string>
<string name="service_closed_because_connection_problem_notification">"Reason: %s"</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 90c48fe..af0cb0c 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"
@@ -80,4 +80,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 76782fc..53037c1 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;
@@ -121,7 +134,7 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer pref.setSummary(s);
Log.v(LOG_TAG, "loc. provider: "+s);
Log.v(LOG_TAG, "loc. provider: "+pref.getSummary());
- }
+ }
this.onContentChanged();
}
@@ -130,18 +143,25 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer super.onDestroy();
sharedPref.unregisterOnSharedPreferenceChangeListener(this);
}
-
+
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);
@@ -155,9 +175,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 = sharedPreferences.getBoolean(key, false);
CheckBoxPreference pref = (CheckBoxPreference)findPreference(key);
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java index 8eccd7f..41ec34e 100644 --- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java +++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java @@ -69,6 +69,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();
|