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;
|
||||
private WaypointDialogHelper waypointDialogHelper;
|
||||
|
||||
private enum DrawerType{
|
||||
WAYPOINTS,
|
||||
CONFIGURE_MAP,
|
||||
MAIN_MENU
|
||||
}
|
||||
|
||||
private DrawerType currentDrawer;
|
||||
|
||||
public MapActivityActions(MapActivity mapActivity){
|
||||
this.mapActivity = mapActivity;
|
||||
|
@ -571,9 +578,13 @@ public class MapActivityActions implements DialogProvider {
|
|||
//need to refresh drawer if it
|
||||
//was opened with slide, not button
|
||||
if (mDrawerList != null && refreshDrawer){
|
||||
if (currentDrawer == DrawerType.WAYPOINTS){
|
||||
showWaypointsInDrawer(false);
|
||||
} else {
|
||||
mDrawerList.invalidateViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerClosed(View view) {
|
||||
|
@ -591,10 +602,10 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public void prepareOptionsMenu(final ContextMenuAdapter cm) {
|
||||
refreshDrawer = false;
|
||||
final ArrayAdapter<?> listAdapter =
|
||||
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||
mDrawerList.setAdapter(listAdapter);
|
||||
refreshDrawer = false;
|
||||
mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider));
|
||||
final int colorHint = cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu());
|
||||
mDrawerList.setBackgroundColor(colorHint);
|
||||
|
@ -642,6 +653,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
final OsmandMapTileView mapView = mapActivity.getMapView();
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter(app);
|
||||
currentDrawer = DrawerType.MAIN_MENU;
|
||||
|
||||
// 1. Where am I
|
||||
optionsMenuHelper.item(R.string.where_am_i).
|
||||
|
@ -799,6 +811,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
currentDrawer = DrawerType.CONFIGURE_MAP;
|
||||
ContextMenuAdapter cm = mapActivity.getMapLayers().getMapInfoLayer().getViewConfigureMenuAdapter();
|
||||
prepareOptionsMenu(cm);
|
||||
return false;
|
||||
|
@ -884,6 +897,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public void showWaypointsInDrawer(boolean flat) {
|
||||
currentDrawer = DrawerType.WAYPOINTS;
|
||||
final int[] running = new int[] { -1 };
|
||||
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(mapActivity, running, flat);
|
||||
mDrawerList.setAdapter(listAdapter);
|
||||
|
|
Loading…
Reference in a new issue