Merge pull request #936 from Bars107/drawer
Waypoints will now be updated when user reopens drawer with finger
This commit is contained in:
commit
30be8d1e05
1 changed files with 17 additions and 3 deletions
|
@ -92,6 +92,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
ListView mDrawerList;
|
ListView mDrawerList;
|
||||||
private WaypointDialogHelper waypointDialogHelper;
|
private WaypointDialogHelper waypointDialogHelper;
|
||||||
|
|
||||||
|
private enum DrawerType{
|
||||||
|
WAYPOINTS,
|
||||||
|
CONFIGURE_MAP,
|
||||||
|
MAIN_MENU
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrawerType currentDrawer;
|
||||||
|
|
||||||
public MapActivityActions(MapActivity mapActivity){
|
public MapActivityActions(MapActivity mapActivity){
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
@ -571,9 +578,13 @@ public class MapActivityActions implements DialogProvider {
|
||||||
//need to refresh drawer if it
|
//need to refresh drawer if it
|
||||||
//was opened with slide, not button
|
//was opened with slide, not button
|
||||||
if (mDrawerList != null && refreshDrawer){
|
if (mDrawerList != null && refreshDrawer){
|
||||||
|
if (currentDrawer == DrawerType.WAYPOINTS){
|
||||||
|
showWaypointsInDrawer(false);
|
||||||
|
} else {
|
||||||
mDrawerList.invalidateViews();
|
mDrawerList.invalidateViews();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDrawerClosed(View view) {
|
public void onDrawerClosed(View view) {
|
||||||
|
@ -591,10 +602,10 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareOptionsMenu(final ContextMenuAdapter cm) {
|
public void prepareOptionsMenu(final ContextMenuAdapter cm) {
|
||||||
|
refreshDrawer = false;
|
||||||
final ArrayAdapter<?> listAdapter =
|
final ArrayAdapter<?> listAdapter =
|
||||||
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||||
mDrawerList.setAdapter(listAdapter);
|
mDrawerList.setAdapter(listAdapter);
|
||||||
refreshDrawer = false;
|
|
||||||
mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider));
|
mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider));
|
||||||
final int colorHint = cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
final int colorHint = cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||||
mDrawerList.setBackgroundColor(colorHint);
|
mDrawerList.setBackgroundColor(colorHint);
|
||||||
|
@ -642,6 +653,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||||
|
currentDrawer = DrawerType.MAIN_MENU;
|
||||||
|
|
||||||
// 1. Where am I
|
// 1. Where am I
|
||||||
optionsMenuHelper.item(R.string.where_am_i).
|
optionsMenuHelper.item(R.string.where_am_i).
|
||||||
|
@ -799,6 +811,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.listen(new OnContextMenuClick() {
|
.listen(new OnContextMenuClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||||
|
currentDrawer = DrawerType.CONFIGURE_MAP;
|
||||||
ContextMenuAdapter cm = mapActivity.getMapLayers().getMapInfoLayer().getViewConfigureMenuAdapter();
|
ContextMenuAdapter cm = mapActivity.getMapLayers().getMapInfoLayer().getViewConfigureMenuAdapter();
|
||||||
prepareOptionsMenu(cm);
|
prepareOptionsMenu(cm);
|
||||||
return false;
|
return false;
|
||||||
|
@ -884,6 +897,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showWaypointsInDrawer(boolean flat) {
|
public void showWaypointsInDrawer(boolean flat) {
|
||||||
|
currentDrawer = DrawerType.WAYPOINTS;
|
||||||
final int[] running = new int[] { -1 };
|
final int[] running = new int[] { -1 };
|
||||||
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(mapActivity, running, flat);
|
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(mapActivity, running, flat);
|
||||||
mDrawerList.setAdapter(listAdapter);
|
mDrawerList.setAdapter(listAdapter);
|
||||||
|
|
Loading…
Reference in a new issue