Context menu fixes
This commit is contained in:
parent
b97606e30a
commit
123f285458
13 changed files with 237 additions and 124 deletions
|
@ -85,10 +85,23 @@
|
|||
|
||||
<LinearLayout
|
||||
android:id="@+id/context_menu_close_btn_layout"
|
||||
android:layout_width="66dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="66dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/title_button_top_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/shared_string_others"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -101,6 +114,7 @@
|
|||
android:layout_marginRight="2dp"
|
||||
android:layout_marginTop="-16dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
|
@ -111,7 +125,7 @@
|
|||
android:gravity="left|center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/osmand_parking_delete"
|
||||
android:text="@string/recording_context_menu_play"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
|
@ -126,6 +140,19 @@
|
|||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:text="— 00:26"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/title_button_right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:drawableLeft="@drawable/ic_action_delete_dark"
|
||||
android:text="@string/shared_string_delete"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="shared_string_upload">Upload</string>
|
||||
<string name="osm_edit_created_poi">Created OSM POI</string>
|
||||
<string name="osm_edit_created_bug">Created OSM bug</string>
|
||||
<string name="world_map_download_descr">World basemap (covering the whole world at small zooms) is missing or outdated. Please consider downloading World basemap for a complete environment.</string>
|
||||
|
|
|
@ -358,9 +358,25 @@ public class MapContextMenu extends MenuTitleController {
|
|||
}
|
||||
}
|
||||
|
||||
public TitleButtonController getTitleButtonController() {
|
||||
public TitleButtonController getLeftTitleButtonController() {
|
||||
if (menuController != null) {
|
||||
return menuController.getTitleButtonController();
|
||||
return menuController.getLeftTitleButtonController();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public TitleButtonController getRightTitleButtonController() {
|
||||
if (menuController != null) {
|
||||
return menuController.getRightTitleButtonController();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public TitleButtonController getTopRightTitleButtonController() {
|
||||
if (menuController != null) {
|
||||
return menuController.getTopRightTitleButtonController();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,9 @@ public class MapContextMenuFragment extends Fragment {
|
|||
ImageView fabView;
|
||||
|
||||
private MapContextMenu menu;
|
||||
private TitleButtonController titleButtonController;
|
||||
private TitleButtonController leftTitleButtonController;
|
||||
private TitleButtonController rightTitleButtonController;
|
||||
private TitleButtonController topRightTitleButtonController;
|
||||
|
||||
private int menuTopViewHeight;
|
||||
private int menuTopShadowHeight;
|
||||
|
@ -123,7 +125,9 @@ public class MapContextMenuFragment extends Fragment {
|
|||
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
|
||||
|
||||
menu = getMapActivity().getContextMenu();
|
||||
titleButtonController = menu.getTitleButtonController();
|
||||
leftTitleButtonController = menu.getLeftTitleButtonController();
|
||||
rightTitleButtonController = menu.getRightTitleButtonController();
|
||||
topRightTitleButtonController = menu.getTopRightTitleButtonController();
|
||||
|
||||
map = getMapActivity().getMapView();
|
||||
RotatedTileBox box = map.getCurrentRotatedTileBox().copy();
|
||||
|
@ -144,35 +148,78 @@ public class MapContextMenuFragment extends Fragment {
|
|||
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
|
||||
mainView = view.findViewById(R.id.context_menu_main);
|
||||
|
||||
// Title button
|
||||
final View titleButtonContainer = view.findViewById(R.id.title_button_container);
|
||||
if (titleButtonController != null) {
|
||||
titleButtonContainer.setVisibility(View.VISIBLE);
|
||||
// Title buttons
|
||||
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
|
||||
titleButtonsContainer.setVisibility(
|
||||
leftTitleButtonController != null || rightTitleButtonController != null ? View.VISIBLE : View.GONE);
|
||||
|
||||
final Button titleButton = (Button) view.findViewById(R.id.title_button);
|
||||
titleButton.setText(titleButtonController.getCaption());
|
||||
// Left title button
|
||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
|
||||
if (leftTitleButtonController != null) {
|
||||
leftTitleButton.setText(leftTitleButtonController.getCaption());
|
||||
|
||||
Drawable leftIcon = titleButtonController.getLeftIcon();
|
||||
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
||||
if (leftIcon != null) {
|
||||
titleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||
titleButton.setCompoundDrawablePadding(dpToPx(8f));
|
||||
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||
leftTitleButton.setCompoundDrawablePadding(dpToPx(4f));
|
||||
}
|
||||
titleButton.setOnClickListener(new View.OnClickListener() {
|
||||
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
titleButtonController.buttonPressed();
|
||||
leftTitleButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
|
||||
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
|
||||
titleButtonRightText.setVisibility(titleButtonController.isNeedRightText() ? View.VISIBLE : View.GONE);
|
||||
if (titleButtonController.isNeedRightText()) {
|
||||
titleButtonRightText.setText(titleButtonController.getRightTextCaption());
|
||||
if (leftTitleButtonController.isNeedRightText()) {
|
||||
titleButtonRightText.setText(leftTitleButtonController.getRightTextCaption());
|
||||
} else {
|
||||
titleButtonRightText.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
titleButtonContainer.setVisibility(View.GONE);
|
||||
leftTitleButton.setVisibility(View.GONE);
|
||||
titleButtonRightText.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Right title button
|
||||
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right);
|
||||
if (rightTitleButtonController != null) {
|
||||
rightTitleButton.setText(rightTitleButtonController.getCaption());
|
||||
|
||||
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
||||
if (leftIcon != null) {
|
||||
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||
rightTitleButton.setCompoundDrawablePadding(dpToPx(4f));
|
||||
}
|
||||
rightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
rightTitleButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
rightTitleButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Top Right title button
|
||||
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right);
|
||||
if (topRightTitleButtonController != null) {
|
||||
topRightTitleButton.setText(topRightTitleButtonController.getCaption());
|
||||
|
||||
Drawable leftIcon = topRightTitleButtonController.getLeftIcon();
|
||||
if (leftIcon != null) {
|
||||
topRightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||
topRightTitleButton.setCompoundDrawablePadding(dpToPx(4f));
|
||||
}
|
||||
topRightTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
topRightTitleButtonController.buttonPressed();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
topRightTitleButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (menu.isLandscapeLayout()) {
|
||||
mainView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx(menu.getLandscapeWidthDp()),
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.osmand.data.Amenity;
|
|||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.map.WorldRegion;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -49,7 +48,9 @@ public abstract class MenuController extends BaseMenuController {
|
|||
private int currentMenuState;
|
||||
private MenuType menuType = MenuType.STANDARD;
|
||||
|
||||
protected TitleButtonController titleButtonController;
|
||||
protected TitleButtonController leftTitleButtonController;
|
||||
protected TitleButtonController rightTitleButtonController;
|
||||
protected TitleButtonController topRightTitleButtonController;
|
||||
|
||||
public abstract class TitleButtonController {
|
||||
|
||||
|
@ -205,8 +206,16 @@ public abstract class MenuController extends BaseMenuController {
|
|||
this.currentMenuState = currentMenuState;
|
||||
}
|
||||
|
||||
public TitleButtonController getTitleButtonController() {
|
||||
return titleButtonController;
|
||||
public TitleButtonController getLeftTitleButtonController() {
|
||||
return leftTitleButtonController;
|
||||
}
|
||||
|
||||
public TitleButtonController getRightTitleButtonController() {
|
||||
return rightTitleButtonController;
|
||||
}
|
||||
|
||||
public TitleButtonController getTopRightTitleButtonController() {
|
||||
return topRightTitleButtonController;
|
||||
}
|
||||
|
||||
public boolean fabVisible() {
|
||||
|
|
|
@ -1,29 +1,20 @@
|
|||
package net.osmand.plus.mapcontextmenu.builders;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
|
@ -50,6 +41,13 @@ public class AudioVideoNoteMenuBuilder extends MenuBuilder {
|
|||
File file = recording.getFile();
|
||||
if (file != null) {
|
||||
|
||||
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(view.getContext());
|
||||
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
|
||||
Date date = new Date(recording.getFile().lastModified());
|
||||
buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + " — " + timeFormat.format(date), 0);
|
||||
|
||||
buildPlainMenuItems(view);
|
||||
|
||||
if (recording.isPhoto()) {
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inSampleSize = 4;
|
||||
|
@ -73,38 +71,9 @@ public class AudioVideoNoteMenuBuilder extends MenuBuilder {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(view.getContext());
|
||||
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
|
||||
Date date = new Date(recording.getFile().lastModified());
|
||||
buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + " — " + timeFormat.format(date), 0);
|
||||
} else {
|
||||
buildPlainMenuItems(view);
|
||||
}
|
||||
|
||||
buildPlainMenuItems(view);
|
||||
|
||||
buildButtonRow(view, null, view.getResources().getString(R.string.recording_context_menu_delete), new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AccessibleAlertBuilder bld = new AccessibleAlertBuilder(v.getContext());
|
||||
bld.setMessage(R.string.recording_delete_confirm);
|
||||
final View fView = v;
|
||||
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
AudioVideoNotesPlugin plugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
||||
if (plugin != null) {
|
||||
plugin.deleteRecording(recording);
|
||||
if (fView.getContext() instanceof MapActivity) {
|
||||
((MapActivity)fView.getContext()).getContextMenu().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
bld.setNegativeButton(R.string.shared_string_no, null);
|
||||
bld.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void buildImageRow(final View view, Bitmap bitmap, OnClickListener onClickListener) {
|
||||
|
|
|
@ -112,23 +112,5 @@ public class EditPOIMenuBuilder extends MenuBuilder {
|
|||
buildRow(view, R.drawable.ic_action_info_dark, text);
|
||||
}
|
||||
}
|
||||
|
||||
buildButtonRow(view, null, view.getResources().getString(R.string.shared_string_delete), new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
if (plugin != null) {
|
||||
boolean deleted = false;
|
||||
if (osmPoint instanceof OsmNotesPoint) {
|
||||
deleted = plugin.getDBBug().deleteAllBugModifications((OsmNotesPoint) osmPoint);
|
||||
} else if (osmPoint instanceof OpenstreetmapPoint) {
|
||||
deleted = plugin.getDBPOI().deletePOI((OpenstreetmapPoint) osmPoint);
|
||||
}
|
||||
if (deleted && v.getContext() instanceof MapActivity) {
|
||||
((MapActivity)v.getContext()).getContextMenu().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package net.osmand.plus.mapcontextmenu.controllers;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -11,7 +13,6 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.mapcontextmenu.builders.AudioVideoNoteMenuBuilder;
|
||||
|
||||
|
@ -33,21 +34,46 @@ public class AudioVideoNoteMenuController extends MenuController {
|
|||
dateFormat = android.text.format.DateFormat.getMediumDateFormat(mapActivity);
|
||||
timeFormat = android.text.format.DateFormat.getTimeFormat(mapActivity);
|
||||
|
||||
if (!recording.isPhoto()) {
|
||||
titleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
if (plugin != null) {
|
||||
plugin.playRecording(getMapActivity(), recording);
|
||||
}
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
if (plugin != null) {
|
||||
plugin.playRecording(getMapActivity(), recording);
|
||||
}
|
||||
};
|
||||
titleButtonController.caption = getMapActivity().getString(R.string.recording_context_menu_play);
|
||||
titleButtonController.leftIconId = R.drawable.ic_play_dark;
|
||||
}
|
||||
};
|
||||
if (!recording.isPhoto()) {
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.recording_context_menu_play);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_play_dark;
|
||||
String durationStr = recording.getPlainDuration();
|
||||
titleButtonController.needRightText = true;
|
||||
titleButtonController.rightTextCaption = "— " + durationStr;
|
||||
leftTitleButtonController.needRightText = true;
|
||||
leftTitleButtonController.rightTextCaption = "— " + durationStr;
|
||||
} else {
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.recording_context_menu_show);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_view;
|
||||
}
|
||||
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
AccessibleAlertBuilder bld = new AccessibleAlertBuilder(getMapActivity());
|
||||
bld.setMessage(R.string.recording_delete_confirm);
|
||||
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (plugin != null) {
|
||||
plugin.deleteRecording(recording);
|
||||
getMapActivity().getContextMenu().close();
|
||||
}
|
||||
}
|
||||
});
|
||||
bld.setNegativeButton(R.string.shared_string_no, null);
|
||||
bld.show();
|
||||
}
|
||||
};
|
||||
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package net.osmand.plus.mapcontextmenu.controllers;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
|
@ -11,11 +13,13 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuController;
|
||||
import net.osmand.plus.mapcontextmenu.builders.EditPOIMenuBuilder;
|
||||
import net.osmand.plus.osmedit.OpenstreetmapPoint;
|
||||
import net.osmand.plus.osmedit.OpenstreetmapRemoteUtil;
|
||||
import net.osmand.plus.osmedit.OsmBugsRemoteUtil;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditsUploadListener;
|
||||
import net.osmand.plus.osmedit.OsmEditsUploadListenerHelper;
|
||||
import net.osmand.plus.osmedit.OsmNotesPoint;
|
||||
import net.osmand.plus.osmedit.OsmPoint;
|
||||
import net.osmand.plus.osmedit.UploadOpenstreetmapPointAsyncTask;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
|
||||
|
@ -66,7 +70,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
|
||||
titleButtonController = new TitleButtonController() {
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
if (plugin != null) {
|
||||
|
@ -76,7 +80,37 @@ public class EditPOIMenuController extends MenuController {
|
|||
}
|
||||
}
|
||||
};
|
||||
titleButtonController.caption = getMapActivity().getString(R.string.local_openstreetmap_upload);
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_upload);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_export;
|
||||
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
AccessibleAlertBuilder bld = new AccessibleAlertBuilder(getMapActivity());
|
||||
bld.setMessage(R.string.recording_delete_confirm);
|
||||
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (plugin != null) {
|
||||
boolean deleted = false;
|
||||
if (osmPoint instanceof OsmNotesPoint) {
|
||||
deleted = plugin.getDBBug().deleteAllBugModifications((OsmNotesPoint) osmPoint);
|
||||
} else if (osmPoint instanceof OpenstreetmapPoint) {
|
||||
deleted = plugin.getDBPOI().deletePOI((OpenstreetmapPoint) osmPoint);
|
||||
}
|
||||
if (deleted) {
|
||||
getMapActivity().getContextMenu().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
bld.setNegativeButton(R.string.shared_string_no, null);
|
||||
bld.show();
|
||||
}
|
||||
};
|
||||
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_poi);
|
||||
|
|
|
@ -30,7 +30,8 @@ public class MapDataMenuController extends MenuController {
|
|||
} else {
|
||||
regionName = dataObject.getName();
|
||||
}
|
||||
titleButtonController = new TitleButtonController() {
|
||||
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
getMapActivity().getContextMenu().close();
|
||||
|
@ -42,8 +43,27 @@ public class MapDataMenuController extends MenuController {
|
|||
getMapActivity().startActivity(intent);
|
||||
}
|
||||
};
|
||||
titleButtonController.caption = getMapActivity().getString(R.string.shared_string_download_map);
|
||||
titleButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_download);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
// todo delete
|
||||
//getMapActivity().getContextMenu().close();
|
||||
}
|
||||
};
|
||||
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
|
||||
topRightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
// todo other maps
|
||||
}
|
||||
};
|
||||
topRightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_others);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
}
|
||||
parkingDescription = sb.toString();
|
||||
}
|
||||
titleButtonController = new TitleButtonController() {
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
if (plugin != null) {
|
||||
|
@ -39,7 +39,7 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
}
|
||||
}
|
||||
};
|
||||
titleButtonController.caption = getMapActivity().getString(R.string.osmand_parking_delete);
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.osmand_parking_delete);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ public class TargetPointMenuController extends MenuController {
|
|||
public TargetPointMenuController(OsmandApplication app, MapActivity mapActivity, final TargetPoint targetPoint) {
|
||||
super(new MenuBuilder(app), mapActivity);
|
||||
this.targetPoint = targetPoint;
|
||||
titleButtonController = new TitleButtonController() {
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
TargetPointsHelper targetPointsHelper = getMapActivity().getMyApplication().getTargetPointsHelper();
|
||||
|
@ -30,7 +30,7 @@ public class TargetPointMenuController extends MenuController {
|
|||
getMapActivity().getContextMenu().close();
|
||||
}
|
||||
};
|
||||
titleButtonController.caption = getMapActivity().getString(R.string.delete_target_point);
|
||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.delete_target_point);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -310,24 +310,6 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
getActivity(),
|
||||
R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
final String message = node.getId() == -1 ?
|
||||
getResources().getString(R.string.poi_action_add)
|
||||
: getResources().getString(R.string.poi_action_change);
|
||||
|
||||
AccessibleToast.makeText(
|
||||
getActivity(),
|
||||
MessageFormat.format(
|
||||
getResources().getString(
|
||||
R.string.poi_action_succeded_template), message),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
if (plugin != null) {
|
||||
List<OpenstreetmapPoint> points = plugin.getDBPOI().getOpenstreetmapPoints();
|
||||
|
|
Loading…
Reference in a new issue