Fix onClickListener in switch start and destination item
This commit is contained in:
parent
488478270c
commit
7e627ff964
2 changed files with 20 additions and 18 deletions
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
|
||||
|
@ -28,6 +28,7 @@
|
|||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Title"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -278,8 +278,6 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
private void createSwitchStartAndEndItem() {
|
||||
final View switchStartAndEndView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.bottom_sheet_item_simple_56dp, null);
|
||||
TextView title = (TextView) switchStartAndEndView.findViewById(R.id.title);
|
||||
ImageView iconIv = (ImageView) switchStartAndEndView.findViewById(R.id.icon);
|
||||
iconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_change_navigation_points));
|
||||
|
||||
String titleS = getString(R.string.swap_start_and_destination);
|
||||
SpannableString titleSpan = new SpannableString(titleS);
|
||||
|
@ -291,19 +289,22 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
}
|
||||
title.setText(titleSpan);
|
||||
|
||||
switchStartAndEndView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
if (mapActivity != null) {
|
||||
TargetPointsHelper targetsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
WaypointDialogHelper.switchStartAndFinish(targetsHelper, targetsHelper.getPointToNavigate(),
|
||||
mapActivity, targetsHelper.getPointToStart(), mapActivity.getMyApplication(),
|
||||
mapActivity.getDashboard().getWaypointDialogHelper());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
items.add(new BaseBottomSheetItem.Builder().setCustomView(switchStartAndEndView).create());
|
||||
BaseBottomSheetItem switchStartAndEndItem = new SimpleBottomSheetItem.Builder()
|
||||
.setIcon(getContentIcon(R.drawable.ic_action_change_navigation_points))
|
||||
.setCustomView(switchStartAndEndView)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
if (mapActivity != null) {
|
||||
TargetPointsHelper targetsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
WaypointDialogHelper.switchStartAndFinish(targetsHelper, targetsHelper.getPointToNavigate(),
|
||||
mapActivity, targetsHelper.getPointToStart(), mapActivity.getMyApplication(),
|
||||
mapActivity.getDashboard().getWaypointDialogHelper());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}).create();
|
||||
items.add(switchStartAndEndItem);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue