Refactor some code; rewrite UI in ExportOptionsBottomSheetDialogFragment
This commit is contained in:
parent
fa4a8ef876
commit
29b164350b
12 changed files with 173 additions and 287 deletions
15
OsmAnd/res/layout/bottom_sheet_item_description.xml
Normal file
15
OsmAnd/res/layout/bottom_sheet_item_description.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?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/description"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/bottom_sheet_descr_height"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:minHeight="@dimen/bottom_sheet_descr_height"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
|
tools:text="Some long description"/>
|
|
@ -6,7 +6,9 @@
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||||
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="1"
|
||||||
android:minHeight="@dimen/bottom_sheet_title_height"
|
android:minHeight="@dimen/bottom_sheet_title_height"
|
||||||
android:paddingLeft="@dimen/content_padding"
|
android:paddingLeft="@dimen/content_padding"
|
||||||
android:paddingRight="@dimen/content_padding"
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
|
43
OsmAnd/res/layout/bottom_sheet_item_with_right_descr.xml
Normal file
43
OsmAnd/res/layout/bottom_sheet_item_with_right_descr.xml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<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="@dimen/bottom_sheet_list_item_height"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||||
|
android:paddingLeft="@dimen/content_padding"
|
||||||
|
android:paddingRight="@dimen/content_padding">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||||
|
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||||
|
tools:src="@drawable/ic_action_info_dark"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||||
|
tools:text="Title"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/description"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="Description"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,195 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<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="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/scroll_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
|
||||||
android:id="@+id/title_text_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"
|
|
||||||
android:text="@string/shared_string_export"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
|
||||||
osmand:typeface="@string/font_roboto_medium"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_descr_height"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:paddingEnd="@dimen/content_padding"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"
|
|
||||||
android:paddingStart="@dimen/content_padding"
|
|
||||||
android:text="@string/osm_edits_export_desc"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/poi_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/poi_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
tools:src="@drawable/ic_action_info_dark"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/poi"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/poi_count_text_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_list_text_size"
|
|
||||||
tools:text="13"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/osm_notes_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/osm_notes_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
tools:src="@drawable/ic_action_bug_dark"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/osm_notes"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/osm_notes_count_text_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_list_text_size"
|
|
||||||
tools:text="5"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/all_data_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
|
||||||
android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/all_data_icon"
|
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
|
||||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
|
||||||
tools:src="@drawable/ic_action_folder"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/all_data"
|
|
||||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/all_data_count_text_view"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:textColor="?android:textColorSecondary"
|
|
||||||
android:textSize="@dimen/default_list_text_size"
|
|
||||||
tools:text="18"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="?attr/dashboard_divider"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/cancel_row"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
|
||||||
android:background="?attr/selectableItemBackground">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/cancel_row_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@string/shared_string_cancel"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:textColor="?attr/color_dialog_buttons"
|
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -15,10 +15,10 @@ public class BaseBottomSheetItem {
|
||||||
|
|
||||||
protected View view;
|
protected View view;
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
private int layoutId;
|
protected int layoutId = INVALID_ID;
|
||||||
private boolean disabled;
|
private boolean disabled;
|
||||||
private View.OnClickListener onClickListener;
|
private View.OnClickListener onClickListener;
|
||||||
protected int position;
|
protected int position = INVALID_POSITION;
|
||||||
|
|
||||||
public BaseBottomSheetItem(View view,
|
public BaseBottomSheetItem(View view,
|
||||||
@LayoutRes int layoutId,
|
@LayoutRes int layoutId,
|
||||||
|
@ -32,7 +32,7 @@ public class BaseBottomSheetItem {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseBottomSheetItem() {
|
protected BaseBottomSheetItem() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ import net.osmand.plus.R;
|
||||||
|
|
||||||
public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
|
public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
|
||||||
|
|
||||||
private String description;
|
protected String description;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
private int descriptionColorId;
|
private int descriptionColorId = INVALID_ID;
|
||||||
|
|
||||||
public BottomSheetItemWithDescription(View customView,
|
public BottomSheetItemWithDescription(View customView,
|
||||||
@LayoutRes int layoutId,
|
@LayoutRes int layoutId,
|
||||||
|
@ -32,6 +32,10 @@ public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
|
||||||
this.descriptionColorId = descriptionColorId;
|
this.descriptionColorId = descriptionColorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected BottomSheetItemWithDescription() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
|
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
|
||||||
super.inflate(app, container, nightMode);
|
super.inflate(app, container, nightMode);
|
||||||
|
|
|
@ -15,9 +15,9 @@ import net.osmand.plus.R;
|
||||||
public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
|
|
||||||
private Drawable icon;
|
private Drawable icon;
|
||||||
private String title;
|
protected String title;
|
||||||
@ColorRes
|
@ColorRes
|
||||||
private int titleColorId;
|
protected int titleColorId = INVALID_ID;
|
||||||
|
|
||||||
public SimpleBottomSheetItem(View customView,
|
public SimpleBottomSheetItem(View customView,
|
||||||
@LayoutRes int layoutId,
|
@LayoutRes int layoutId,
|
||||||
|
@ -33,6 +33,10 @@ public class SimpleBottomSheetItem extends BaseBottomSheetItem {
|
||||||
this.titleColorId = titleColorId;
|
this.titleColorId = titleColorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SimpleBottomSheetItem() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
|
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
|
||||||
super.inflate(app, container, nightMode);
|
super.inflate(app, container, nightMode);
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
|
||||||
|
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||||
|
|
||||||
|
public class DescriptionItem extends BottomSheetItemWithDescription {
|
||||||
|
|
||||||
|
public DescriptionItem(String description) {
|
||||||
|
this.description = description;
|
||||||
|
this.layoutId = R.layout.bottom_sheet_item_description;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.plus.base.bottomsheetmenu;
|
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.ColorRes;
|
import android.support.annotation.ColorRes;
|
||||||
|
@ -10,21 +10,22 @@ import android.widget.LinearLayout;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
|
||||||
public class DividerHalfBottomSheetItem extends BaseBottomSheetItem {
|
public class DividerHalfItem extends BaseBottomSheetItem {
|
||||||
|
|
||||||
@ColorRes
|
@ColorRes
|
||||||
private int colorId;
|
private int colorId;
|
||||||
|
|
||||||
public DividerHalfBottomSheetItem(Context context) {
|
public DividerHalfItem(Context context) {
|
||||||
setupView(context, INVALID_ID, INVALID_POSITION);
|
setupView(context, INVALID_ID, INVALID_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DividerHalfBottomSheetItem(Context context, @ColorRes int colorId) {
|
public DividerHalfItem(Context context, @ColorRes int colorId) {
|
||||||
setupView(context, colorId, INVALID_POSITION);
|
setupView(context, colorId, INVALID_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DividerHalfBottomSheetItem(Context context, @ColorRes int colorId, int position) {
|
public DividerHalfItem(Context context, @ColorRes int colorId, int position) {
|
||||||
setupView(context, colorId, position);
|
setupView(context, colorId, position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
|
||||||
|
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
|
|
||||||
|
public class TitleItem extends SimpleBottomSheetItem {
|
||||||
|
|
||||||
|
public TitleItem(String title) {
|
||||||
|
this.title = title;
|
||||||
|
this.layoutId = R.layout.bottom_sheet_item_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
|
||||||
|
titleColorId = nightMode ? R.color.ctx_menu_info_text_dark : INVALID_ID;
|
||||||
|
super.inflate(app, container, nightMode);
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,8 +21,8 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.DividerHalfBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
|
|
||||||
public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
@ -38,11 +38,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
||||||
final PointDescription name = PointDescription.deserializeFromString(args.getString(POINT_DESCRIPTION_KEY), latLon);
|
final PointDescription name = PointDescription.deserializeFromString(args.getString(POINT_DESCRIPTION_KEY), latLon);
|
||||||
final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
final TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
||||||
|
|
||||||
BaseBottomSheetItem titleItem = new SimpleBottomSheetItem.Builder()
|
items.add(new TitleItem(getString(R.string.new_destination_point_dialog)));
|
||||||
.setTitle(getString(R.string.new_destination_point_dialog))
|
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_title)
|
|
||||||
.create();
|
|
||||||
items.add(titleItem);
|
|
||||||
|
|
||||||
BaseBottomSheetItem replaceDestItem = new BottomSheetItemWithDescription.Builder()
|
BaseBottomSheetItem replaceDestItem = new BottomSheetItemWithDescription.Builder()
|
||||||
.setDescription(getCurrentPointName(targetPointsHelper.getPointToNavigate(), false))
|
.setDescription(getCurrentPointName(targetPointsHelper.getPointToNavigate(), false))
|
||||||
|
@ -79,7 +75,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
||||||
.create();
|
.create();
|
||||||
items.add(replaceStartItem);
|
items.add(replaceStartItem);
|
||||||
|
|
||||||
items.add(new DividerHalfBottomSheetItem(getContext(), getCloseRowDividerColorId()));
|
items.add(new DividerHalfItem(getContext(), getCloseRowDividerColorId()));
|
||||||
|
|
||||||
BaseBottomSheetItem subsequentDestItem = new BottomSheetItemWithDescription.Builder()
|
BaseBottomSheetItem subsequentDestItem = new BottomSheetItemWithDescription.Builder()
|
||||||
.setDescription(getString(R.string.subsequent_dest_description))
|
.setDescription(getString(R.string.subsequent_dest_description))
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package net.osmand.plus.osmedit;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.ContextThemeWrapper;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
import net.osmand.plus.osmedit.OsmEditsFragment.ExportTypesDef;
|
import net.osmand.plus.osmedit.OsmEditsFragment.ExportTypesDef;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
|
||||||
|
|
||||||
public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
@ -30,88 +30,71 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View createMenuItems(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
|
||||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
|
|
||||||
R.layout.fragment_osm_export_options_bottom_sheet_dialog, container);
|
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
poiCount = args.getInt(POI_COUNT_KEY);
|
poiCount = args.getInt(POI_COUNT_KEY);
|
||||||
osmNotesCount = args.getInt(NOTES_COUNT_KEY);
|
osmNotesCount = args.getInt(NOTES_COUNT_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nightMode) {
|
items.add(new TitleItem(getString(R.string.shared_string_export)));
|
||||||
((TextViewEx) mainView.findViewById(R.id.title_text_view)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
|
|
||||||
}
|
|
||||||
|
|
||||||
((ImageView) mainView.findViewById(R.id.poi_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_info_dark));
|
items.add(new DescriptionItem(getString(R.string.osm_edits_export_desc)));
|
||||||
((ImageView) mainView.findViewById(R.id.osm_notes_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_bug_dark));
|
|
||||||
((ImageView) mainView.findViewById(R.id.all_data_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_folder));
|
|
||||||
|
|
||||||
((TextView) mainView.findViewById(R.id.poi_count_text_view)).setText(String.valueOf(poiCount));
|
BaseBottomSheetItem poiItem = new BottomSheetItemWithDescription.Builder()
|
||||||
((TextView) mainView.findViewById(R.id.osm_notes_count_text_view)).setText(String.valueOf(osmNotesCount));
|
.setDescription(String.valueOf(poiCount))
|
||||||
((TextView) mainView.findViewById(R.id.all_data_count_text_view)).setText(String.valueOf(poiCount + osmNotesCount));
|
.setIcon(getContentIcon(R.drawable.ic_action_info_dark))
|
||||||
|
.setTitle(getString(R.string.poi))
|
||||||
View poiRow = mainView.findViewById(R.id.poi_row);
|
.setLayoutId(R.layout.bottom_sheet_item_with_right_descr)
|
||||||
if (poiCount > 0) {
|
.setDisabled(!(poiCount > 0))
|
||||||
poiRow.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI);
|
listener.onClick(OsmEditsFragment.EXPORT_TYPE_POI);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
}
|
}
|
||||||
dismiss();
|
})
|
||||||
}
|
.create();
|
||||||
});
|
items.add(poiItem);
|
||||||
} else {
|
|
||||||
disable(poiRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
View osmNotesRow = mainView.findViewById(R.id.osm_notes_row);
|
BaseBottomSheetItem osmNotesItem = new BottomSheetItemWithDescription.Builder()
|
||||||
if (osmNotesCount > 0) {
|
.setDescription(String.valueOf(osmNotesCount))
|
||||||
osmNotesRow.setOnClickListener(new View.OnClickListener() {
|
.setIcon(getContentIcon(R.drawable.ic_action_bug_dark))
|
||||||
@Override
|
.setTitle(getString(R.string.osm_notes))
|
||||||
public void onClick(View v) {
|
.setLayoutId(R.layout.bottom_sheet_item_with_right_descr)
|
||||||
if (listener != null) {
|
.setDisabled(!(osmNotesCount > 0))
|
||||||
listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES);
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onClick(OsmEditsFragment.EXPORT_TYPE_NOTES);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
}
|
}
|
||||||
dismiss();
|
})
|
||||||
}
|
.create();
|
||||||
});
|
items.add(osmNotesItem);
|
||||||
} else {
|
|
||||||
disable(osmNotesRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
View allDataRow = mainView.findViewById(R.id.all_data_row);
|
BaseBottomSheetItem allDataItem = new BottomSheetItemWithDescription.Builder()
|
||||||
if ((poiCount + osmNotesCount) > 0) {
|
.setDescription(String.valueOf(poiCount + osmNotesCount))
|
||||||
allDataRow.setOnClickListener(new View.OnClickListener() {
|
.setIcon(getContentIcon(R.drawable.ic_action_folder))
|
||||||
@Override
|
.setTitle(getString(R.string.all_data))
|
||||||
public void onClick(View v) {
|
.setLayoutId(R.layout.bottom_sheet_item_with_right_descr)
|
||||||
if (listener != null) {
|
.setDisabled(!(poiCount + osmNotesCount > 0))
|
||||||
listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL);
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onClick(OsmEditsFragment.EXPORT_TYPE_ALL);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
}
|
}
|
||||||
dismiss();
|
})
|
||||||
}
|
.create();
|
||||||
});
|
items.add(allDataItem);
|
||||||
} else {
|
|
||||||
disable(allDataRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
|
return null;
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setupHeightAndBackground(mainView, R.id.scroll_view);
|
|
||||||
|
|
||||||
return mainView;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disable(View view) {
|
|
||||||
view.setEnabled(false);
|
|
||||||
view.setAlpha(.5f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ExportOptionsFragmentListener {
|
public interface ExportOptionsFragmentListener {
|
||||||
|
|
Loading…
Reference in a new issue