forked from upstream-mirrors/OpenTracks
Merging from head
This commit is contained in:
@@ -17,8 +17,8 @@ limitations under the License.
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.google.android.maps.mytracks"
|
package="com.google.android.maps.mytracks"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionCode="21"
|
android:versionCode="22"
|
||||||
android:versionName="1.0.20">
|
android:versionName="1.0.21">
|
||||||
<application android:icon="@drawable/arrow_icon"
|
<application android:icon="@drawable/arrow_icon"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:backupAgent="com.google.android.apps.mytracks.io.backup.MyTracksBackupAgent">
|
android:backupAgent="com.google.android.apps.mytracks.io.backup.MyTracksBackupAgent">
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -228,7 +227,9 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return trackRecordingService.isRecording();
|
return trackRecordingService.isRecording();
|
||||||
} catch (RemoteException e) {
|
// TODO: We catch Exception, because after eliminating the service process
|
||||||
|
// all exceptions it may throw are no longer wrapped in a RemoteException.
|
||||||
|
} catch (Exception e) {
|
||||||
Log.e(MyTracksConstants.TAG, "MyTracks: Remote exception.", e);
|
Log.e(MyTracksConstants.TAG, "MyTracks: Remote exception.", e);
|
||||||
|
|
||||||
// Fall back to alternative check method.
|
// Fall back to alternative check method.
|
||||||
@@ -405,6 +406,11 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
return dialogManager.onCreateDialog(id, args);
|
return dialogManager.onCreateDialog(id, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Dialog onCreateDialog(int id) {
|
||||||
|
return dialogManager.onCreateDialog(id, null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialog(int id, Dialog dialog) {
|
protected void onPrepareDialog(int id, Dialog dialog) {
|
||||||
super.onPrepareDialog(id, dialog);
|
super.onPrepareDialog(id, dialog);
|
||||||
@@ -908,7 +914,9 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker?");
|
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker?");
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
// TODO: We catch Exception, because after eliminating the service process
|
||||||
|
// all exceptions it may throw are no longer wrapped in a RemoteException.
|
||||||
|
} catch (Exception e) {
|
||||||
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker.", e);
|
Log.e(MyTracksConstants.TAG, "Cannot insert waypoint marker.", e);
|
||||||
@@ -948,7 +956,9 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?");
|
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?");
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
// TODO: We catch Exception, because after eliminating the service process
|
||||||
|
// all exceptions it may throw are no longer wrapped in a RemoteException.
|
||||||
|
} catch (Exception e) {
|
||||||
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
Toast.makeText(this, R.string.error_unable_to_insert_marker,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?", e);
|
Log.e(MyTracksConstants.TAG, "Cannot insert statistics marker?", e);
|
||||||
@@ -1016,7 +1026,9 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
setSelectedTrackId(recordingTrackId);
|
setSelectedTrackId(recordingTrackId);
|
||||||
Toast.makeText(this, getString(R.string.status_now_recording),
|
Toast.makeText(this, getString(R.string.status_now_recording),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
} catch (RemoteException e) {
|
// TODO: We catch Exception, because after eliminating the service process
|
||||||
|
// all exceptions it may throw are no longer wrapped in a RemoteException.
|
||||||
|
} catch (Exception e) {
|
||||||
Toast.makeText(this,
|
Toast.makeText(this,
|
||||||
getString(R.string.error_unable_to_start_recording),
|
getString(R.string.error_unable_to_start_recording),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
@@ -1049,7 +1061,9 @@ public class MyTracks extends TabActivity implements OnTouchListener,
|
|||||||
long currentTrackId = recordingTrackId;
|
long currentTrackId = recordingTrackId;
|
||||||
try {
|
try {
|
||||||
trackRecordingService.endCurrentTrack();
|
trackRecordingService.endCurrentTrack();
|
||||||
} catch (RemoteException e) {
|
// TODO: We catch Exception, because after eliminating the service process
|
||||||
|
// all exceptions it may throw are no longer wrapped in a RemoteException.
|
||||||
|
} catch (Exception e) {
|
||||||
Log.e(MyTracksConstants.TAG, "Unable to stop recording.", e);
|
Log.e(MyTracksConstants.TAG, "Unable to stop recording.", e);
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(MyTracks.this, MyTracksDetails.class);
|
Intent intent = new Intent(MyTracks.this, MyTracksDetails.class);
|
||||||
|
|||||||
@@ -936,21 +936,33 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecording() {
|
public boolean isRecording() {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
return service.isRecording();
|
return service.isRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getRecordingTrackId() {
|
public long getRecordingTrackId() {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
return service.recordingTrackId;
|
return service.recordingTrackId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRecorded() {
|
public boolean hasRecorded() {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
return service.providerUtils.getLastTrackId() >= 0;
|
return service.providerUtils.getLastTrackId() >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long startNewTrack() {
|
public long startNewTrack() {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
return service.startNewTrack();
|
return service.startNewTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,6 +975,9 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long insertWaypointMarker(Waypoint waypoint) {
|
public long insertWaypointMarker(Waypoint waypoint) {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
return service.insertWaypointMarker(waypoint);
|
return service.insertWaypointMarker(waypoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -975,25 +990,36 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long insertStatisticsMarker(Location location) {
|
public long insertStatisticsMarker(Location location) {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
return service.insertStatisticsMarker(location);
|
return service.insertStatisticsMarker(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endCurrentTrack() {
|
public void endCurrentTrack() {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
service.endCurrentTrack();
|
service.endCurrentTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAllTracks() {
|
public void deleteAllTracks() {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
if (isRecording()) {
|
if (isRecording()) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException("Cannot delete all tracks while recording!");
|
||||||
"Cannot delete all tracks while recording!");
|
|
||||||
}
|
}
|
||||||
service.providerUtils.deleteAllTracks();
|
service.providerUtils.deleteAllTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recordLocation(Location loc) {
|
public void recordLocation(Location loc) {
|
||||||
|
if (service == null) {
|
||||||
|
throw new IllegalStateException("The service has been already detached!");
|
||||||
|
}
|
||||||
service.onLocationChanged(loc);
|
service.onLocationChanged(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user