Single choice/multi choice dialog finalized.
This commit is contained in:
parent
642975818f
commit
a3fcd8e124
2 changed files with 24 additions and 43 deletions
|
@ -3,10 +3,12 @@ package net.osmand.plus.activities;
|
|||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -260,7 +262,7 @@ public class MapActivityLayers {
|
|||
|
||||
|
||||
public void showMultichoicePoiFilterDialog(final OsmandMapTileView mapView, final ConfirmListener listener) {
|
||||
OsmandApplication app = getApplication();
|
||||
final OsmandApplication app = getApplication();
|
||||
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
final List<PoiUIFilter> list = new ArrayList<>();
|
||||
|
@ -298,17 +300,25 @@ public class MapActivityLayers {
|
|||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null)
|
||||
// TODO go to single choice dialog
|
||||
.setNeutralButton("Single choice", new DialogInterface.OnClickListener() {
|
||||
.setNeutralButton(" ", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
showSingleChoicePoiFilterDialog(mapView, listener);
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
final AlertDialog alertDialog = builder.create();
|
||||
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
Drawable drawable = app.getIconsCache().getThemedIcon(R.drawable.ic_action_singleselect);
|
||||
neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); }
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public void showSingleChoicePoiFilterDialog(final OsmandMapTileView mapView, final ConfirmListener listener) {
|
||||
OsmandApplication app = getApplication();
|
||||
final OsmandApplication app = getApplication();
|
||||
final PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
final List<PoiUIFilter> list = new ArrayList<>();
|
||||
|
@ -344,13 +354,21 @@ public class MapActivityLayers {
|
|||
});
|
||||
builder.setTitle(R.string.show_poi_over_map);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
builder.setNeutralButton("Multichoice", new DialogInterface.OnClickListener() {
|
||||
builder.setNeutralButton(" ", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
showMultichoicePoiFilterDialog(mapView, listener);
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
final AlertDialog alertDialog = builder.create();
|
||||
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
|
||||
Drawable drawable = app.getIconsCache().getThemedIcon(R.drawable.ic_action_multiselect);
|
||||
neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); }
|
||||
});
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
private void addFilterToList(final ContextMenuAdapter adapter,
|
||||
|
|
|
@ -889,43 +889,6 @@ public class WaypointDialogHelper {
|
|||
app.getSettings().setMapLocationToShow(locationPoint.getLatitude(), locationPoint.getLongitude(),
|
||||
15, locationPoint.getPointDescription(a), false, locationPoint);
|
||||
MapActivity.launchMapActivityMoveToTop(a);
|
||||
|
||||
/*
|
||||
MapActivity ctx = (MapActivity) a;
|
||||
AnimateDraggingMapThread thread = ctx.getMapView().getAnimatedDraggingThread();
|
||||
int fZoom = ctx.getMapView().getZoom() < 15 ? 15 : ctx.getMapView().getZoom();
|
||||
double flat = locationPoint.getLatitude();
|
||||
double flon = locationPoint.getLongitude();
|
||||
if (!center) {
|
||||
RotatedTileBox cp = ctx.getMapView().getCurrentRotatedTileBox().copy();
|
||||
cp.setCenterLocation(0.5f, 0.25f);
|
||||
cp.setLatLonCenter(flat, flon);
|
||||
flat = cp.getLatFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);
|
||||
flon = cp.getLonFromPixel(cp.getPixWidth() / 2, cp.getPixHeight() / 2);
|
||||
}
|
||||
if (thread.isAnimating()) {
|
||||
ctx.getMapView().setIntZoom(fZoom);
|
||||
ctx.getMapView().setLatLon(flat, flon);
|
||||
app.getAppCustomization().showLocationPoint(ctx, locationPoint);
|
||||
} else {
|
||||
final double dist = MapUtils.getDistance(ctx.getMapView().getLatitude(), ctx.getMapView().getLongitude(),
|
||||
locationPoint.getLatitude(), locationPoint.getLongitude());
|
||||
double t = 10;
|
||||
if (dist < t) {
|
||||
app.getAppCustomization().showLocationPoint(ctx, locationPoint);
|
||||
} else {
|
||||
thread.startMoving(flat, flon, fZoom, true);
|
||||
}
|
||||
if (ctx.getDashboard().isVisible()) {
|
||||
ctx.getDashboard().hideDashboard();
|
||||
ctx.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
||||
ctx.getContextMenu().show(
|
||||
new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()),
|
||||
locationPoint.getPointDescription(ctx),
|
||||
locationPoint);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public static void sortAllTargets(final OsmandApplication app, final Activity activity,
|
||||
|
|
Loading…
Reference in a new issue