Updated drawer layout. Fixed compatibility issue

This commit is contained in:
Denis 2014-09-19 17:08:37 +03:00
parent ec64baeda7
commit b4961d3401
4 changed files with 70 additions and 66 deletions

View file

@ -459,7 +459,7 @@ public class MapActivity extends AccessibleActivity {
} }
return true; return true;
} else if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) { } else if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) {
mapActions.openOptionsMenuAsList(); mapActions.openOptionsMenuAsDrawer();
return true; return true;
} else if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) { } else if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) {
Intent newIntent = new Intent(MapActivity.this, getMyApplication().getAppCustomization().getSearchActivity()); Intent newIntent = new Intent(MapActivity.this, getMyApplication().getAppCustomization().getSearchActivity());

View file

@ -3,6 +3,7 @@ package net.osmand.plus.helpers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import android.support.v4.widget.DrawerLayout;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.LocationPoint; import net.osmand.data.LocationPoint;
@ -47,7 +48,7 @@ import android.widget.TextView;
public class WaypointDialogHelper implements OsmAndLocationListener { public class WaypointDialogHelper implements OsmAndLocationListener {
private MapActivity mapActivity; private MapActivity mapActivity;
private OsmandApplication app; private OsmandApplication app;
private FrameLayout mainLayout; private DrawerLayout mainLayout;
private WaypointHelper waypointHelper; private WaypointHelper waypointHelper;
public final static boolean OVERLAP_LAYOUT = true; // only true is supported public final static boolean OVERLAP_LAYOUT = true; // only true is supported
@ -59,7 +60,8 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
this.app = mapActivity.getMyApplication(); this.app = mapActivity.getMyApplication();
waypointHelper = this.app.getWaypointHelper(); waypointHelper = this.app.getWaypointHelper();
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
this.mainLayout = (FrameLayout) ((FrameLayout) mapActivity.getLayout()).getChildAt(0); this.mainLayout = (DrawerLayout) mapActivity.findViewById(R.id.drawer_layout);
} }
public void init() { public void init() {
@ -255,7 +257,9 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
new AsyncTask<Void, Void, Void>() { new AsyncTask<Void, Void, Void>() {
protected void onPreExecute() { protected void onPreExecute() {
}; }
;
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
@ -266,9 +270,11 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
running[0] = -1; running[0] = -1;
listAdapter.clear(); listAdapter.clear();
listAdapter.addAll(getPoints()); for (Object point : getPoints()) {
listAdapter.add(point);
}
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
}; }
}.execute((Void) null); }.execute((Void) null);
} }
@ -492,6 +498,4 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
} }
} }

View file

@ -39,7 +39,7 @@ public class MapMenuControls extends MapControls {
// double lat = activity.getMapView().getLatitude(); // double lat = activity.getMapView().getLatitude();
// double lon = activity.getMapView().getLongitude(); // double lon = activity.getMapView().getLongitude();
// MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon)); // MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon));
mapActivity.getMapActions().openOptionsMenuAsList(); mapActivity.getMapActions().openOptionsMenuAsDrawer();
notifyClicked(); notifyClicked();
} }
}); });

View file

@ -27,7 +27,7 @@ public class SmallMapMenuControls extends MapControls {
public void onClick(View v) { public void onClick(View v) {
notifyClicked(); notifyClicked();
//mapActivity.getMapActions().openOptionsMenuAsDrawer(); //mapActivity.getMapActions().openOptionsMenuAsDrawer();
mapActivity.getMapActions().openOptionsMenuAsList(); mapActivity.getMapActions().openOptionsMenuAsDrawer();
} }
}); });
} }