Press on the favorite - open favorite on map
This commit is contained in:
parent
04d28c9577
commit
efde6d74a5
2 changed files with 27 additions and 1 deletions
|
@ -73,6 +73,15 @@ public class DashboardActivity extends SherlockFragmentActivity {
|
||||||
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
|
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
|
||||||
label.setText(distance, TextView.BufferType.SPANNABLE);
|
label.setText(distance, TextView.BufferType.SPANNABLE);
|
||||||
label.setTypeface(Typeface.DEFAULT, model.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
label.setTypeface(Typeface.DEFAULT, model.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
||||||
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent mapIndent = new Intent(DashboardActivity.this, getMyApplication().getAppCustomization().getMapActivity());
|
||||||
|
mapIndent.putExtra(MapActivity.START_LAT, model.getLatitude());
|
||||||
|
mapIndent.putExtra(MapActivity.START_LON, model.getLongitude());
|
||||||
|
startActivityForResult(mapIndent, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
favorites.addView(view);
|
favorites.addView(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,9 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class MapActivity extends AccessibleActivity implements
|
public class MapActivity extends AccessibleActivity implements
|
||||||
VoiceRouter.VoiceMessageListener {
|
VoiceRouter.VoiceMessageListener {
|
||||||
|
|
||||||
|
public static final String START_LAT = "START_LAT";
|
||||||
|
public static final String START_LON = "START_LON";
|
||||||
|
|
||||||
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||||
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
||||||
|
@ -116,6 +119,7 @@ public class MapActivity extends AccessibleActivity implements
|
||||||
private KeyguardManager.KeyguardLock keyguardLock = null;
|
private KeyguardManager.KeyguardLock keyguardLock = null;
|
||||||
private ReleaseWakeLocksRunnable releaseWakeLocksRunnable = new ReleaseWakeLocksRunnable();
|
private ReleaseWakeLocksRunnable releaseWakeLocksRunnable = new ReleaseWakeLocksRunnable();
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
private boolean intentLocation = false;
|
||||||
|
|
||||||
private Notification getNotification() {
|
private Notification getNotification() {
|
||||||
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
|
||||||
|
@ -222,6 +226,17 @@ public class MapActivity extends AccessibleActivity implements
|
||||||
gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView());
|
gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView());
|
||||||
|
|
||||||
mapActions.prepareStartOptionsMenu();
|
mapActions.prepareStartOptionsMenu();
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null && intent.getExtras() != null) {
|
||||||
|
double lat = intent.getExtras().getDouble(START_LAT);
|
||||||
|
double lon = intent.getExtras().getDouble(START_LON);
|
||||||
|
if(lat != 0 && lon != 0){
|
||||||
|
mapView.setLatLon(lat, lon);
|
||||||
|
mapView.setIntZoom(14);
|
||||||
|
intentLocation = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLockView(FrameLayout lockView) {
|
public void addLockView(FrameLayout lockView) {
|
||||||
|
@ -341,10 +356,12 @@ public class MapActivity extends AccessibleActivity implements
|
||||||
}
|
}
|
||||||
app.getLocationProvider().resumeAllUpdates();
|
app.getLocationProvider().resumeAllUpdates();
|
||||||
|
|
||||||
if (settings != null && settings.isLastKnownMapLocation()) {
|
if (settings != null && settings.isLastKnownMapLocation() && !intentLocation) {
|
||||||
LatLon l = settings.getLastKnownMapLocation();
|
LatLon l = settings.getLastKnownMapLocation();
|
||||||
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
||||||
mapView.setIntZoom(settings.getLastKnownMapZoom());
|
mapView.setIntZoom(settings.getLastKnownMapZoom());
|
||||||
|
} else {
|
||||||
|
intentLocation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.MAP_ACTIVITY_ENABLED.set(true);
|
settings.MAP_ACTIVITY_ENABLED.set(true);
|
||||||
|
|
Loading…
Reference in a new issue