forked from upstream-mirrors/OpenTracks
merge heads
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
|||||||
import com.google.android.apps.mytracks.content.Track;
|
import com.google.android.apps.mytracks.content.Track;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -93,8 +94,8 @@ public class AggregatedStatsActivity extends Activity implements
|
|||||||
if (item.getItemId() != android.R.id.home) {
|
if (item.getItemId() != android.R.id.home) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
startActivity(new Intent(this, TrackListActivity.class)
|
Intent intent = IntentUtils.newIntent(this, TrackListActivity.class);
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ public class BootReceiver extends BroadcastReceiver {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.d(TAG, "BootReceiver.onReceive: " + intent.getAction());
|
Log.d(TAG, "BootReceiver.onReceive: " + intent.getAction());
|
||||||
if (ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
if (ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||||
Intent startIntent = new Intent(context, TrackRecordingService.class);
|
Intent startIntent = new Intent(context, TrackRecordingService.class)
|
||||||
startIntent.putExtra(RESUME_TRACK_EXTRA_NAME, true);
|
.putExtra(RESUME_TRACK_EXTRA_NAME, true);
|
||||||
context.startService(startIntent);
|
context.startService(startIntent);
|
||||||
|
|
||||||
Intent removeTempFilesIntent = new Intent(context, RemoveTempFilesService.class);
|
Intent removeTempFilesIntent = new Intent(context, RemoveTempFilesService.class);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks;
|
|||||||
import com.google.android.apps.mytracks.ChartValueSeries.ZoomSettings;
|
import com.google.android.apps.mytracks.ChartValueSeries.ZoomSettings;
|
||||||
import com.google.android.apps.mytracks.content.Waypoint;
|
import com.google.android.apps.mytracks.content.Waypoint;
|
||||||
import com.google.android.apps.mytracks.stats.ExtremityMonitor;
|
import com.google.android.apps.mytracks.stats.ExtremityMonitor;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -485,8 +486,7 @@ public class ChartView extends View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nearestWaypoint != null && dmin < 100) {
|
if (nearestWaypoint != null && dmin < 100) {
|
||||||
Intent intent = new Intent(getContext(), MarkerDetailActivity.class)
|
Intent intent = IntentUtils.newIntent(getContext(), MarkerDetailActivity.class)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, nearestWaypoint.getId());
|
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, nearestWaypoint.getId());
|
||||||
getContext().startActivity(intent);
|
getContext().startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks;
|
|||||||
|
|
||||||
import com.google.android.apps.mytracks.fragments.AboutDialogFragment;
|
import com.google.android.apps.mytracks.fragments.AboutDialogFragment;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -60,8 +61,8 @@ public class HelpActivity extends FragmentActivity {
|
|||||||
if (item.getItemId() != android.R.id.home) {
|
if (item.getItemId() != android.R.id.home) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
startActivity(new Intent(this, TrackListActivity.class)
|
Intent intent = IntentUtils.newIntent(this, TrackListActivity.class);
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks;
|
|||||||
|
|
||||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
import com.google.android.apps.mytracks.util.FileUtils;
|
import com.google.android.apps.mytracks.util.FileUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.UriUtils;
|
import com.google.android.apps.mytracks.util.UriUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
@@ -140,8 +141,8 @@ public class ImportActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (!importAll && trackId != -1L) {
|
if (!importAll && trackId != -1L) {
|
||||||
Intent intent = new Intent(ImportActivity.this, TrackDetailActivity.class)
|
Intent intent = IntentUtils.newIntent(
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
ImportActivity.this, TrackDetailActivity.class)
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.content.Waypoint;
|
|||||||
import com.google.android.apps.mytracks.maps.TrackPathPainter;
|
import com.google.android.apps.mytracks.maps.TrackPathPainter;
|
||||||
import com.google.android.apps.mytracks.maps.TrackPathPainterFactory;
|
import com.google.android.apps.mytracks.maps.TrackPathPainterFactory;
|
||||||
import com.google.android.apps.mytracks.maps.TrackPathUtilities;
|
import com.google.android.apps.mytracks.maps.TrackPathUtilities;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.maps.GeoPoint;
|
import com.google.android.maps.GeoPoint;
|
||||||
@@ -442,10 +443,8 @@ public class MapOverlay extends Overlay implements OnSharedPreferenceChangeListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waypoint != null &&
|
if (waypoint != null && dmin < 15000000 / Math.pow(2, mapView.getZoomLevel())) {
|
||||||
dmin < 15000000 / Math.pow(2, mapView.getZoomLevel())) {
|
Intent intent = IntentUtils.newIntent(context, MarkerDetailActivity.class)
|
||||||
Intent intent = new Intent(context, MarkerDetailActivity.class)
|
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, waypoint.getId());
|
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, waypoint.getId());
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.content.Waypoint;
|
|||||||
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.StatsUtils;
|
import com.google.android.apps.mytracks.util.StatsUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
@@ -142,24 +143,26 @@ public class MarkerDetailActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
Intent intent;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
startActivity(new Intent(this, MarkerListActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, MarkerListActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, waypoint.getTrackId());
|
||||||
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, waypoint.getTrackId()));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.marker_detail_show_on_map:
|
case R.id.marker_detail_show_on_map:
|
||||||
startActivity(new Intent(this, TrackDetailActivity.class)
|
intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, markerId));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.marker_detail_edit:
|
case R.id.marker_detail_edit:
|
||||||
startActivity(new Intent(this, MarkerEditActivity.class)
|
intent = IntentUtils.newIntent(this, MarkerEditActivity.class)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(MarkerEditActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(MarkerEditActivity.EXTRA_MARKER_ID, markerId));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.marker_detail_delete:
|
case R.id.marker_detail_delete:
|
||||||
DeleteOneMarkerDialogFragment.newInstance(markerId).show(getSupportFragmentManager(),
|
DeleteOneMarkerDialogFragment.newInstance(markerId, waypoint.getTrackId()).show(
|
||||||
|
getSupportFragmentManager(),
|
||||||
DeleteOneMarkerDialogFragment.DELETE_ONE_MARKER_DIALOG_TAG);
|
DeleteOneMarkerDialogFragment.DELETE_ONE_MARKER_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.content.Waypoint;
|
|||||||
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
||||||
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.ListItemUtil;
|
import com.google.android.apps.mytracks.util.ListItemUtil;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
@@ -124,9 +125,9 @@ public class MarkerListActivity extends FragmentActivity {
|
|||||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
startActivity(new Intent(MarkerListActivity.this, MarkerDetailActivity.class).addFlags(
|
Intent intent = IntentUtils.newIntent(MarkerListActivity.this, MarkerDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, id);
|
||||||
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, id));
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
|
resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
|
||||||
@@ -201,8 +202,8 @@ public class MarkerListActivity extends FragmentActivity {
|
|||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.marker_list_insert_marker:
|
case R.id.marker_list_insert_marker:
|
||||||
startActivity(new Intent(this, MarkerEditActivity.class).addFlags(
|
Intent intent = IntentUtils.newIntent(this, MarkerEditActivity.class);
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.marker_list_search:
|
case R.id.marker_list_search:
|
||||||
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
||||||
@@ -234,19 +235,21 @@ public class MarkerListActivity extends FragmentActivity {
|
|||||||
* @return true if handled.
|
* @return true if handled.
|
||||||
*/
|
*/
|
||||||
private boolean handleContextItem(int itemId, long markerId) {
|
private boolean handleContextItem(int itemId, long markerId) {
|
||||||
|
Intent intent;
|
||||||
switch (itemId) {
|
switch (itemId) {
|
||||||
case R.id.list_context_menu_show_on_map:
|
case R.id.list_context_menu_show_on_map:
|
||||||
startActivity(new Intent(this, TrackDetailActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, markerId));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.list_context_menu_edit:
|
case R.id.list_context_menu_edit:
|
||||||
startActivity(new Intent(this, MarkerEditActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, MarkerEditActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(MarkerEditActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(MarkerEditActivity.EXTRA_MARKER_ID, markerId));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.list_context_menu_delete:
|
case R.id.list_context_menu_delete:
|
||||||
DeleteOneMarkerDialogFragment.newInstance(markerId).show(getSupportFragmentManager(),
|
DeleteOneMarkerDialogFragment.newInstance(markerId, trackId).show(
|
||||||
|
getSupportFragmentManager(),
|
||||||
DeleteOneMarkerDialogFragment.DELETE_ONE_MARKER_DIALOG_TAG);
|
DeleteOneMarkerDialogFragment.DELETE_ONE_MARKER_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ public class MyTracksApplication extends Application {
|
|||||||
ApiAdapterFactory.getApiAdapter().enableStrictMode();
|
ApiAdapterFactory.getApiAdapter().enableStrictMode();
|
||||||
}
|
}
|
||||||
AnalyticsUtils.sendPageViews(this, "/appstart");
|
AnalyticsUtils.sendPageViews(this, "/appstart");
|
||||||
startService(new Intent(this, RemoveTempFilesService.class));
|
Intent intent = new Intent(this, RemoveTempFilesService.class);
|
||||||
|
startService(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.google.android.apps.mytracks.fragments.DeleteOneMarkerDialogFragment;
|
|||||||
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
import com.google.android.apps.mytracks.fragments.DeleteOneTrackDialogFragment;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.ListItemUtil;
|
import com.google.android.apps.mytracks.util.ListItemUtil;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
@@ -138,16 +139,14 @@ public class SearchListActivity extends FragmentActivity {
|
|||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
Map<String, Object> item = arrayAdapter.getItem(position);
|
Map<String, Object> item = arrayAdapter.getItem(position);
|
||||||
Long trackId = (Long) item.get(TRACK_ID_FIELD);
|
Long trackId = (Long) item.get(TRACK_ID_FIELD);
|
||||||
|
Long markerId = (Long) item.get(MARKER_ID_FIELD);
|
||||||
Intent intent;
|
Intent intent;
|
||||||
if (trackId != null) {
|
if (markerId != null) {
|
||||||
intent = new Intent(SearchListActivity.this, TrackDetailActivity.class).addFlags(
|
intent = IntentUtils.newIntent(SearchListActivity.this, TrackDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(SearchListActivity.this, MarkerDetailActivity.class).addFlags(
|
intent = IntentUtils.newIntent(SearchListActivity.this, TrackDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
||||||
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, (Long) item.get(MARKER_ID_FIELD));
|
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
@@ -256,40 +255,37 @@ public class SearchListActivity extends FragmentActivity {
|
|||||||
private boolean handleContextItem(int itemId, int position) {
|
private boolean handleContextItem(int itemId, int position) {
|
||||||
Map<String, Object> item = arrayAdapter.getItem(position);
|
Map<String, Object> item = arrayAdapter.getItem(position);
|
||||||
Long trackId = (Long) item.get(TRACK_ID_FIELD);
|
Long trackId = (Long) item.get(TRACK_ID_FIELD);
|
||||||
|
Long markerId = (Long) item.get(MARKER_ID_FIELD);
|
||||||
Intent intent;
|
Intent intent;
|
||||||
switch (itemId) {
|
switch (itemId) {
|
||||||
case R.id.list_context_menu_show_on_map:
|
case R.id.list_context_menu_show_on_map:
|
||||||
if (trackId != null) {
|
if (markerId != null) {
|
||||||
intent = new Intent(this, TrackDetailActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, (Long) item.get(TRACK_ID_FIELD));
|
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(this, TrackDetailActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
||||||
.putExtra(TrackDetailActivity.EXTRA_MARKER_ID, (Long) item.get(MARKER_ID_FIELD));
|
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.list_context_menu_edit:
|
case R.id.list_context_menu_edit:
|
||||||
if (trackId != null) {
|
if (markerId != null) {
|
||||||
intent = new Intent(this, TrackEditActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, MarkerEditActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(MarkerEditActivity.EXTRA_MARKER_ID, markerId);
|
||||||
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
|
||||||
} else {
|
} else {
|
||||||
intent = new Intent(this, MarkerEditActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, TrackEditActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
||||||
.putExtra(MarkerEditActivity.EXTRA_MARKER_ID, (Long) item.get(MARKER_ID_FIELD));
|
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.list_context_menu_delete:
|
case R.id.list_context_menu_delete:
|
||||||
if (trackId != null) {
|
if (markerId != null) {
|
||||||
DeleteOneTrackDialogFragment.newInstance(trackId).show(getSupportFragmentManager(),
|
DeleteOneMarkerDialogFragment.newInstance(markerId, trackId).show(
|
||||||
DeleteOneTrackDialogFragment.DELETE_ONE_TRACK_DIALOG_TAG);
|
|
||||||
} else {
|
|
||||||
DeleteOneMarkerDialogFragment.newInstance((Long) item.get(MARKER_ID_FIELD)).show(
|
|
||||||
getSupportFragmentManager(),
|
getSupportFragmentManager(),
|
||||||
DeleteOneMarkerDialogFragment.DELETE_ONE_MARKER_DIALOG_TAG);
|
DeleteOneMarkerDialogFragment.DELETE_ONE_MARKER_DIALOG_TAG);
|
||||||
|
} else {
|
||||||
|
DeleteOneTrackDialogFragment.newInstance(trackId).show(getSupportFragmentManager(),
|
||||||
|
DeleteOneTrackDialogFragment.DELETE_ONE_TRACK_DIALOG_TAG);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@@ -337,7 +333,7 @@ public class SearchListActivity extends FragmentActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
arrayAdapter.clear();
|
arrayAdapter.clear();
|
||||||
arrayAdapter.addAll(displayResults);
|
ApiAdapterFactory.getApiAdapter().addAllToArrayAdapter(arrayAdapter, displayResults);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -401,7 +397,7 @@ public class SearchListActivity extends FragmentActivity {
|
|||||||
: getString(R.string.search_list_marker_track_location, trackName));
|
: getString(R.string.search_list_marker_track_location, trackName));
|
||||||
resultMap.put(TOTAL_DISTANCE_FIELD, null);
|
resultMap.put(TOTAL_DISTANCE_FIELD, null);
|
||||||
resultMap.put(DESCRIPTION_FIELD, statistics ? null : waypoint.getDescription());
|
resultMap.put(DESCRIPTION_FIELD, statistics ? null : waypoint.getDescription());
|
||||||
resultMap.put(TRACK_ID_FIELD, null);
|
resultMap.put(TRACK_ID_FIELD, waypoint.getTrackId());
|
||||||
resultMap.put(MARKER_ID_FIELD, waypoint.getId());
|
resultMap.put(MARKER_ID_FIELD, waypoint.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.google.android.apps.mytracks.services.sensors.ant.AntUtils;
|
|||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.BluetoothDeviceUtils;
|
import com.google.android.apps.mytracks.util.BluetoothDeviceUtils;
|
||||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.UnitConversions;
|
import com.google.android.apps.mytracks.util.UnitConversions;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -201,7 +202,9 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
startActivity(new Intent(SettingsActivity.this, RestoreChooserActivity.class));
|
Intent intent = IntentUtils.newIntent(
|
||||||
|
SettingsActivity.this, RestoreChooserActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
@@ -361,22 +364,21 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
: R.string.settings_reset_summary);
|
: R.string.settings_reset_summary);
|
||||||
|
|
||||||
// Add actions to the backup preferences
|
// Add actions to the backup preferences
|
||||||
backupNowPreference.setOnPreferenceClickListener(
|
backupNowPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||||
new OnPreferenceClickListener() {
|
@Override
|
||||||
@Override
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
Intent intent = IntentUtils.newIntent(SettingsActivity.this, BackupActivity.class);
|
||||||
startActivity(new Intent(SettingsActivity.this, BackupActivity.class));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
restoreNowPreference.setOnPreferenceClickListener(
|
restoreNowPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||||
new OnPreferenceClickListener() {
|
@Override
|
||||||
@Override
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
showDialog(DIALOG_CONFIRM_RESTORE_ID);
|
||||||
showDialog(DIALOG_CONFIRM_RESTORE_ID);
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -627,8 +629,8 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
// Restart the settings activity so all changes are loaded.
|
// Restart the settings activity so all changes are loaded.
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent()
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
|||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
import com.google.android.apps.mytracks.util.TrackRecordingServiceConnectionUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -101,15 +102,15 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
* class. Anonymous inner class will get garbage collected.
|
* class. Anonymous inner class will get garbage collected.
|
||||||
*/
|
*/
|
||||||
private final OnSharedPreferenceChangeListener sharedPreferenceChangeListener =
|
private final OnSharedPreferenceChangeListener sharedPreferenceChangeListener =
|
||||||
new OnSharedPreferenceChangeListener() {
|
new OnSharedPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||||
// Note that key can be null
|
// Note that key can be null
|
||||||
if (PreferencesUtils.getRecordingTrackIdKey(TrackDetailActivity.this).equals(key)) {
|
if (PreferencesUtils.getRecordingTrackIdKey(TrackDetailActivity.this).equals(key)) {
|
||||||
updateMenu();
|
updateMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We are not displaying driving directions. Just an arbitrary track that is
|
* We are not displaying driving directions. Just an arbitrary track that is
|
||||||
@@ -260,20 +261,21 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
Intent intent;
|
Intent intent;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
startTrackListActivity();
|
intent = IntentUtils.newIntent(this, TrackListActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_stop_recording:
|
case R.id.track_detail_stop_recording:
|
||||||
updateMenuItems(false);
|
updateMenuItems(false);
|
||||||
TrackRecordingServiceConnectionUtils.stop(this, trackRecordingServiceConnection);
|
TrackRecordingServiceConnectionUtils.stop(this, trackRecordingServiceConnection);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_insert_marker:
|
case R.id.track_detail_insert_marker:
|
||||||
startActivity(new Intent(this, MarkerEditActivity.class)
|
intent = IntentUtils.newIntent(this, MarkerEditActivity.class);
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_play:
|
case R.id.track_detail_play:
|
||||||
if (isEarthInstalled()) {
|
if (isEarthInstalled()) {
|
||||||
AnalyticsUtils.sendPageViews(this, "/action/play");
|
AnalyticsUtils.sendPageViews(this, "/action/play");
|
||||||
intent = new Intent(this, SaveActivity.class)
|
intent = IntentUtils.newIntent(this, SaveActivity.class)
|
||||||
.putExtra(SaveActivity.EXTRA_TRACK_ID, trackId)
|
.putExtra(SaveActivity.EXTRA_TRACK_ID, trackId)
|
||||||
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML)
|
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML)
|
||||||
.putExtra(SaveActivity.EXTRA_PLAY_TRACK, true);
|
.putExtra(SaveActivity.EXTRA_PLAY_TRACK, true);
|
||||||
@@ -284,12 +286,12 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_share_map:
|
case R.id.track_detail_share_map:
|
||||||
intent = new Intent(this, UploadServiceChooserActivity.class)
|
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, true, false, false));
|
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, true, false, false));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_share_fusion_table:
|
case R.id.track_detail_share_fusion_table:
|
||||||
intent = new Intent(this, UploadServiceChooserActivity.class)
|
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, false, true, false));
|
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, false, true, false));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
@@ -306,13 +308,12 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
startSaveActivity(TrackFileFormat.TCX, true);
|
startSaveActivity(TrackFileFormat.TCX, true);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_markers:
|
case R.id.track_detail_markers:
|
||||||
intent = new Intent(this, MarkerListActivity.class)
|
intent = IntentUtils.newIntent(this, MarkerListActivity.class)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, trackId);
|
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, trackId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_send_google:
|
case R.id.track_detail_send_google:
|
||||||
intent = new Intent(this, UploadServiceChooserActivity.class)
|
intent = IntentUtils.newIntent(this, UploadServiceChooserActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, true, true, true));
|
.putExtra(SendRequest.SEND_REQUEST_KEY, new SendRequest(trackId, true, true, true));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
@@ -329,8 +330,9 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
startSaveActivity(TrackFileFormat.TCX, false);
|
startSaveActivity(TrackFileFormat.TCX, false);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_edit:
|
case R.id.track_detail_edit:
|
||||||
startActivity(new Intent(this, TrackEditActivity.class)
|
intent = IntentUtils.newIntent(this, TrackEditActivity.class)
|
||||||
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId));
|
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_delete:
|
case R.id.track_detail_delete:
|
||||||
DeleteOneTrackDialogFragment.newInstance(trackId).show(
|
DeleteOneTrackDialogFragment.newInstance(trackId).show(
|
||||||
@@ -353,13 +355,16 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
getSupportFragmentManager(), ChartSettingsDialogFragment.CHART_SETTINGS_DIALOG_TAG);
|
getSupportFragmentManager(), ChartSettingsDialogFragment.CHART_SETTINGS_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_sensor_state:
|
case R.id.track_detail_sensor_state:
|
||||||
startActivity(new Intent(this, SensorStateActivity.class));
|
intent = IntentUtils.newIntent(this, SensorStateActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_settings:
|
case R.id.track_detail_settings:
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
intent = IntentUtils.newIntent(this, SettingsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_detail_help:
|
case R.id.track_detail_help:
|
||||||
startActivity(new Intent(this, HelpActivity.class));
|
intent = IntentUtils.newIntent(this, HelpActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -411,14 +416,16 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
if (markerId != -1L) {
|
if (markerId != -1L) {
|
||||||
Waypoint waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
|
Waypoint waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
|
||||||
if (waypoint == null) {
|
if (waypoint == null) {
|
||||||
startTrackListActivity();
|
Intent newIntent = IntentUtils.newIntent(this, TrackListActivity.class);
|
||||||
|
startActivity(newIntent);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trackId = waypoint.getTrackId();
|
trackId = waypoint.getTrackId();
|
||||||
}
|
}
|
||||||
if (trackId == -1L) {
|
if (trackId == -1L) {
|
||||||
startTrackListActivity();
|
Intent newIntent = IntentUtils.newIntent(this, TrackListActivity.class);
|
||||||
|
startActivity(newIntent);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -475,14 +482,6 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts the {@link TrackListActivity}.
|
|
||||||
*/
|
|
||||||
private void startTrackListActivity() {
|
|
||||||
startActivity(new Intent(this, TrackListActivity.class)
|
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the {@link SaveActivity} to save a track.
|
* Starts the {@link SaveActivity} to save a track.
|
||||||
*
|
*
|
||||||
@@ -490,7 +489,7 @@ public class TrackDetailActivity extends FragmentActivity {
|
|||||||
* @param shareTrack true to share the track after saving
|
* @param shareTrack true to share the track after saving
|
||||||
*/
|
*/
|
||||||
private void startSaveActivity(TrackFileFormat trackFileFormat, boolean shareTrack) {
|
private void startSaveActivity(TrackFileFormat trackFileFormat, boolean shareTrack) {
|
||||||
Intent intent = new Intent(this, SaveActivity.class)
|
Intent intent = IntentUtils.newIntent(this, SaveActivity.class)
|
||||||
.putExtra(SaveActivity.EXTRA_TRACK_ID, trackId)
|
.putExtra(SaveActivity.EXTRA_TRACK_ID, trackId)
|
||||||
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) trackFileFormat)
|
.putExtra(SaveActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) trackFileFormat)
|
||||||
.putExtra(SaveActivity.EXTRA_SHARE_TRACK, shareTrack);
|
.putExtra(SaveActivity.EXTRA_SHARE_TRACK, shareTrack);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import android.widget.EditText;
|
|||||||
public class TrackEditActivity extends Activity implements OnClickListener {
|
public class TrackEditActivity extends Activity implements OnClickListener {
|
||||||
|
|
||||||
public static final String EXTRA_TRACK_ID = "track_id";
|
public static final String EXTRA_TRACK_ID = "track_id";
|
||||||
public static final String EXTRA_SHOW_CANCEL = "show_cancel";
|
public static final String EXTRA_NEW_TRACK = "new_track";
|
||||||
|
|
||||||
private static final String TAG = TrackEditActivity.class.getSimpleName();
|
private static final String TAG = TrackEditActivity.class.getSimpleName();
|
||||||
|
|
||||||
@@ -92,13 +92,13 @@ public class TrackEditActivity extends Activity implements OnClickListener {
|
|||||||
save.setOnClickListener(this);
|
save.setOnClickListener(this);
|
||||||
|
|
||||||
Button cancel = (Button) findViewById(R.id.track_edit_cancel);
|
Button cancel = (Button) findViewById(R.id.track_edit_cancel);
|
||||||
if (getIntent().getBooleanExtra(EXTRA_SHOW_CANCEL, true)) {
|
if (getIntent().getBooleanExtra(EXTRA_NEW_TRACK, false)) {
|
||||||
|
setTitle(R.string.track_edit_new_track_title);
|
||||||
|
cancel.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
setTitle(R.string.menu_edit);
|
setTitle(R.string.menu_edit);
|
||||||
cancel.setOnClickListener(this);
|
cancel.setOnClickListener(this);
|
||||||
cancel.setVisibility(View.VISIBLE);
|
cancel.setVisibility(View.VISIBLE);
|
||||||
} else {
|
|
||||||
setTitle(R.string.track_edit_new_track_title);
|
|
||||||
cancel.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.google.android.apps.mytracks.services.ITrackRecordingService;
|
|||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.EulaUtils;
|
import com.google.android.apps.mytracks.util.EulaUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.ListItemUtil;
|
import com.google.android.apps.mytracks.util.ListItemUtil;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
@@ -93,7 +94,9 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
try {
|
try {
|
||||||
recordingTrackId = service.startNewTrack();
|
recordingTrackId = service.startNewTrack();
|
||||||
startNewRecording = false;
|
startNewRecording = false;
|
||||||
startTrackDetailActivity(recordingTrackId);
|
Intent intent = IntentUtils.newIntent(TrackListActivity.this, TrackDetailActivity.class)
|
||||||
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
||||||
|
startActivity(intent);
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
TrackListActivity.this, R.string.track_list_record_success, Toast.LENGTH_SHORT).show();
|
TrackListActivity.this, R.string.track_list_record_success, Toast.LENGTH_SHORT).show();
|
||||||
Log.d(TAG, "Started a new recording");
|
Log.d(TAG, "Started a new recording");
|
||||||
@@ -184,7 +187,9 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
startTrackDetailActivity(id);
|
Intent intent = IntentUtils.newIntent(TrackListActivity.this, TrackDetailActivity.class)
|
||||||
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, id);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
|
resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
|
||||||
@@ -329,6 +334,7 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
Intent intent;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.track_list_record_track:
|
case R.id.track_list_record_track:
|
||||||
updateMenuItems(true);
|
updateMenuItems(true);
|
||||||
@@ -341,37 +347,45 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
case R.id.track_list_search:
|
case R.id.track_list_search:
|
||||||
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
|
||||||
case R.id.track_list_import_all:
|
case R.id.track_list_import_all:
|
||||||
startActivity(
|
intent = IntentUtils.newIntent(this, ImportActivity.class)
|
||||||
new Intent(this, ImportActivity.class).putExtra(ImportActivity.EXTRA_IMPORT_ALL, true));
|
.putExtra(ImportActivity.EXTRA_IMPORT_ALL, true);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_gpx:
|
case R.id.track_list_export_gpx:
|
||||||
startActivity(new Intent(this, ExportActivity.class).putExtra(
|
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
||||||
ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.GPX));
|
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.GPX);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_kml:
|
case R.id.track_list_export_kml:
|
||||||
startActivity(new Intent(this, ExportActivity.class).putExtra(
|
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
||||||
ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML));
|
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_csv:
|
case R.id.track_list_export_csv:
|
||||||
startActivity(new Intent(this, ExportActivity.class).putExtra(
|
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
||||||
ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.CSV));
|
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.CSV);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_export_tcx:
|
case R.id.track_list_export_tcx:
|
||||||
startActivity(new Intent(this, ExportActivity.class).putExtra(
|
intent = IntentUtils.newIntent(this, ExportActivity.class)
|
||||||
ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX));
|
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_delete_all:
|
case R.id.track_list_delete_all:
|
||||||
new DeleteAllTrackDialogFragment().show(
|
new DeleteAllTrackDialogFragment().show(
|
||||||
getSupportFragmentManager(), DeleteAllTrackDialogFragment.DELETE_ALL_TRACK_DIALOG_TAG);
|
getSupportFragmentManager(), DeleteAllTrackDialogFragment.DELETE_ALL_TRACK_DIALOG_TAG);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_aggregated_statistics:
|
case R.id.track_list_aggregated_statistics:
|
||||||
startActivity(new Intent(this, AggregatedStatsActivity.class));
|
intent = IntentUtils.newIntent(this, AggregatedStatsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_settings:
|
case R.id.track_list_settings:
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
intent = IntentUtils.newIntent(this, SettingsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.track_list_help:
|
case R.id.track_list_help:
|
||||||
startActivity(new Intent(this, HelpActivity.class));
|
intent = IntentUtils.newIntent(this, HelpActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@@ -403,14 +417,12 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
Intent intent;
|
Intent intent;
|
||||||
switch (itemId) {
|
switch (itemId) {
|
||||||
case R.id.list_context_menu_show_on_map:
|
case R.id.list_context_menu_show_on_map:
|
||||||
intent = new Intent(this, TrackDetailActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
case R.id.list_context_menu_edit:
|
case R.id.list_context_menu_edit:
|
||||||
intent = new Intent(this, TrackEditActivity.class).addFlags(
|
intent = IntentUtils.newIntent(this, TrackEditActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
@@ -423,18 +435,6 @@ public class TrackListActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts {@link TrackDetailActivity}.
|
|
||||||
*
|
|
||||||
* @param trackId the track id.
|
|
||||||
*/
|
|
||||||
private void startTrackDetailActivity(long trackId) {
|
|
||||||
Intent intent = new Intent(TrackListActivity.this, TrackDetailActivity.class)
|
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, trackId);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a new recording.
|
* Starts a new recording.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+7
-3
@@ -20,6 +20,7 @@ import com.google.android.apps.mytracks.MarkerListActivity;
|
|||||||
import com.google.android.apps.mytracks.content.DescriptionGeneratorImpl;
|
import com.google.android.apps.mytracks.content.DescriptionGeneratorImpl;
|
||||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@@ -37,10 +38,12 @@ public class DeleteOneMarkerDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
public static final String DELETE_ONE_MARKER_DIALOG_TAG = "deleteOneMarkerDialog";
|
public static final String DELETE_ONE_MARKER_DIALOG_TAG = "deleteOneMarkerDialog";
|
||||||
private static final String KEY_MARKER_ID = "markerId";
|
private static final String KEY_MARKER_ID = "markerId";
|
||||||
|
private static final String KEY_TRACK_ID = "trackId";
|
||||||
|
|
||||||
public static DeleteOneMarkerDialogFragment newInstance(long markerId) {
|
public static DeleteOneMarkerDialogFragment newInstance(long markerId, long trackId) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putLong(KEY_MARKER_ID, markerId);
|
bundle.putLong(KEY_MARKER_ID, markerId);
|
||||||
|
bundle.putLong(KEY_TRACK_ID, trackId);
|
||||||
|
|
||||||
DeleteOneMarkerDialogFragment deleteOneMarkerDialogFragment = new DeleteOneMarkerDialogFragment();
|
DeleteOneMarkerDialogFragment deleteOneMarkerDialogFragment = new DeleteOneMarkerDialogFragment();
|
||||||
deleteOneMarkerDialogFragment.setArguments(bundle);
|
deleteOneMarkerDialogFragment.setArguments(bundle);
|
||||||
@@ -55,8 +58,9 @@ public class DeleteOneMarkerDialogFragment extends DialogFragment {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
MyTracksProviderUtils.Factory.get(getActivity()).deleteWaypoint(
|
MyTracksProviderUtils.Factory.get(getActivity()).deleteWaypoint(
|
||||||
getArguments().getLong(KEY_MARKER_ID), new DescriptionGeneratorImpl(getActivity()));
|
getArguments().getLong(KEY_MARKER_ID), new DescriptionGeneratorImpl(getActivity()));
|
||||||
startActivity(new Intent(getActivity(), MarkerListActivity.class).addFlags(
|
Intent intent = IntentUtils.newIntent(getActivity(), MarkerListActivity.class)
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
.putExtra(MarkerListActivity.EXTRA_TRACK_ID, getArguments().getLong(KEY_TRACK_ID));
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -19,6 +19,7 @@ package com.google.android.apps.mytracks.fragments;
|
|||||||
import com.google.android.apps.mytracks.TrackListActivity;
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@@ -54,8 +55,8 @@ public class DeleteOneTrackDialogFragment extends DialogFragment {
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
MyTracksProviderUtils.Factory.get(getActivity())
|
MyTracksProviderUtils.Factory.get(getActivity())
|
||||||
.deleteTrack(getArguments().getLong(KEY_TRACK_ID));
|
.deleteTrack(getArguments().getLong(KEY_TRACK_ID));
|
||||||
startActivity(new Intent(getActivity(), TrackListActivity.class).addFlags(
|
Intent intent = IntentUtils.newIntent(getActivity(), TrackListActivity.class);
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -45,7 +45,8 @@ public class InstallEarthDialogFragment extends DialogFragment {
|
|||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
startActivity(new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL)));
|
Intent intent = new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL));
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
|
|||||||
@@ -239,7 +239,8 @@ public class MapFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v == messagePane) {
|
if (v == messagePane) {
|
||||||
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
|
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks.io.backup;
|
|||||||
|
|
||||||
import com.google.android.apps.mytracks.TrackListActivity;
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -93,8 +94,8 @@ public class RestoreActivity extends Activity {
|
|||||||
public void onAsyncTaskCompleted(boolean success, int messageId) {
|
public void onAsyncTaskCompleted(boolean success, int messageId) {
|
||||||
removeDialog(DIALOG_PROGRESS_ID);
|
removeDialog(DIALOG_PROGRESS_ID);
|
||||||
Toast.makeText(this, messageId, success ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
|
Toast.makeText(this, messageId, success ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
|
||||||
startActivity(new Intent(this, TrackListActivity.class)
|
Intent intent = IntentUtils.newIntent(this, TrackListActivity.class);
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.google.android.apps.mytracks.io.backup;
|
package com.google.android.apps.mytracks.io.backup;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.util.FileUtils;
|
import com.google.android.apps.mytracks.util.FileUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
@@ -76,8 +77,9 @@ public class RestoreChooserActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (backupDates.length == 1) {
|
if (backupDates.length == 1) {
|
||||||
startActivity(new Intent(this, RestoreActivity.class)
|
Intent intent = IntentUtils.newIntent(this, RestoreActivity.class)
|
||||||
.putExtra(RestoreActivity.EXTRA_DATE, backupDates[0].getTime()));
|
.putExtra(RestoreActivity.EXTRA_DATE, backupDates[0].getTime());
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -100,8 +102,10 @@ public class RestoreChooserActivity extends Activity {
|
|||||||
.setItems(items, new DialogInterface.OnClickListener() {
|
.setItems(items, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
startActivity(new Intent(RestoreChooserActivity.this, RestoreActivity.class).putExtra(
|
Intent intent = IntentUtils.newIntent(
|
||||||
RestoreActivity.EXTRA_DATE, backupDates[which].getTime()));
|
RestoreChooserActivity.this, RestoreActivity.class)
|
||||||
|
.putExtra(RestoreActivity.EXTRA_DATE, backupDates[which].getTime());
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendActivity;
|
|||||||
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -43,7 +44,7 @@ public class SendDocsActivity extends AbstractSendActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void startNextActivity(boolean success, boolean isCancel) {
|
protected void startNextActivity(boolean success, boolean isCancel) {
|
||||||
sendRequest.setDocsSuccess(success);
|
sendRequest.setDocsSuccess(success);
|
||||||
Intent intent = new Intent(this, UploadResultActivity.class)
|
Intent intent = IntentUtils.newIntent(this, UploadResultActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
+3
-3
@@ -20,6 +20,7 @@ import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendActivity;
|
|||||||
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@@ -45,10 +46,9 @@ public class SendFusionTablesActivity extends AbstractSendActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void startNextActivity(boolean success, boolean isCancel) {
|
protected void startNextActivity(boolean success, boolean isCancel) {
|
||||||
sendRequest.setFusionTablesSuccess(success);
|
sendRequest.setFusionTablesSuccess(success);
|
||||||
|
|
||||||
Class<?> next = getNextClass(sendRequest, isCancel);
|
Class<?> next = getNextClass(sendRequest, isCancel);
|
||||||
|
Intent intent = IntentUtils.newIntent(this, next)
|
||||||
Intent intent = new Intent(this, next).putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks.io.maps;
|
|||||||
import com.google.android.apps.mytracks.io.gdata.maps.MapsMapMetadata;
|
import com.google.android.apps.mytracks.io.gdata.maps.MapsMapMetadata;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||||
import com.google.android.apps.mytracks.util.DialogUtils;
|
import com.google.android.apps.mytracks.util.DialogUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@@ -209,7 +210,7 @@ public class ChooseMapActivity extends Activity {
|
|||||||
*/
|
*/
|
||||||
private void startNextActivity(String mapId) {
|
private void startNextActivity(String mapId) {
|
||||||
sendRequest.setMapId(mapId);
|
sendRequest.setMapId(mapId);
|
||||||
Intent intent = new Intent(this, SendMapsActivity.class)
|
Intent intent = IntentUtils.newIntent(this, SendMapsActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendActivity;
|
|||||||
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
import com.google.android.apps.mytracks.io.sendtogoogle.AbstractSendAsyncTask;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
import com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@@ -47,10 +48,9 @@ public class SendMapsActivity extends AbstractSendActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void startNextActivity(boolean success, boolean isCancel) {
|
protected void startNextActivity(boolean success, boolean isCancel) {
|
||||||
sendRequest.setMapsSuccess(success);
|
sendRequest.setMapsSuccess(success);
|
||||||
|
|
||||||
Class<?> next = getNextClass(sendRequest, isCancel);
|
Class<?> next = getNextClass(sendRequest, isCancel);
|
||||||
|
Intent intent = IntentUtils.newIntent(this, next)
|
||||||
Intent intent = new Intent(this, next).putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -25,6 +25,7 @@ import com.google.android.apps.mytracks.io.gdata.maps.MapsConstants;
|
|||||||
import com.google.android.apps.mytracks.io.maps.ChooseMapActivity;
|
import com.google.android.apps.mytracks.io.maps.ChooseMapActivity;
|
||||||
import com.google.android.apps.mytracks.io.maps.SendMapsActivity;
|
import com.google.android.apps.mytracks.io.maps.SendMapsActivity;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
@@ -294,7 +295,7 @@ public class AccountChooserActivity extends Activity {
|
|||||||
} else {
|
} else {
|
||||||
next = UploadResultActivity.class;
|
next = UploadResultActivity.class;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(this, next)
|
Intent intent = IntentUtils.newIntent(this, next)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
+5
-5
@@ -182,11 +182,11 @@ public class UploadResultActivity extends Activity {
|
|||||||
SharedPreferences prefs = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
SharedPreferences prefs = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
|
||||||
boolean shareUrlOnly = prefs.getBoolean(getString(R.string.share_url_only_key), false);
|
boolean shareUrlOnly = prefs.getBoolean(getString(R.string.share_url_only_key), false);
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
Intent intent = new Intent(Intent.ACTION_SEND)
|
||||||
intent.setType(TEXT_PLAIN_TYPE);
|
.setType(TEXT_PLAIN_TYPE)
|
||||||
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_track_subject));
|
.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_track_subject))
|
||||||
intent.putExtra(Intent.EXTRA_TEXT,
|
.putExtra(Intent.EXTRA_TEXT,
|
||||||
shareUrlOnly ? url : getString(R.string.share_track_url_body_format, url));
|
shareUrlOnly ? url : getString(R.string.share_track_url_body_format, url));
|
||||||
startActivity(Intent.createChooser(intent, getString(R.string.share_track_picker_title)));
|
startActivity(Intent.createChooser(intent, getString(R.string.share_track_picker_title)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -18,6 +18,7 @@ package com.google.android.apps.mytracks.io.sendtogoogle;
|
|||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.Constants;
|
||||||
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
||||||
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ public class UploadServiceChooserActivity extends Activity {
|
|||||||
sendRequest.setSendFusionTables(sendFusionTables());
|
sendRequest.setSendFusionTables(sendFusionTables());
|
||||||
sendRequest.setSendDocs(sendDocs());
|
sendRequest.setSendDocs(sendDocs());
|
||||||
sendRequest.setNewMap(!existingMapRadioButton.isChecked());
|
sendRequest.setNewMap(!existingMapRadioButton.isChecked());
|
||||||
Intent intent = new Intent(this, AccountChooserActivity.class)
|
Intent intent = IntentUtils.newIntent(this, AccountChooserActivity.class)
|
||||||
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.google.android.apps.mytracks.services.tasks.SplitTask;
|
|||||||
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
import com.google.android.apps.mytracks.stats.TripStatisticsBuilder;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.LocationUtils;
|
import com.google.android.apps.mytracks.util.LocationUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -487,11 +488,9 @@ public class TrackRecordingService extends Service {
|
|||||||
Notification notification = new Notification(
|
Notification notification = new Notification(
|
||||||
R.drawable.arrow_320, null /* tickerText */,
|
R.drawable.arrow_320, null /* tickerText */,
|
||||||
System.currentTimeMillis());
|
System.currentTimeMillis());
|
||||||
Intent intent = new Intent(this, TrackDetailActivity.class)
|
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(
|
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
|
||||||
this, 0 /* requestCode */, intent, 0 /* flags */);
|
|
||||||
notification.setLatestEventInfo(this, getString(R.string.my_tracks_app_name),
|
notification.setLatestEventInfo(this, getString(R.string.my_tracks_app_name),
|
||||||
getString(R.string.track_record_notification), contentIntent);
|
getString(R.string.track_record_notification), contentIntent);
|
||||||
notification.flags += Notification.FLAG_NO_CLEAR;
|
notification.flags += Notification.FLAG_NO_CLEAR;
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemLongClickListener;
|
import android.widget.AdapterView.OnItemLongClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.SearchView;
|
import android.widget.SearchView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API level 11 specific implementation of the {@link ApiAdapter}.
|
* API level 11 specific implementation of the {@link ApiAdapter}.
|
||||||
*
|
*
|
||||||
@@ -108,4 +111,9 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
// Returns false to allow the platform to expand the search widget.
|
// Returns false to allow the platform to expand the search widget.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> void addAllToArrayAdapter(ArrayAdapter<T> arrayAdapter, List<T> items) {
|
||||||
|
arrayAdapter.addAll(items);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ import android.content.SharedPreferences.Editor;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API level 7 specific implementation of the {@link ApiAdapter}.
|
* API level 7 specific implementation of the {@link ApiAdapter}.
|
||||||
@@ -132,6 +134,13 @@ public class Api7Adapter implements ApiAdapter {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> void addAllToArrayAdapter(ArrayAdapter<T> arrayAdapter, List<T> items) {
|
||||||
|
for (T item : items) {
|
||||||
|
arrayAdapter.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleSearchKey(MenuItem menuItem) {
|
public boolean handleSearchKey(MenuItem menuItem) {
|
||||||
// Return false and allow the framework to handle the search key.
|
// Return false and allow the framework to handle the search key.
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ import android.bluetooth.BluetoothSocket;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of methods that may be implemented differently depending on the Android
|
* A set of methods that may be implemented differently depending on the Android
|
||||||
@@ -160,6 +162,16 @@ public interface ApiAdapter {
|
|||||||
*/
|
*/
|
||||||
public boolean handleSearchMenuSelection(Activity activity);
|
public boolean handleSearchMenuSelection(Activity activity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds all items to an array adapter.
|
||||||
|
*
|
||||||
|
* Due to changes in API level 11.
|
||||||
|
*s
|
||||||
|
* @param arrayAdapter the array adapter
|
||||||
|
* @param items list of items
|
||||||
|
*/
|
||||||
|
public <T> void addAllToArrayAdapter(ArrayAdapter<T> arrayAdapter, List<T> items);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the search key press. Returns true if handled.
|
* Handles the search key press. Returns true if handled.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Google Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.google.android.apps.mytracks.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities for creating intents.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
public class IntentUtils {
|
||||||
|
|
||||||
|
private IntentUtils() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an intent with {@link Intent#FLAG_ACTIVITY_CLEAR_TOP} and
|
||||||
|
* {@link Intent#FLAG_ACTIVITY_NEW_TASK}.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param cls the class
|
||||||
|
*/
|
||||||
|
public static final Intent newIntent(Context context, Class<?> cls) {
|
||||||
|
return new Intent(context, cls).addFlags(
|
||||||
|
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-3
@@ -106,9 +106,9 @@ public class TrackRecordingServiceConnectionUtils {
|
|||||||
long recordingTrackId = PreferencesUtils.getRecordingTrackId(context);
|
long recordingTrackId = PreferencesUtils.getRecordingTrackId(context);
|
||||||
trackRecordingService.endCurrentTrack();
|
trackRecordingService.endCurrentTrack();
|
||||||
if (recordingTrackId != -1L) {
|
if (recordingTrackId != -1L) {
|
||||||
Intent intent = new Intent(context, TrackEditActivity.class)
|
Intent intent = IntentUtils.newIntent(context, TrackEditActivity.class)
|
||||||
.putExtra(TrackEditActivity.EXTRA_SHOW_CANCEL, false)
|
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, recordingTrackId)
|
||||||
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, recordingTrackId);
|
.putExtra(TrackEditActivity.EXTRA_NEW_TRACK, true);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ import static com.google.android.apps.mytracks.Constants.SETTINGS_NAME;
|
|||||||
import static com.google.android.apps.mytracks.Constants.TAG;
|
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.TrackDetailActivity;
|
import com.google.android.apps.mytracks.TrackDetailActivity;
|
||||||
|
import com.google.android.apps.mytracks.TrackListActivity;
|
||||||
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
|
||||||
import com.google.android.apps.mytracks.content.Track;
|
import com.google.android.apps.mytracks.content.Track;
|
||||||
import com.google.android.apps.mytracks.content.TracksColumns;
|
import com.google.android.apps.mytracks.content.TracksColumns;
|
||||||
import com.google.android.apps.mytracks.services.ControlRecordingService;
|
import com.google.android.apps.mytracks.services.ControlRecordingService;
|
||||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||||
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
import com.google.android.apps.mytracks.util.StringUtils;
|
import com.google.android.apps.mytracks.util.StringUtils;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
@@ -146,10 +148,12 @@ public class TrackWidgetProvider
|
|||||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.track_widget);
|
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.track_widget);
|
||||||
|
|
||||||
// Make all of the stats open the mytracks activity.
|
// Make all of the stats open the mytracks activity.
|
||||||
Intent intent = new Intent(context, TrackDetailActivity.class)
|
Intent intent;
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
if (track != null) {
|
if (track != null) {
|
||||||
intent.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, track.getId());
|
intent = IntentUtils.newIntent(context, TrackDetailActivity.class)
|
||||||
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, track.getId());
|
||||||
|
} else {
|
||||||
|
intent = IntentUtils.newIntent(context, TrackListActivity.class);
|
||||||
}
|
}
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||||
views.setOnClickPendingIntent(R.id.appwidget_track_statistics, pendingIntent);
|
views.setOnClickPendingIntent(R.id.appwidget_track_statistics, pendingIntent);
|
||||||
@@ -190,8 +194,8 @@ public class TrackWidgetProvider
|
|||||||
* @param icon The resource id of the icon to show for the button
|
* @param icon The resource id of the icon to show for the button
|
||||||
*/
|
*/
|
||||||
private void setButtonIntent(RemoteViews views, int action, int icon) {
|
private void setButtonIntent(RemoteViews views, int action, int icon) {
|
||||||
Intent intent = new Intent(context, ControlRecordingService.class);
|
Intent intent = new Intent(context, ControlRecordingService.class)
|
||||||
intent.setAction(context.getString(action));
|
.setAction(context.getString(action));
|
||||||
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
|
PendingIntent pendingIntent = PendingIntent.getService(context, 0,
|
||||||
intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
views.setOnClickPendingIntent(R.id.appwidget_button, pendingIntent);
|
views.setOnClickPendingIntent(R.id.appwidget_button, pendingIntent);
|
||||||
|
|||||||
Reference in New Issue
Block a user