Change the button in the context menu of the marker

This commit is contained in:
Alexander Sytnyk 2017-10-30 19:07:34 +02:00
parent bb244c03d3
commit 1ab34b31d9
5 changed files with 38 additions and 3 deletions

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<inset
android:insetRight="@dimen/context_menu_first_line_top_margin">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/osmand_orange"/>
</shape>
</inset>
</item>
<item android:drawable="@drawable/ic_action_marker_passed"/>
</layer-list>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<inset
android:insetRight="@dimen/context_menu_first_line_top_margin">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/map_widget_blue"/>
</shape>
</inset>
</item>
<item android:drawable="@drawable/ic_action_marker_passed"/>
</layer-list>

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 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="mark_passed">Mark passed</string>
<string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string> <string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string>
<string name="import_as_gpx">Import as GPX file</string> <string name="import_as_gpx">Import as GPX file</string>
<string name="import_as_favorites">Import as Favorites</string> <string name="import_as_favorites">Import as Favorites</string>

View file

@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -495,10 +496,14 @@ public abstract class MenuController extends BaseMenuController {
public boolean needRightText = false; public boolean needRightText = false;
public String rightTextCaption = ""; public String rightTextCaption = "";
public boolean visible = true; public boolean visible = true;
public boolean needColorizeIcon = true;
public Drawable getLeftIcon() { public Drawable getLeftIcon() {
if (leftIconId != 0) { if (leftIconId != 0) {
if (needColorizeIcon) {
return getIcon(leftIconId, isLight() ? R.color.map_widget_blue : R.color.osmand_orange); return getIcon(leftIconId, isLight() ? R.color.map_widget_blue : R.color.osmand_orange);
}
return ContextCompat.getDrawable(getMapActivity(), leftIconId);
} else { } else {
return null; return null;
} }

View file

@ -28,8 +28,9 @@ public class MapMarkerMenuController extends MenuController {
getMapActivity().getContextMenu().close(); getMapActivity().getContextMenu().close();
} }
}; };
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_remove); leftTitleButtonController.needColorizeIcon = false;
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark; leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark;
} }
@Override @Override