Add some new items; add small refactoring

This commit is contained in:
alex 2018-03-01 15:29:02 +02:00
parent a67a2e1c28
commit 2e4b15a3c4
5 changed files with 36 additions and 8 deletions

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Some subtitle"/>

View file

@ -13,7 +13,7 @@
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/icon_iv"
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
@ -21,7 +21,7 @@
tools:src="@drawable/ic_action_coordinates_latitude"/>
<TextView
android:id="@+id/name_tv"
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/content_padding"
@ -33,7 +33,7 @@
tools:text="@string/dd_mm_mmm_format"/>
<RadioButton
android:id="@+id/radio_button"
android:id="@+id/compound_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"

View file

@ -0,0 +1,12 @@
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
public class SubtitleItem extends SimpleBottomSheetItem {
public SubtitleItem(String title) {
this.title = title;
this.layoutId = R.layout.bottom_sheet_item_subtitle;
}
}

View file

@ -125,13 +125,13 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
row.setTag(format);
row.setOnClickListener(formatsOnClickListener);
((ImageView) row.findViewById(R.id.icon_iv)).setImageDrawable(selectedRow
((ImageView) row.findViewById(R.id.icon)).setImageDrawable(selectedRow
? getActiveIcon(R.drawable.ic_action_coordinates_latitude) : formatIcon);
TextView nameTv = (TextView) row.findViewById(R.id.name_tv);
TextView nameTv = (TextView) row.findViewById(R.id.title);
nameTv.setText(CoordinateInputFormats.formatToHumanString(context, format));
if (selectedRow) {
nameTv.setTextColor(getResolvedActiveColor());
RadioButton rb = (RadioButton) row.findViewById(R.id.radio_button);
RadioButton rb = (RadioButton) row.findViewById(R.id.compound_button);
rb.setChecked(true);
CompoundButtonCompat.setButtonTintList(rb, ColorStateList.valueOf(getResolvedActiveColor()));
}

View file

@ -10,8 +10,8 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AndroidUiHelper;
@ -87,7 +87,7 @@ public class PlanRouteOptionsBottomSheetDialogFragment extends MenuBottomSheetDi
items.add(new DividerItem(getContext()));
items.add(new DescriptionItem(getString(R.string.sort_by)));
items.add(new SubtitleItem(getString(R.string.sort_by)));
BaseBottomSheetItem doorToDoorItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_sort_door_to_door))