Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
ruleant committed Jul 7, 2014
2 parents 4916964 + 30adfb3 commit 755fa0c
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.ruleant.getback_gps"
android:versionCode="30"
android:versionName="0.3-dev" >
android:versionName="0.3" >

<uses-sdk
android:minSdkVersion="8"
Expand Down
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v0.3 (not released yet)
v0.3 (released on 07Jul2014)
- CID 60865 : fix Coverity issue : dereference null return value
- CID 60867 : fix Coverity issue : EC: Comparing incompatible types for equality
- CID 60866, 60868 : fix Coverity issue : Casting from integer values
Expand All @@ -12,6 +12,7 @@
- translated to Chinese (Traditional), thanks to Ezjerry Liao
- issue #128 : Draw a compass rose pointing North
- translated to French, thanks to Pierre Barre and an anonymous contributor
- CID 68697 : fix Coverity issue : dereference null return value, when getting package info

v0.2 (released on 26Apr2014)
- issue #112 : update ic_launcher-web.png icon
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.ruleant.getback_gps</groupId>
<artifactId>getback_gps</artifactId>
<version>0.3-dev</version>
<version>0.3</version>
<packaging>apk</packaging>
<name>GetBack GPS</name>
<properties>
Expand Down
4 changes: 2 additions & 2 deletions res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen vo
\n
Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm erhalten haben. Falls nicht, siehe <a href="http://www.gnu.org/licenses/">www.gnu.org/licenses</a>.</string>
<string name="altitude">Höhe</string>
<string name="current_bearing">Aktueller Kurs</string>
<string name="current_bearing">Aktueller Peilung</string>
<string name="pref_header_loc_update">Standort Aktualisierungen</string>
<string name="pref_loc_update_dist">Entfernungsbasierte Aktualisierung</string>
<string name="pref_loc_update_time">Zeitbasierte Aktualisierung</string>
Expand All @@ -73,5 +73,5 @@ Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Prog
<string name="pref_enable_sensors">Sensoren einschalten (falls verfügbar)</string>
<string name="sensors_disabled">Inaktiv : Stromsparend</string>
<string name="pref_geo_orientation_sensor">Standard Orientierungssensor</string>
<string name="sensors_enabled">Aktiv: Schneller aktualisierte und genauere Position</string>
<string name="sensors_enabled">Aktiv: Schneller aktualisierte und genauere Peilung</string>
</resources>
3 changes: 3 additions & 0 deletions res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ Vous devriez avoir reçu une copie de la Licence Générale Publique GNU avec ce
<string name="build_time">Construit sur %s.</string>
<string name="app_website">Visiter le &lt;a href=%1$s&gt;site web&lt;/a&gt; pour plus d\'informations.</string>
<string name="copyright">Droit d\'auteur</string>
<string name="current_bearing">Relèvement actuel</string>
<string name="bearing">Relèvement</string>
<string name="sensors_enabled">Activé : relèvement plus précis et mise à jour plus vite</string>
</resources>
4 changes: 2 additions & 2 deletions res/values/strings_activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

<string-array name="pref_geo_orientation_sensor_titles">
<item>Automatic</item>
<item>Raw sensors (gyroscope, acceleration, compass)</item>
<item>Calculated orientation sensor (deprecated)</item>
<item>Raw sensors (experimental)</item>
<item>Calculated orientation sensor</item>
</string-array>
<string-array name="pref_geo_orientation_sensor_values">
<item>0</item>
Expand Down
2 changes: 1 addition & 1 deletion res/xml/pref_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:key="enable_sensors"
android:title="@string/pref_enable_sensors" />
<ListPreference
android:defaultValue="1"
android:defaultValue="0"
android:entries="@array/pref_geo_orientation_sensor_titles"
android:entryValues="@array/pref_geo_orientation_sensor_values"
android:key="geo_orientation_sensor"
Expand Down
28 changes: 22 additions & 6 deletions src/java/com/github/ruleant/getback_gps/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.os.Build;
Expand Down Expand Up @@ -58,19 +59,15 @@ protected final void onCreate(final Bundle savedInstanceState) {
DateFormat formatter = SimpleDateFormat.getDateTimeInstance();
String versionInfo = res.getString(R.string.app_name);
String buildTime = "";
PackageInfo packageInfo;

try {
packageInfo
= getPackageManager().getPackageInfo(getPackageName(), 0);
PackageInfo packageInfo = getPackageInfo();
if (packageInfo != null) {
versionInfo += " v" + packageInfo.versionName;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
Date date = new Date(packageInfo.lastUpdateTime);
buildTime = String.format(res.getString(R.string.build_time),
formatter.format(date));
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}

// Version text view
Expand Down Expand Up @@ -117,4 +114,23 @@ protected final void onCreate(final Bundle savedInstanceState) {
// enable HTML links
tvLicense.setMovementMethod(LinkMovementMethod.getInstance());
}

/**
* Retrieve Package info (build timestamp, version, ...).
*
* @return Package info
*/
private PackageInfo getPackageInfo() {
PackageManager pm = getPackageManager();
if (pm == null) {
return null;
}

try {
return pm.getPackageInfo(getPackageName(), 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
}
8 changes: 3 additions & 5 deletions src/java/com/github/ruleant/getback_gps/NavigationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public enum NavigationMode {
/**
* Navigation mode.
*/
private NavigationMode mMode;
private NavigationMode mMode = NavigationMode.Disabled;

/**
* Attribute layout_height.
Expand Down Expand Up @@ -361,11 +361,11 @@ public final void onDraw(final Canvas canvas) {
// and mRotationConverter to mArrowLines, mArrowBodyLeft/Right,
// the instances were assigned in init().

// draw circle
// draw circle with diameter scaled to length of compass rose arrow
canvas.drawCircle(
mRotationCenter.getCartesianX(),
mRotationCenter.getCartesianY(),
(getHeight() / 2) * (float) ROSE_LENGTH,
((float) getHeight() / 2) * (float) ROSE_LENGTH,
mPaintRoseLines);

// draw compass rose
Expand Down Expand Up @@ -401,8 +401,6 @@ public final void onDraw(final Canvas canvas) {
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void init() {
mMode = NavigationMode.Disabled;

Resources res = getResources();

// Get the screen's density scale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class SettingsActivity extends PreferenceActivity {

/**
* Default value of preference Default geo orientation sensor :
* raw sensors.
* automatic.
*/
public static final String DEFAULT_PREF_GEO_ORIENTATION_SENSOR = "0";

Expand Down
2 changes: 1 addition & 1 deletion src/java/com/github/ruleant/getback_gps/lib/Navigator.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public enum TravelDirection {
/**
* Detected travel direction.
*/
private TravelDirection mTravelDirection;
private TravelDirection mTravelDirection = TravelDirection.Unknown;

/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ public final void registerEvents(final SensorEventListener listener) {
SettingsActivity.KEY_PREF_GEO_ORIENTATION_SENSOR,
SettingsActivity.DEFAULT_PREF_GEO_ORIENTATION_SENSOR));

// use calculated orientation by default
// (until raw sensor value is stable)
if (sensor == SettingsActivity.GEO_ORIENTATION_SENSOR_CALCULATED
|| sensor == SettingsActivity.GEO_ORIENTATION_SENSOR_AUTO
&& mOrientationSensor != null) {
// orientation sensor is deprecated
mSensorManager.registerListener(
Expand Down

0 comments on commit 755fa0c

Please sign in to comment.