Replace image button "more" with text button "options" in waypoints dialog
This commit is contained in:
parent
4354ecd49b
commit
46c24c68bb
2 changed files with 25 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
|||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="5dp"
|
||||
|
@ -38,6 +39,22 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/text_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_options"
|
||||
android:visibility="gone"
|
||||
osmand:textAllCapsCompat="true"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:textColor="?attr/color_dialog_buttons"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/image_button"
|
||||
android:contentDescription="@string/shared_string_more"
|
||||
|
|
|
@ -44,6 +44,7 @@ import net.osmand.plus.poi.PoiUIFilter;
|
|||
import net.osmand.plus.views.controls.DynamicListView.DragIcon;
|
||||
import net.osmand.plus.views.controls.ListDividerShape;
|
||||
import net.osmand.plus.views.controls.StableArrayAdapter;
|
||||
import net.osmand.plus.widgets.TextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -611,11 +612,12 @@ public class WaypointDialogHelper {
|
|||
|
||||
});
|
||||
|
||||
final ImageButton moreBtn = (ImageButton) v.findViewById(R.id.image_button);
|
||||
final TextViewEx optionsButton = (TextViewEx) v.findViewById(R.id.text_button);
|
||||
if (type == WaypointHelper.TARGETS) {
|
||||
moreBtn.setVisibility(View.VISIBLE);
|
||||
moreBtn.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_overflow_menu_white, !nightMode));
|
||||
moreBtn.setOnClickListener(new View.OnClickListener() {
|
||||
optionsButton.setVisibility(View.VISIBLE);
|
||||
optionsButton.setTextColor(ContextCompat.getColor(ctx,
|
||||
nightMode ? R.color.color_dialog_buttons_dark : R.color.color_dialog_buttons_light));
|
||||
optionsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean hasActivePoints = false;
|
||||
|
@ -638,7 +640,7 @@ public class WaypointDialogHelper {
|
|||
}
|
||||
}
|
||||
|
||||
final PopupMenu optionsMenu = new PopupMenu(ctx, moreBtn);
|
||||
final PopupMenu optionsMenu = new PopupMenu(ctx, optionsButton);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
MenuItem item;
|
||||
if (hasActivePoints) {
|
||||
|
@ -673,7 +675,7 @@ public class WaypointDialogHelper {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
moreBtn.setVisibility(View.GONE);
|
||||
optionsButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
TextView tv = (TextView) v.findViewById(R.id.header_text);
|
||||
|
|
Loading…
Reference in a new issue