Fix profiles mode stay after drawer closed
Fix constants placing and values
This commit is contained in:
parent
346578ef3e
commit
2c0e889f0e
2 changed files with 11 additions and 12 deletions
|
@ -43,12 +43,14 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static net.osmand.plus.activities.MapActivityActions.PROFILES_CHOSEN_PROFILE_TAG;
|
|
||||||
import static net.osmand.plus.activities.MapActivityActions.PROFILES_CONTROL_BUTTON_TAG;
|
|
||||||
|
|
||||||
public class ContextMenuAdapter {
|
public class ContextMenuAdapter {
|
||||||
private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class);
|
private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class);
|
||||||
|
|
||||||
|
// Constants to determine profiles list item type (drawer menu items in 'Switch profile' mode)
|
||||||
|
public static final int PROFILES_NORMAL_PROFILE_TAG = 0;
|
||||||
|
public static final int PROFILES_CHOSEN_PROFILE_TAG = 1;
|
||||||
|
public static final int PROFILES_CONTROL_BUTTON_TAG = 2;
|
||||||
|
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
private int DEFAULT_LAYOUT_ID = R.layout.list_menu_item_native;
|
private int DEFAULT_LAYOUT_ID = R.layout.list_menu_item_native;
|
||||||
List<ContextMenuItem> items = new ArrayList<>();
|
List<ContextMenuItem> items = new ArrayList<>();
|
||||||
|
|
|
@ -82,6 +82,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CHOSEN_PROFILE_TAG;
|
||||||
|
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CONTROL_BUTTON_TAG;
|
||||||
|
import static net.osmand.plus.ContextMenuAdapter.PROFILES_NORMAL_PROFILE_TAG;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
||||||
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
||||||
|
@ -115,11 +118,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
public static final int REQUEST_LOCATION_FOR_DIRECTIONS_NAVIGATION_PERMISSION = 203;
|
public static final int REQUEST_LOCATION_FOR_DIRECTIONS_NAVIGATION_PERMISSION = 203;
|
||||||
|
|
||||||
// Constants to determine profiles list item type (drawer menu items in 'Switch profile' mode)
|
|
||||||
public static final int PROFILES_NORMAL_PROFILE_TAG = 0;
|
|
||||||
public static final int PROFILES_CHOSEN_PROFILE_TAG = 1;
|
|
||||||
public static final int PROFILES_CONTROL_BUTTON_TAG = 2;
|
|
||||||
|
|
||||||
// Constants for determining the order of items in the additional actions context menu
|
// Constants for determining the order of items in the additional actions context menu
|
||||||
public static final int DIRECTIONS_FROM_ITEM_ORDER = 1000;
|
public static final int DIRECTIONS_FROM_ITEM_ORDER = 1000;
|
||||||
public static final int SEARCH_NEAR_ITEM_ORDER = 2000;
|
public static final int SEARCH_NEAR_ITEM_ORDER = 2000;
|
||||||
|
@ -135,8 +133,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
|
|
||||||
private static final int DIALOG_SAVE_DIRECTIONS = 106;
|
private static final int DIALOG_SAVE_DIRECTIONS = 106;
|
||||||
|
|
||||||
private static final int DRAWER_MODE_NORMAL = 100_000;
|
private static final int DRAWER_MODE_NORMAL = 0;
|
||||||
private static final int DRAWER_MODE_SWITCH_PROFILE = 200_000;
|
private static final int DRAWER_MODE_SWITCH_PROFILE = 1;
|
||||||
|
|
||||||
// make static
|
// make static
|
||||||
private static Bundle dialogBundle = new Bundle();
|
private static Bundle dialogBundle = new Bundle();
|
||||||
|
@ -651,7 +649,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContextMenuAdapter createSwitchProfileOptionsMenu(final OsmandApplication app, ContextMenuAdapter optionsMenuHelper, boolean nightMode) {
|
private ContextMenuAdapter createSwitchProfileOptionsMenu(final OsmandApplication app, ContextMenuAdapter optionsMenuHelper, boolean nightMode) {
|
||||||
|
drawerMode = DRAWER_MODE_NORMAL;
|
||||||
createProfilesController(app, optionsMenuHelper, nightMode, true);
|
createProfilesController(app, optionsMenuHelper, nightMode, true);
|
||||||
|
|
||||||
List<ApplicationMode> activeModes = ApplicationMode.values(app);
|
List<ApplicationMode> activeModes = ApplicationMode.values(app);
|
||||||
|
@ -679,7 +677,6 @@ public class MapActivityActions implements DialogProvider {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
|
||||||
app.getSettings().APPLICATION_MODE.set(appMode);
|
app.getSettings().APPLICATION_MODE.set(appMode);
|
||||||
drawerMode = DRAWER_MODE_NORMAL;
|
|
||||||
updateDrawerMenu();
|
updateDrawerMenu();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue