Remove runnable from logic

This commit is contained in:
Vitaliy 2020-05-21 17:26:40 +03:00
parent 9c421464df
commit 9fbdf64cea
2 changed files with 14 additions and 16 deletions

View file

@ -120,21 +120,16 @@ public class SwitchProfileAction extends SwitchableAction<String> {
@Override
public void executeWithParams(final MapActivity activity, final String params) {
final OsmandApplication app = activity.getMyApplication();
app.runInUIThread(new Runnable() {
@Override
public void run() {
ApplicationMode appMode = getModeForKey(params);
if (appMode != null) {
app.getSettings().APPLICATION_MODE.set(appMode);
app.getQuickActionRegistry().setQuickActionFabState(true);
ApplicationMode appMode = getModeForKey(params);
if (appMode != null) {
OsmandApplication app = activity.getMyApplication();
app.getSettings().APPLICATION_MODE.set(appMode);
app.getQuickActionRegistry().setQuickActionFabState(true);
String message = String.format(activity.getString(
R.string.application_profile_changed), appMode.toHumanString());
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
}
}
});
String message = String.format(activity.getString(
R.string.application_profile_changed), appMode.toHumanString());
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
}
}
@Override

View file

@ -210,7 +210,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
*/
public boolean setLayerState(boolean showWidget) {
// check if state change is needed
if (currentWidgetState != null && currentWidgetState == showWidget) {
if (currentWidgetState != null && currentWidgetState == showWidget || isWidgetVisible() == showWidget) {
return false;
}
currentWidgetState = showWidget;
@ -348,7 +348,10 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
double lon = tileBox.getLonFromPixel(rb.getCenterPixelX(), rb.getCenterPixelY());
view.setLatLon(lat, lon);
}
view.setMapPosition(previousMapPosition);
int currentPosition = view.getMapPosition();
if (previousMapPosition != currentPosition && currentPosition == OsmandSettings.MIDDLE_BOTTOM_CONSTANT) {
view.setMapPosition(previousMapPosition);
}
inMovingMarkerMode = false;
mark(View.VISIBLE, R.id.map_ruler_layout,