Merge pull request #5089 from osmandapp/optimise_bottom_sheet_menus

Optimise bottom sheet menus
This commit is contained in:
Alexey 2018-03-02 16:34:16 +03:00 committed by GitHub
commit 7a699131ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 2217 additions and 4285 deletions

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
</LinearLayout>

View file

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<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_fav_dark"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/import_as_favorites"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>

View file

@ -1,22 +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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/header_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
tools:text="@string/import_file"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>

View 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"/>

View file

@ -0,0 +1,33 @@
<?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:gravity="center_vertical"
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_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Title"/>
</LinearLayout>

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

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<net.osmand.plus.widgets.TextViewEx
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:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:minHeight="@dimen/bottom_sheet_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"
tools:text="Some Title"/>

View file

@ -0,0 +1,47 @@
<?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="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/list_destination"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Some title"/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
tools:text="Some description"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,60 @@
<?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="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/list_destination"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Some title"/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
tools:text="Some description"/>
</LinearLayout>
<android.support.v7.widget.SwitchCompat
android:id="@+id/compound_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>

View file

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

View file

@ -0,0 +1,46 @@
<?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:gravity="center_vertical"
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:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="Description"/>
</LinearLayout>

View 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:gravity="center_vertical"
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="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_coordinates_latitude"/>
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
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="Some Title"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/compound_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>

View file

@ -0,0 +1,49 @@
<?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="wrap_content"
android:orientation="vertical"
tools:background="?attr/bg_color">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/items_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"/>
</ScrollView>
<View
android:id="@+id/close_row_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/close_row_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"
tools:text="@string/shared_string_cancel"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,309 +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:orientation="vertical"
tools:background="?attr/bg_color">
<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:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/new_destination_point_dialog"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/replace_dest_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
android:src="@drawable/list_destination"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/replace_destination_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:id="@+id/current_dest_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/searchbar_text_hint_light"
android:textSize="@dimen/default_desc_text_size"
tools:text="Current: Some street 46"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/replace_start_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
android:src="@drawable/list_startpoint"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/make_as_start_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:id="@+id/current_start_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/searchbar_text_hint_light"
android:textSize="@dimen/default_desc_text_size"
tools:text="Current: My location"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/current_dest_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_content_padding_small"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/subsequent_dest_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/subsequent_dest_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:foreground="@drawable/ic_action_route_subsequent_destination"
tools:src="@drawable/ic_action_route_subsequent_destination_point"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/keep_and_add_destination_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/subsequent_dest_description"
android:textColor="@color/searchbar_text_hint_light"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/first_intermediate_dest_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/first_interm_dest_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:foreground="@drawable/ic_action_route_first_intermediate"
tools:src="@drawable/ic_action_route_first_intermediate_point"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/add_as_first_destination_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/first_intermediate_dest_description"
android:textColor="@color/searchbar_text_hint_light"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/last_intermediate_dest_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/last_interm_dest_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:foreground="@drawable/ic_action_route_last_intermediate"
tools:src="@drawable/ic_action_route_last_intermediate_point"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/add_as_last_destination_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/last_intermediate_dest_description"
android:textColor="@color/searchbar_text_hint_light"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:id="@+id/cancel_divider"
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: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>

View file

@ -1,142 +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:layout_gravity="bottom"
android:background="?attr/bg_color"
android:orientation="vertical">
<ScrollView
android:id="@+id/import_gpx_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/import_gpx_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/import_file"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:id="@+id/import_gpx_description"
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:textSize="@dimen/default_desc_text_size"
tools:text="Berlin_CultourTour.gpx can be imported as Favorites points, or as track file."/>
<LinearLayout
android:id="@+id/import_as_favorites_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/import_as_favorites_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_fav_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/import_as_favorites"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/import_as_gpx_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/import_as_gpx_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_polygom_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/import_as_gpx"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</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: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>

View file

@ -11,8 +11,7 @@
android:id="@+id/groups_recycler_view" android:id="@+id/groups_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipToPadding="false" android:clipToPadding="false"/>
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"/>
<ProgressBar <ProgressBar
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
@ -36,26 +35,4 @@
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
tools:visibility="visible"/> tools:visibility="visible"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
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> </LinearLayout>

View file

@ -1,129 +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/add_markers_group_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/add_group_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/add_group"
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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/add_group_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
<LinearLayout
android:id="@+id/favourites_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:gravity="center_vertical">
<ImageView
android:id="@+id/favourites_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_fav_dark"/>
<TextView
android:id="@+id/favourites_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/favourites_group"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/waypoints_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:gravity="center_vertical">
<ImageView
android:id="@+id/waypoints_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
android:id="@+id/waypoints_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/track_waypoints"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,168 +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/marker_coordinate_input_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/coordinate_input_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/shared_string_options"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/use_system_keyboard_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:descendantFocusability="blocksDescendants"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/use_system_keyboard_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_keyboard"/>
<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/use_system_keyboard"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/use_system_keyboard_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/hand_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:descendantFocusability="blocksDescendants"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/hand_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_show_keypad_right"/>
<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/show_number_pad"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/hand_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:maxLines="1"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Right"
tools:textColor="@color/map_widget_blue_pressed"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:text="@string/coordinates_format"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
<LinearLayout
android:id="@+id/formats_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,161 +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/history_marker_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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_selected_item_title_height"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:orientation="horizontal"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/map_marker_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_flag_dark"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Bloemstraat 179"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_passed_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Passed: July 28"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/make_active_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:layout_marginTop="@dimen/bottom_sheet_content_margin_small"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/make_active_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_reset_to_default_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/make_active"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/delete_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/delete_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_delete_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_delete"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</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_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,224 +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/marker_order_by_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/order_by_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/sort_by"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/name_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/name_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_by_name"/>
<TextView
android:id="@+id/name_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_name"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/distance_nearest_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/distance_nearest_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_markers_dark"/>
<TextView
android:id="@+id/distance_nearest_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/distance_nearest"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/distance_farthest_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/distance_farthest_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_markers_dark"/>
<TextView
android:id="@+id/distance_farthest_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/distance_farthest"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/date_added_asc_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/date_added_asc_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_by_date"/>
<TextView
android:id="@+id/date_added_asc_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Date added (Ascendingly)"/>
</LinearLayout>
<LinearLayout
android:id="@+id/date_added_desc_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/date_added_desc_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_by_date"/>
<TextView
android:id="@+id/date_added_desc_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Date added (Descendingly)"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,220 +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:layout_gravity="bottom"
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:gravity="center_vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"
tools:text="Paris Hotel"/>
<LinearLayout
android:id="@+id/play_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/play_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_play_dark"/>
<TextView
android:id="@+id/play_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Play"/>
</LinearLayout>
<LinearLayout
android:id="@+id/share_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/share_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_gshare_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_share"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/show_on_map_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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/show_on_map_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_show_on_map"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/shared_string_show_on_map"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:id="@+id/show_on_map_descr_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="52.23423, 14.34578"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/rename_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/rename_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_edit_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_rename"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/delete_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/delete_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_delete_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_delete"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,111 +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:layout_gravity="bottom"
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:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:text="@string/shared_string_sort"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/by_type_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/by_type_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_groped_by_type"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/by_type"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/by_date_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/by_date_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_by_date"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/by_date"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/close_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
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>

View file

@ -1,269 +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/measure_options_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/options_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/shared_string_options"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<RelativeLayout
android:id="@+id/snap_to_road_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/snap_to_road_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_snap_to_road"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/snap_to_road_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/snap_to_road_icon"
android:layout_toLeftOf="@id/snap_to_road_switch"
android:layout_toRightOf="@id/snap_to_road_icon"
android:layout_toStartOf="@id/snap_to_road_switch"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/snap_to_road"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:id="@+id/snap_to_road_enabled_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shared_string_enabled"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/save_as_new_segment_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:visibility="gone">
<ImageView
android:id="@+id/save_as_new_segment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/save_as_new_segment_icon"
android:layout_toRightOf="@id/save_as_new_segment_icon"
android:maxLines="1"
android:text="@string/shared_string_save"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/save_as_new_track_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/save_as_new_track_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/save_as_new_track_icon"
android:layout_toRightOf="@id/save_as_new_track_icon"
android:maxLines="1"
android:text="@string/shared_string_save_as_gpx"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/add_to_the_track_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/add_to_the_track_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_split_interval"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/add_to_the_track_icon"
android:layout_toRightOf="@id/add_to_the_track_icon"
android:maxLines="1"
android:text="@string/add_segment_to_the_track"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/clear_all_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/clear_all_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_reset_to_default_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/clear_all_icon"
android:layout_toRightOf="@id/clear_all_icon"
android:maxLines="1"
android:text="@string/shared_string_clear_all"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
</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_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,210 +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/osm_edit_options_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/osm_edit_name"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
tools:text="Universal Bank"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/upload_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/upload_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_export"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/local_openstreetmap_upload"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/show_on_map_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/show_on_map_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:background="@drawable/ic_show_on_map"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/shared_string_show_on_map"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:visibility="gone"
tools:visibility="visible"
android:id="@+id/modify_osm_change_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/modify_osm_change_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_edit_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/poi_context_menu_modify_osm_change"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:visibility="gone"
tools:visibility="visible"
android:id="@+id/modify_osm_note_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/modify_osm_note_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_edit_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/context_menu_item_modify_note"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/delete_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/delete_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_delete_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/shared_string_delete"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</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_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -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>

View file

@ -1,164 +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:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/choose_file_type"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/osc_file_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/osc_file_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_type_file"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/osc_file"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/osc_file_desc"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_content_padding_small"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/gpx_file_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/gpx_file_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_type_file"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/gpx_file"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/gpx_file_desc"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,258 +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/sort_by_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"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/shared_string_options"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/select_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/select_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_select_all"/>
<TextView
android:id="@+id/select_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Select all"/>
</LinearLayout>
<LinearLayout
android:id="@+id/navigate_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/navigate_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/map_directions"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/get_directions"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/make_round_trip_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/make_round_trip_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_trip_round"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/make_round_trip"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/make_round_trip_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
<android.support.v7.widget.SwitchCompat
android:id="@+id/make_round_trip_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
android:background="?attr/dashboard_divider"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/sort_by"
android:textAllCaps="true"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/door_to_door_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/door_to_door_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_door_to_door"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/intermediate_items_sort_by_distance"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/reverse_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/reverse_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_sort_reverse_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/shared_string_reverse_order"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,206 +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/save_as_new_track_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/save_as_new_track_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/shared_string_save_as_gpx"
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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:text="@string/measurement_tool_save_as_new_track_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
<LinearLayout
android:id="@+id/images_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin_small"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginRight="@dimen/bottom_sheet_content_margin_small"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:layout_weight="1">
<ImageView
android:id="@+id/route_point_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:foreground="?attr/selectableItemBackground"
tools:src="@drawable/img_help_trip_route_points_night"/>
<TextView
android:id="@+id/route_point_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/route_point_image"
android:layout_alignStart="@id/route_point_image"
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_content_margin_small"
android:text="@string/route_point"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_split_segments_sub"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginRight="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
android:layout_weight="1">
<ImageView
android:id="@+id/line_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:foreground="?attr/selectableItemBackground"
tools:src="@drawable/img_help_trip_track_night"/>
<TextView
android:id="@+id/line_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/line_image"
android:layout_alignStart="@id/line_image"
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_content_margin_small"
android:text="@string/line"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_split_segments_sub"/>
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/save_as_route_point_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/route_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_route_points"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/route_point_icon"
android:layout_toRightOf="@id/route_point_icon"
android:maxLines="1"
android:text="@string/save_as_route_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/save_as_line_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/line_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_split_interval"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/line_icon"
android:layout_toRightOf="@id/line_icon"
android:maxLines="1"
android:text="@string/save_as_line"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
</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: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>

View file

@ -0,0 +1,81 @@
<?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="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/bottom_sheet_content_margin"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin_small"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin"
android:layout_marginRight="@dimen/bottom_sheet_content_margin_small"
android:layout_marginStart="@dimen/bottom_sheet_content_margin"
android:layout_weight="1">
<ImageView
android:id="@+id/route_point_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:foreground="?attr/selectableItemBackground"
tools:src="@drawable/img_help_trip_route_points_night"/>
<TextView
android:id="@+id/route_point_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/route_point_image"
android:layout_alignStart="@id/route_point_image"
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_content_margin_small"
android:text="@string/route_point"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_split_segments_sub"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_content_margin"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginRight="@dimen/bottom_sheet_content_margin"
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
android:layout_weight="1">
<ImageView
android:id="@+id/line_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:foreground="?attr/selectableItemBackground"
tools:src="@drawable/img_help_trip_track_night"/>
<TextView
android:id="@+id/line_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/line_image"
android:layout_alignStart="@id/line_image"
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_content_margin_small"
android:text="@string/line"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_split_segments_sub"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>

View file

@ -1,261 +0,0 @@
<?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="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<ScrollView
android:id="@+id/selected_point_options_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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_selected_item_title_height"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/selected_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_measure_point"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toEndOf="@id/selected_point_icon"
android:layout_toRightOf="@id/selected_point_icon"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/selected_point_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Point 2"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/selected_point_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="386 m"/>
<android.support.v7.widget.AppCompatTextView
android:maxLines="1"
android:id="@+id/selected_point_ele"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
android:layout_marginRight="@dimen/bottom_sheet_content_margin_small"
tools:text="A: 345 m"/>
<android.support.v7.widget.AppCompatTextView
android:maxLines="1"
android:id="@+id/selected_point_speed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="S: 45 km/h"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/measurement_tool_divider_margin"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/move_point_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/move_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_move_point"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/move_point_icon"
android:layout_toRightOf="@id/move_point_icon"
android:maxLines="1"
android:text="@string/shared_string_move"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/delete_point_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/delete_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_remove_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/delete_point_icon"
android:layout_toRightOf="@id/delete_point_icon"
android:maxLines="1"
android:text="@string/shared_string_delete"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/add_point_after_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/add_point_after_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_addpoint_above"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/add_point_after_icon"
android:layout_toRightOf="@id/add_point_after_icon"
android:maxLines="1"
android:text="@string/add_point_after"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/add_point_before_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:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding">
<ImageView
android:id="@+id/add_point_before_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_addpoint_below"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/add_point_before_icon"
android:layout_toRightOf="@id/add_point_before_icon"
android:maxLines="1"
android:text="@string/add_point_before"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</RelativeLayout>
</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_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -1,61 +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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<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/share_menu_location"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:dividerHeight="0dp"/>
</LinearLayout>
<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>

View file

@ -1,20 +1,16 @@
package net.osmand.plus.audionotes; package net.osmand.plus.audionotes;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
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.audionotes.AudioVideoNotesPlugin.Recording; import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import java.text.DecimalFormat; import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import java.text.NumberFormat; import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -32,86 +28,94 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
this.recording = recording; this.recording = recording;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_notes_item_menu_bottom_sheet_dialog, null);
if (recording != null) { if (recording != null) {
NumberFormat f = new DecimalFormat("#0.00000"); items.add(new TitleItem(recording.getName(getContext(), true)));
((TextView) mainView.findViewById(R.id.title_text_view))
.setText(recording.getName(getActivity(), true)); BaseBottomSheetItem playItem = new SimpleBottomSheetItem.Builder()
((TextView) mainView.findViewById(R.id.play_text_view)) .setIcon(getContentIcon(recording.isPhoto() ? R.drawable.ic_action_view : R.drawable.ic_play_dark))
.setText(recording.isPhoto() ? R.string.watch : R.string.recording_context_menu_play); .setTitle(getString(recording.isPhoto() ? R.string.watch : R.string.recording_context_menu_play))
((TextView) mainView.findViewById(R.id.show_on_map_descr_text_view)) .setLayoutId(R.layout.bottom_sheet_item_simple)
.setText(f.format(recording.getLatitude()) + ", " + f.format(recording.getLongitude())); .setOnClickListener(new View.OnClickListener() {
((ImageView) mainView.findViewById(R.id.play_icon)) @Override
.setImageDrawable(getContentIcon(recording.isPhoto() ? R.drawable.ic_action_view : R.drawable.ic_play_dark)); public void onClick(View v) {
if (listener != null) {
listener.playOnClick(recording);
}
dismiss();
}
})
.create();
items.add(playItem);
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_gshare_dark))
.setTitle(getString(R.string.shared_string_share))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.shareOnClick(recording);
}
dismiss();
}
})
.create();
items.add(shareItem);
BaseBottomSheetItem showOnMapItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getString(R.string.route_descr_lat_lon, recording.getLatitude(), recording.getLongitude()))
.setIcon(getContentIcon(R.drawable.ic_show_on_map))
.setTitle(getString(R.string.shared_string_show_on_map))
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.showOnMapOnClick(recording);
}
dismiss();
}
})
.create();
items.add(showOnMapItem);
items.add(new DividerHalfItem(getContext()));
BaseBottomSheetItem renameItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_edit_dark))
.setTitle(getString(R.string.shared_string_rename))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.renameOnClick(recording);
}
dismiss();
}
})
.create();
items.add(renameItem);
BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_delete_dark))
.setTitle(getString(R.string.shared_string_delete))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.deleteOnClick(recording);
}
dismiss();
}
})
.create();
items.add(deleteItem);
} }
((ImageView) mainView.findViewById(R.id.share_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_gshare_dark));
((ImageView) mainView.findViewById(R.id.show_on_map_icon)).setImageDrawable(getContentIcon(R.drawable.ic_show_on_map));
((ImageView) mainView.findViewById(R.id.rename_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark));
((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark));
mainView.findViewById(R.id.play_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null && recording != null) {
listener.playOnClick(recording);
}
dismiss();
}
});
mainView.findViewById(R.id.share_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null && recording != null) {
listener.shareOnClick(recording);
}
dismiss();
}
});
mainView.findViewById(R.id.show_on_map_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null && recording != null) {
listener.showOnMapOnClick(recording);
}
dismiss();
}
});
mainView.findViewById(R.id.rename_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null && recording != null) {
listener.renameOnClick(recording);
}
dismiss();
}
});
mainView.findViewById(R.id.delete_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null && recording != null) {
listener.deleteOnClick(recording);
}
dismiss();
}
});
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.scroll_view);
return mainView;
} }
@Override @Override
@ -122,6 +126,11 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
super.onDestroyView(); super.onDestroyView();
} }
@Override
protected int getCloseRowTextId() {
return R.string.shared_string_close;
}
interface ItemMenuFragmentListener { interface ItemMenuFragmentListener {
void playOnClick(Recording recording); void playOnClick(Recording recording);

View file

@ -1,18 +1,15 @@
package net.osmand.plus.audionotes; package net.osmand.plus.audionotes;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.NotesSortByMode; import net.osmand.plus.OsmandSettings.NotesSortByMode;
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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class SortByMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class SortByMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -24,39 +21,35 @@ public class SortByMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFr
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.shared_string_sort)));
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), BaseBottomSheetItem byTypeItem = new SimpleBottomSheetItem.Builder()
R.layout.fragment_notes_sort_bottom_sheet_dialog, null); .setIcon(getContentIcon(R.drawable.ic_groped_by_type))
.setTitle(getString(R.string.by_type))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectSortByMode(NotesSortByMode.BY_TYPE);
}
})
.create();
items.add(byTypeItem);
((ImageView) mainView.findViewById(R.id.by_type_icon)).setImageDrawable(getContentIcon(R.drawable.ic_groped_by_type)); BaseBottomSheetItem byDateItem = new SimpleBottomSheetItem.Builder()
((ImageView) mainView.findViewById(R.id.by_date_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_by_date)); .setIcon(getContentIcon(R.drawable.ic_action_sort_by_date))
.setTitle(getString(R.string.by_date))
mainView.findViewById(R.id.by_type_row).setOnClickListener(new OnClickListener() { .setLayoutId(R.layout.bottom_sheet_item_simple)
@Override .setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { @Override
selectSortByMode(NotesSortByMode.BY_TYPE); public void onClick(View v) {
} selectSortByMode(NotesSortByMode.BY_DATE);
}); }
mainView.findViewById(R.id.by_date_row).setOnClickListener(new OnClickListener() { })
@Override .create();
public void onClick(View v) { items.add(byDateItem);
selectSortByMode(NotesSortByMode.BY_DATE);
}
});
mainView.findViewById(R.id.close_row).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.scroll_view);
return mainView;
} }
private void selectSortByMode(NotesSortByMode mode) { private void selectSortByMode(NotesSortByMode mode) {

View file

@ -4,23 +4,41 @@ import android.app.Activity;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import java.util.ArrayList;
import java.util.List;
public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFragment { public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFragment {
private static final String USED_ON_MAP_KEY = "used_on_map"; private static final String USED_ON_MAP_KEY = "used_on_map";
protected List<BaseBottomSheetItem> items = new ArrayList<>();
protected boolean usedOnMap = true; protected boolean usedOnMap = true;
protected boolean nightMode; protected boolean nightMode;
private LinearLayout itemsContainer;
public void setUsedOnMap(boolean usedOnMap) { public void setUsedOnMap(boolean usedOnMap) {
this.usedOnMap = usedOnMap; this.usedOnMap = usedOnMap;
} }
@ -34,6 +52,40 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
nightMode = isNightMode(); nightMode = isNightMode();
} }
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
createMenuItems(savedInstanceState);
OsmandApplication app = getMyApplication();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View mainView = View.inflate(new ContextThemeWrapper(app, themeRes), R.layout.bottom_sheet_menu_base, null);
itemsContainer = (LinearLayout) mainView.findViewById(R.id.items_container);
for (BaseBottomSheetItem item : items) {
item.inflate(app, itemsContainer, nightMode);
}
int closeRowDividerColorId = getCloseRowDividerColorId();
if (closeRowDividerColorId != -1) {
mainView.findViewById(R.id.close_row_divider)
.setBackgroundColor(ContextCompat.getColor(getContext(), closeRowDividerColorId));
}
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onCloseRowClickAction();
dismiss();
}
});
((TextView) mainView.findViewById(R.id.close_row_text)).setText(getCloseRowTextId());
setupHeightAndBackground(mainView, R.id.scroll_view);
return mainView;
}
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
@ -51,6 +103,17 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
outState.putBoolean(USED_ON_MAP_KEY, usedOnMap); outState.putBoolean(USED_ON_MAP_KEY, usedOnMap);
} }
@Override
public void onDestroyView() {
super.onDestroyView();
items.clear();
if (itemsContainer != null) {
itemsContainer.removeAllViews();
}
}
public abstract void createMenuItems(Bundle savedInstanceState);
@Override @Override
protected Drawable getContentIcon(@DrawableRes int id) { protected Drawable getContentIcon(@DrawableRes int id) {
return getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color); return getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
@ -99,6 +162,20 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
}); });
} }
@ColorRes
protected int getCloseRowDividerColorId() {
return -1;
}
@StringRes
protected int getCloseRowTextId() {
return R.string.shared_string_cancel;
}
protected void onCloseRowClickAction() {
}
@DrawableRes @DrawableRes
protected int getPortraitBgResId() { protected int getPortraitBgResId() {
return nightMode ? R.drawable.bg_bottom_menu_dark : R.drawable.bg_bottom_menu_light; return nightMode ? R.drawable.bg_bottom_menu_dark : R.drawable.bg_bottom_menu_light;

View file

@ -0,0 +1,115 @@
package net.osmand.plus.base.bottomsheetmenu;
import android.support.annotation.LayoutRes;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
public class BaseBottomSheetItem {
public static final int INVALID_POSITION = -1;
public static final int INVALID_ID = -1;
protected View view;
@LayoutRes
protected int layoutId = INVALID_ID;
private Object tag;
private boolean disabled;
private View.OnClickListener onClickListener;
protected int position = INVALID_POSITION;
public BaseBottomSheetItem(View view,
@LayoutRes int layoutId,
Object tag,
boolean disabled,
View.OnClickListener onClickListener,
int position) {
this.view = view;
this.layoutId = layoutId;
this.tag = tag;
this.disabled = disabled;
this.onClickListener = onClickListener;
this.position = position;
}
protected BaseBottomSheetItem() {
}
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
View view = getView(app, nightMode);
if (tag != null) {
view.setTag(tag);
}
if (disabled) {
view.setEnabled(false);
view.setAlpha(.5f);
}
view.setOnClickListener(onClickListener);
view.setClickable(onClickListener != null);
if (position != INVALID_POSITION) {
container.addView(view, position);
} else {
container.addView(view);
}
}
private View getView(OsmandApplication app, boolean nightMode) {
if (view != null) {
return view;
}
if (layoutId != INVALID_ID) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
return view = View.inflate(new ContextThemeWrapper(app, themeRes), layoutId, null);
}
throw new RuntimeException("BottomSheetItem must have specified view or layoutId.");
}
public static class Builder {
protected View customView;
@LayoutRes
protected int layoutId = INVALID_ID;
protected Object tag;
protected boolean disabled;
protected View.OnClickListener onClickListener;
protected int position = INVALID_POSITION;
public Builder setCustomView(View customView) {
this.customView = customView;
return this;
}
public Builder setLayoutId(@LayoutRes int layoutId) {
this.layoutId = layoutId;
return this;
}
public Builder setTag(Object tag) {
this.tag = tag;
return this;
}
public Builder setDisabled(boolean disabled) {
this.disabled = disabled;
return this;
}
public Builder setOnClickListener(View.OnClickListener onClickListener) {
this.onClickListener = onClickListener;
return this;
}
public Builder setPosition(int position) {
this.position = position;
return this;
}
public BaseBottomSheetItem create() {
return new BaseBottomSheetItem(customView, layoutId, tag, disabled, onClickListener, position);
}
}
}

View file

@ -0,0 +1,87 @@
package net.osmand.plus.base.bottomsheetmenu;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.LayoutRes;
import android.support.v4.widget.CompoundButtonCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
public class BottomSheetItemWithCompoundButton extends BottomSheetItemWithDescription {
private boolean checked;
private ColorStateList buttonTintList;
public BottomSheetItemWithCompoundButton(View customView,
@LayoutRes int layoutId,
Object tag,
boolean disabled,
View.OnClickListener onClickListener,
int position,
Drawable icon,
String title,
@ColorRes int titleColorId,
CharSequence description,
@ColorRes int descriptionColorId,
boolean checked,
ColorStateList buttonTintList) {
super(customView,
layoutId,
tag,
disabled,
onClickListener,
position,
icon,
title,
titleColorId,
description,
descriptionColorId);
this.checked = checked;
this.buttonTintList = buttonTintList;
}
@Override
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
super.inflate(app, container, nightMode);
CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.compound_button);
compoundButton.setChecked(checked);
CompoundButtonCompat.setButtonTintList(compoundButton, buttonTintList);
}
public static class Builder extends BottomSheetItemWithDescription.Builder {
protected boolean checked;
protected ColorStateList buttonTintList;
public Builder setChecked(boolean checked) {
this.checked = checked;
return this;
}
public Builder setButtonTintList(ColorStateList buttonTintList) {
this.buttonTintList = buttonTintList;
return this;
}
public BottomSheetItemWithCompoundButton create() {
return new BottomSheetItemWithCompoundButton(customView,
layoutId,
tag,
disabled,
onClickListener,
position,
icon,
title,
titleColorId,
description,
descriptionColorId,
checked,
buttonTintList);
}
}
}

View file

@ -0,0 +1,82 @@
package net.osmand.plus.base.bottomsheetmenu;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.LayoutRes;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
public class BottomSheetItemWithDescription extends SimpleBottomSheetItem {
protected CharSequence description;
@ColorRes
private int descriptionColorId = INVALID_ID;
public BottomSheetItemWithDescription(View customView,
@LayoutRes int layoutId,
Object tag,
boolean disabled,
View.OnClickListener onClickListener,
int position,
Drawable icon,
String title,
@ColorRes int titleColorId,
CharSequence description,
@ColorRes int descriptionColorId) {
super(customView, layoutId, tag, disabled, onClickListener, position, icon, title, titleColorId);
this.description = description;
this.descriptionColorId = descriptionColorId;
}
protected BottomSheetItemWithDescription() {
}
@Override
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
super.inflate(app, container, nightMode);
if (description != null) {
TextView descriptionTv = (TextView) view.findViewById(R.id.description);
descriptionTv.setText(description);
if (descriptionColorId != INVALID_ID) {
descriptionTv.setTextColor(ContextCompat.getColor(app, descriptionColorId));
}
}
}
public static class Builder extends SimpleBottomSheetItem.Builder {
protected CharSequence description;
@ColorRes
protected int descriptionColorId = INVALID_ID;
public Builder setDescription(CharSequence description) {
this.description = description;
return this;
}
public Builder setDescriptionColorId(@ColorRes int descriptionColorId) {
this.descriptionColorId = descriptionColorId;
return this;
}
public BottomSheetItemWithDescription create() {
return new BottomSheetItemWithDescription(customView,
layoutId,
tag,
disabled,
onClickListener,
position,
icon,
title,
titleColorId,
description,
descriptionColorId);
}
}
}

View file

@ -0,0 +1,90 @@
package net.osmand.plus.base.bottomsheetmenu;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.LayoutRes;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
public class SimpleBottomSheetItem extends BaseBottomSheetItem {
private Drawable icon;
protected String title;
@ColorRes
protected int titleColorId = INVALID_ID;
public SimpleBottomSheetItem(View customView,
@LayoutRes int layoutId,
Object tag,
boolean disabled,
View.OnClickListener onClickListener,
int position,
Drawable icon,
String title,
@ColorRes int titleColorId) {
super(customView, layoutId, tag, disabled, onClickListener, position);
this.icon = icon;
this.title = title;
this.titleColorId = titleColorId;
}
protected SimpleBottomSheetItem() {
}
@Override
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
super.inflate(app, container, nightMode);
if (icon != null) {
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(icon);
}
if (title != null) {
TextView titleTv = (TextView) view.findViewById(R.id.title);
titleTv.setText(title);
if (titleColorId != INVALID_ID) {
titleTv.setTextColor(ContextCompat.getColor(app, titleColorId));
}
}
}
public static class Builder extends BaseBottomSheetItem.Builder {
protected Drawable icon;
protected String title;
@ColorRes
protected int titleColorId = INVALID_ID;
public Builder setIcon(Drawable icon) {
this.icon = icon;
return this;
}
public Builder setTitle(String title) {
this.title = title;
return this;
}
public Builder setTitleColorId(@ColorRes int titleColorId) {
this.titleColorId = titleColorId;
return this;
}
public SimpleBottomSheetItem create() {
return new SimpleBottomSheetItem(customView,
layoutId,
tag,
disabled,
onClickListener,
position,
icon,
title,
titleColorId);
}
}
}

View file

@ -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(CharSequence description) {
this.description = description;
this.layoutId = R.layout.bottom_sheet_item_description;
}
}

View file

@ -0,0 +1,31 @@
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
import android.content.Context;
import android.support.annotation.ColorRes;
import net.osmand.plus.R;
public class DividerHalfItem extends DividerItem {
public DividerHalfItem(Context context) {
super(context);
}
public DividerHalfItem(Context context, @ColorRes int colorId) {
super(context, colorId);
}
public DividerHalfItem(Context context, @ColorRes int colorId, int position) {
super(context, colorId, position);
}
@Override
protected int getTopMargin(Context context) {
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_divider_margin_top);
}
@Override
protected int getLeftMargin(Context context) {
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_divider_margin_start);
}
}

View file

@ -0,0 +1,71 @@
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
import android.content.Context;
import android.support.annotation.ColorRes;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
public class DividerItem extends BaseBottomSheetItem {
@ColorRes
private int colorId;
public DividerItem(Context context) {
setupView(context, INVALID_ID, INVALID_POSITION);
}
public DividerItem(Context context, @ColorRes int colorId) {
setupView(context, colorId, INVALID_POSITION);
}
public DividerItem(Context context, @ColorRes int colorId, int position) {
setupView(context, colorId, position);
}
private void setupView(Context context, @ColorRes int colorId, int position) {
view = new View(context);
this.colorId = colorId;
this.position = position;
}
@Override
public void inflate(OsmandApplication app, ViewGroup container, boolean nightMode) {
super.inflate(app, container, nightMode);
int height = AndroidUtils.dpToPx(app, 1);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) view.getLayoutParams();
params.setMargins(getLeftMargin(app), getTopMargin(app), 0, getBottomMargin(app));
params.height = height;
view.setMinimumHeight(height);
view.setBackgroundColor(ContextCompat.getColor(app, getBgColorId(nightMode)));
}
protected int getTopMargin(Context context) {
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
}
protected int getLeftMargin(Context context) {
return 0;
}
protected int getBottomMargin(Context context) {
return context.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_content_padding_small);
}
@ColorRes
private int getBgColorId(boolean nightMode) {
if (colorId != INVALID_ID) {
return colorId;
}
return nightMode ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light;
}
}

View file

@ -0,0 +1,24 @@
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
import android.content.Context;
import android.support.annotation.ColorRes;
public class SubtitleDividerItem extends DividerItem {
public SubtitleDividerItem(Context context) {
super(context);
}
public SubtitleDividerItem(Context context, @ColorRes int colorId) {
super(context, colorId);
}
public SubtitleDividerItem(Context context, @ColorRes int colorId, int position) {
super(context, colorId, position);
}
@Override
protected int getBottomMargin(Context context) {
return 0;
}
}

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

@ -0,0 +1,24 @@
package net.osmand.plus.base.bottomsheetmenu.simpleitems;
import android.content.Context;
import android.support.annotation.ColorRes;
public class TitleDividerItem extends DividerItem {
public TitleDividerItem(Context context) {
super(context);
}
public TitleDividerItem(Context context, @ColorRes int colorId) {
super(context, colorId);
}
public TitleDividerItem(Context context, @ColorRes int colorId, int position) {
super(context, colorId, position);
}
@Override
protected int getTopMargin(Context context) {
return 0;
}
}

View file

@ -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);
}
}

View file

@ -8,13 +8,7 @@ import android.graphics.drawable.LayerDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
@ -23,6 +17,10 @@ import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity; 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.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -31,68 +29,103 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
public static final String LON_KEY = "longitude"; public static final String LON_KEY = "longitude";
public static final String POINT_DESCRIPTION_KEY = "point_description"; public static final String POINT_DESCRIPTION_KEY = "point_description";
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
Bundle args = getArguments(); Bundle args = getArguments();
final LatLon latLon = new LatLon(args.getDouble(LAT_KEY), args.getDouble(LON_KEY)); final LatLon latLon = new LatLon(args.getDouble(LAT_KEY), args.getDouble(LON_KEY));
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();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.new_destination_point_dialog)));
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_add_waypoint_bottom_sheet_dialog, container);
((TextView) mainView.findViewById(R.id.current_dest_text_view)) BaseBottomSheetItem replaceDestItem = new BottomSheetItemWithDescription.Builder()
.setText(getCurrentPointName(targetPointsHelper.getPointToNavigate(), false)); .setDescription(getCurrentPointName(targetPointsHelper.getPointToNavigate(), false))
((TextView) mainView.findViewById(R.id.current_start_text_view)) .setDescriptionColorId(R.color.searchbar_text_hint_light)
.setText(getCurrentPointName(targetPointsHelper.getPointToStart(), true)); .setIcon(getIcon(R.drawable.list_destination, 0))
.setTitle(getString(R.string.replace_destination_point))
((ImageView) mainView.findViewById(R.id.subsequent_dest_icon)).setImageDrawable(getSubsequentDestIcon()); .setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
((ImageView) mainView.findViewById(R.id.first_interm_dest_icon)).setImageDrawable(getFirstIntermDestIcon()); .setOnClickListener(new View.OnClickListener() {
((ImageView) mainView.findViewById(R.id.last_interm_dest_icon)).setImageDrawable(getLastIntermDistIcon()); @Override
public void onClick(View v) {
View.OnClickListener onClickListener = new View.OnClickListener() { targetPointsHelper.navigateToPoint(latLon, true, -1, name);
@Override dismiss();
public void onClick(View v) {
int id = v.getId();
if (id == R.id.replace_dest_row) {
targetPointsHelper.navigateToPoint(latLon, true, -1, name);
} else if (id == R.id.replace_start_row) {
TargetPoint start = targetPointsHelper.getPointToStart();
if (start != null) {
targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), start.getLongitude()),
false, 0, start.getOriginalPointDescription());
} }
targetPointsHelper.setStartPoint(latLon, true, name); })
} else if (id == R.id.subsequent_dest_row) { .create();
targetPointsHelper.navigateToPoint(latLon, true, items.add(replaceDestItem);
targetPointsHelper.getIntermediatePoints().size() + 1, name);
} else if (id == R.id.first_intermediate_dest_row) {
targetPointsHelper.navigateToPoint(latLon, true, 0, name);
} else if (id == R.id.last_intermediate_dest_row) {
targetPointsHelper.navigateToPoint(latLon, true, targetPointsHelper.getIntermediatePoints().size(), name);
}
dismiss();
}
};
mainView.findViewById(R.id.replace_dest_row).setOnClickListener(onClickListener); BaseBottomSheetItem replaceStartItem = new BottomSheetItemWithDescription.Builder()
mainView.findViewById(R.id.replace_start_row).setOnClickListener(onClickListener); .setDescription(getCurrentPointName(targetPointsHelper.getPointToStart(), true))
mainView.findViewById(R.id.subsequent_dest_row).setOnClickListener(onClickListener); .setDescriptionColorId(R.color.searchbar_text_hint_light)
mainView.findViewById(R.id.first_intermediate_dest_row).setOnClickListener(onClickListener); .setIcon(getIcon(R.drawable.list_startpoint, 0))
mainView.findViewById(R.id.last_intermediate_dest_row).setOnClickListener(onClickListener); .setTitle(getString(R.string.make_as_start_point))
mainView.findViewById(R.id.cancel_row).setOnClickListener(onClickListener); .setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TargetPoint start = targetPointsHelper.getPointToStart();
if (start != null) {
targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), start.getLongitude()),
false, 0, start.getOriginalPointDescription());
}
targetPointsHelper.setStartPoint(latLon, true, name);
dismiss();
}
})
.create();
items.add(replaceStartItem);
if (nightMode) { items.add(new DividerHalfItem(getContext(), getCloseRowDividerColorId()));
int dividerColor = ContextCompat.getColor(getContext(), R.color.route_info_bottom_view_bg_dark);
mainView.findViewById(R.id.current_dest_divider).setBackgroundColor(dividerColor);
mainView.findViewById(R.id.cancel_divider).setBackgroundColor(dividerColor);
}
setupHeightAndBackground(mainView, R.id.scroll_view); BaseBottomSheetItem subsequentDestItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getString(R.string.subsequent_dest_description))
.setDescriptionColorId(R.color.searchbar_text_hint_light)
.setIcon(getSubsequentDestIcon())
.setTitle(getString(R.string.keep_and_add_destination_point))
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
targetPointsHelper.navigateToPoint(latLon, true,
targetPointsHelper.getIntermediatePoints().size() + 1, name);
dismiss();
}
})
.create();
items.add(subsequentDestItem);
return mainView; BaseBottomSheetItem firstIntermItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getString(R.string.first_intermediate_dest_description))
.setDescriptionColorId(R.color.searchbar_text_hint_light)
.setIcon(getFirstIntermDestIcon())
.setTitle(getString(R.string.add_as_first_destination_point))
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
targetPointsHelper.navigateToPoint(latLon, true, 0, name);
dismiss();
}
})
.create();
items.add(firstIntermItem);
BaseBottomSheetItem lastIntermItem = new BottomSheetItemWithDescription.Builder()
.setDescription(getString(R.string.last_intermediate_dest_description))
.setDescriptionColorId(R.color.searchbar_text_hint_light)
.setIcon(getLastIntermDistIcon())
.setTitle(getString(R.string.add_as_last_destination_point))
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
targetPointsHelper.navigateToPoint(latLon, true,
targetPointsHelper.getIntermediatePoints().size(), name);
dismiss();
}
})
.create();
items.add(lastIntermItem);
} }
@Override @Override
@ -101,6 +134,11 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
closeContextMenu(); closeContextMenu();
} }
@Override
protected int getCloseRowDividerColorId() {
return nightMode ? R.color.route_info_bottom_view_bg_dark : -1;
}
@Override @Override
protected Drawable getActiveIcon(@DrawableRes int id) { protected Drawable getActiveIcon(@DrawableRes int id) {
return getIcon(id, nightMode ? R.color.ctx_menu_direction_color_dark : R.color.map_widget_blue); return getIcon(id, nightMode ? R.color.ctx_menu_direction_color_dark : R.color.map_widget_blue);

View file

@ -13,20 +13,18 @@ import android.os.Bundle;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.ForegroundColorSpan; import android.text.style.ForegroundColorSpan;
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 android.widget.Toast; import android.widget.Toast;
import net.osmand.IProgress; import net.osmand.IProgress;
@ -39,6 +37,11 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; 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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -742,53 +745,53 @@ public class ImportHelper {
this.useImportDir = useImportDir; this.useImportDir = useImportDir;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.import_file)));
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_import_gpx_bottom_sheet_dialog, container); int nameColor = getResolvedColor(nightMode ? R.color.osmand_orange : R.color.dashboard_blue);
int descrColor = getResolvedColor(nightMode ? R.color.dashboard_subheader_text_dark : R.color.dashboard_subheader_text_light);
if (nightMode) {
((TextView) mainView.findViewById(R.id.import_gpx_title)).setTextColor(ContextCompat.getColor(getActivity(), R.color.ctx_menu_info_text_dark));
}
((ImageView) mainView.findViewById(R.id.import_as_favorites_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark));
((ImageView) mainView.findViewById(R.id.import_as_gpx_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark));
int nameColor = ContextCompat.getColor(getContext(), nightMode ? R.color.osmand_orange : R.color.dashboard_blue);
int descrColor = ContextCompat.getColor(getContext(), nightMode ? R.color.dashboard_subheader_text_dark : R.color.dashboard_subheader_text_light);
String descr = getString(R.string.import_gpx_file_description); String descr = getString(R.string.import_gpx_file_description);
SpannableStringBuilder text = new SpannableStringBuilder(fileName).append(" ").append(descr); SpannableStringBuilder text = new SpannableStringBuilder(fileName).append(" ").append(descr);
text.setSpan(new ForegroundColorSpan(nameColor), 0, fileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); text.setSpan(new ForegroundColorSpan(nameColor), 0, fileName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
text.setSpan(new ForegroundColorSpan(descrColor), fileName.length() + 1, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); text.setSpan(new ForegroundColorSpan(descrColor), fileName.length() + 1, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
((TextView) mainView.findViewById(R.id.import_gpx_description)).setText(text);
mainView.findViewById(R.id.import_as_favorites_row).setOnClickListener(new View.OnClickListener() { items.add(new DescriptionItem(text));
@Override
public void onClick(View view) {
importHelper.importFavoritesImpl(gpxFile, fileName, false);
dismiss();
}
});
mainView.findViewById(R.id.import_as_gpx_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
importHelper.handleResult(gpxFile, fileName, save, useImportDir, false);
dismiss();
}
});
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { BaseBottomSheetItem asFavoritesItem = new SimpleBottomSheetItem.Builder()
@Override .setIcon(getContentIcon(R.drawable.ic_action_fav_dark))
public void onClick(View view) { .setTitle(getString(R.string.import_as_favorites))
dismiss(); .setLayoutId(R.layout.bottom_sheet_item_simple)
} .setOnClickListener(new View.OnClickListener() {
}); @Override
public void onClick(View v) {
importHelper.importFavoritesImpl(gpxFile, fileName, false);
dismiss();
}
})
.create();
items.add(asFavoritesItem);
setupHeightAndBackground(mainView, R.id.import_gpx_scroll_view); items.add(new DividerHalfItem(getContext()));
return mainView; BaseBottomSheetItem asGpxItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_polygom_dark))
.setTitle(getString(R.string.import_as_gpx))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
importHelper.handleResult(gpxFile, fileName, save, useImportDir, false);
dismiss();
}
})
.create();
items.add(asGpxItem);
}
@ColorInt
private int getResolvedColor(@ColorRes int colorId) {
return ContextCompat.getColor(getContext(), colorId);
} }
} }
} }

View file

@ -1,33 +1,20 @@
package net.osmand.plus.mapcontextmenu.other; package net.osmand.plus.mapcontextmenu.other;
import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; 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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem; import net.osmand.plus.mapcontextmenu.other.ShareMenu.ShareItem;
import net.osmand.plus.widgets.TextViewEx;
import java.util.List; public class ShareMenuFragment extends MenuBottomSheetDialogFragment {
public class ShareMenuFragment extends MenuBottomSheetDialogFragment implements OnItemClickListener {
public static final String TAG = "ShareMenuFragment"; public static final String TAG = "ShareMenuFragment";
private ArrayAdapter<ShareItem> listAdapter;
private ShareMenu menu; private ShareMenu menu;
@Override @Override
@ -38,36 +25,33 @@ public class ShareMenuFragment extends MenuBottomSheetDialogFragment implements
} }
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.share_menu_location)));
final View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.share_menu_fragment, container);
if (nightMode) { View.OnClickListener itemOnClickListener = new View.OnClickListener() {
((TextViewEx) view.findViewById(R.id.title_text_view)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
ListView listView = (ListView) view.findViewById(R.id.list);
listAdapter = createAdapter();
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(this);
view.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View v) {
dismiss(); dismiss();
menu.share((ShareItem) v.getTag());
} }
}); };
setupHeightAndBackground(view, R.id.scroll_view); for (ShareItem shareItem : menu.getItems()) {
BaseBottomSheetItem item = new SimpleBottomSheetItem.Builder()
return view; .setIcon(getContentIcon(shareItem.getIconResourceId()))
.setTitle(getString(shareItem.getTitleResourceId()))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(itemOnClickListener)
.setTag(shareItem)
.create();
items.add(item);
}
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
menu.saveMenu(outState); menu.saveMenu(outState);
} }
@ -77,39 +61,4 @@ public class ShareMenuFragment extends MenuBottomSheetDialogFragment implements
fragment.setUsedOnMap(true); fragment.setUsedOnMap(true);
fragment.show(menu.getMapActivity().getSupportFragmentManager(), ShareMenuFragment.TAG); fragment.show(menu.getMapActivity().getSupportFragmentManager(), ShareMenuFragment.TAG);
} }
private ArrayAdapter<ShareItem> createAdapter() {
final List<ShareItem> items = menu.getItems();
return new ArrayAdapter<ShareItem>(menu.getMapActivity(), R.layout.share_list_item, items) {
@SuppressLint("InflateParams")
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.share_list_item, null);
}
AndroidUtils.setBackground(v.getContext(), v, nightMode, R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
final ShareItem item = getItem(position);
ImageView icon = (ImageView) v.findViewById(R.id.icon);
icon.setImageDrawable(menu.getMapActivity().getMyApplication()
.getIconsCache().getIcon(item.getIconResourceId(), !nightMode));
TextView name = (TextView) v.findViewById(R.id.name);
AndroidUtils.setTextPrimaryColor(v.getContext(), name, nightMode);
name.setText(getContext().getText(item.getTitleResourceId()));
return v;
}
};
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
dismiss();
menu.share(listAdapter.getItem(position));
}
public void dismissMenu() {
dismiss();
menu.getMapActivity().getContextMenu().close();
}
} }

View file

@ -2,18 +2,16 @@ package net.osmand.plus.mapmarkers;
import android.app.Dialog; import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup; import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
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.mapmarkers.adapters.GroupsAdapter; import net.osmand.plus.mapmarkers.adapters.GroupsAdapter;
public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -35,11 +33,11 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
mapMarkersHelper = getMyApplication().getMapMarkersHelper(); mapMarkersHelper = getMyApplication().getMapMarkersHelper();
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_add_group_bottom_sheet_dialog, container); mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_marker_add_group_bottom_sheet_dialog, null);
final RecyclerView recyclerView = mainView.findViewById(R.id.groups_recycler_view); final RecyclerView recyclerView = mainView.findViewById(R.id.groups_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@ -67,16 +65,7 @@ public abstract class AddGroupBottomSheetDialogFragment extends MenuBottomSheetD
}); });
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() { items.add(new BaseBottomSheetItem.Builder().setCustomView(mainView).create());
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.groups_recycler_view);
return mainView;
} }
@Override @Override

View file

@ -4,23 +4,20 @@ import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.ColorInt; import android.support.annotation.ColorRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.widget.CompoundButtonCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
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.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleDividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.CoordinateInputFormatDef; import net.osmand.plus.mapmarkers.CoordinateInputFormats.CoordinateInputFormatDef;
@ -51,58 +48,62 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
} }
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final Context context = getContext(); final Context context = getContext();
final OsmandSettings settings = getMyApplication().getSettings(); final OsmandSettings settings = getMyApplication().getSettings();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
boolean portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
View mainView = View.inflate(new ContextThemeWrapper(context, themeRes), items.add(new TitleItem(getString(R.string.shared_string_options)));
R.layout.fragment_marker_coordinate_input_options_bottom_sheet_dialog, container);
if (nightMode) { BaseBottomSheetItem useSystemKeyboardItem = new BottomSheetItemWithCompoundButton.Builder()
((TextView) mainView.findViewById(R.id.coordinate_input_title)) .setChecked(!useOsmandKeyboard)
.setTextColor(ContextCompat.getColor(context, R.color.ctx_menu_info_text_dark)); .setIcon(getContentIcon(R.drawable.ic_action_keyboard))
} .setTitle(getString(R.string.use_system_keyboard))
.setLayoutId(R.layout.bottom_sheet_item_with_switch)
((ImageView) mainView.findViewById(R.id.use_system_keyboard_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard)); .setOnClickListener(new View.OnClickListener() {
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard); @Override
public void onClick(View v) {
View.OnClickListener itemsOnClickListener = new View.OnClickListener() { if (listener != null) {
@Override listener.onKeyboardChanged(!useOsmandKeyboard);
public void onClick(View v) { }
if (listener != null) { dismiss();
int id = v.getId();
if (id == R.id.use_system_keyboard_row) {
listener.onKeyboardChanged(!useOsmandKeyboard);
} else if (id == R.id.hand_row) {
OsmandSettings.CommonPreference<Boolean> pref = settings.COORDS_INPUT_USE_RIGHT_SIDE;
pref.set(!pref.get());
listener.onHandChanged();
} }
} })
dismiss(); .create();
} items.add(useSystemKeyboardItem);
};
mainView.findViewById(R.id.use_system_keyboard_row).setOnClickListener(itemsOnClickListener); if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
mainView.findViewById(R.id.cancel_row).setOnClickListener(itemsOnClickListener);
View handRow = mainView.findViewById(R.id.hand_row);
if (portrait) {
handRow.setVisibility(View.GONE);
} else {
boolean rightHand = settings.COORDS_INPUT_USE_RIGHT_SIDE.get(); boolean rightHand = settings.COORDS_INPUT_USE_RIGHT_SIDE.get();
((ImageView) mainView.findViewById(R.id.hand_icon)).setImageDrawable(getContentIcon(rightHand
? R.drawable.ic_action_show_keypad_right : R.drawable.ic_action_show_keypad_left)); BaseBottomSheetItem showNumberPadItem = new BottomSheetItemWithDescription.Builder()
((TextView) mainView.findViewById(R.id.hand_text_view)).setText(getString(rightHand .setDescription(getString(rightHand ? R.string.shared_string_right : R.string.shared_string_left))
? R.string.shared_string_right : R.string.shared_string_left)); .setDescriptionColorId(getActiveColorId())
((TextView) mainView.findViewById(R.id.hand_text_view)).setTextColor(getResolvedActiveColor()); .setIcon(getContentIcon(rightHand
handRow.setOnClickListener(itemsOnClickListener); ? R.drawable.ic_action_show_keypad_right
: R.drawable.ic_action_show_keypad_left))
.setTitle(getString(R.string.show_number_pad))
.setLayoutId(R.layout.bottom_sheet_item_with_right_descr)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
OsmandSettings.CommonPreference<Boolean> pref = settings.COORDS_INPUT_USE_RIGHT_SIDE;
pref.set(!pref.get());
listener.onHandChanged();
}
dismiss();
}
})
.create();
items.add(showNumberPadItem);
} }
items.add(new SubtitleDividerItem(context));
items.add(new SubtitleItem(getString(R.string.coordinates_format)));
int selectedFormat = settings.COORDS_INPUT_FORMAT.get();
Drawable formatIcon = getContentIcon(R.drawable.ic_action_coordinates_latitude);
View.OnClickListener formatsOnClickListener = new View.OnClickListener() { View.OnClickListener formatsOnClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -115,34 +116,23 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
} }
}; };
LinearLayout formatsContainer = (LinearLayout) mainView.findViewById(R.id.formats_container);
Drawable formatIcon = getContentIcon(R.drawable.ic_action_coordinates_latitude);
int selectedFormat = settings.COORDS_INPUT_FORMAT.get();
for (@CoordinateInputFormatDef int format : CoordinateInputFormats.VALUES) { for (@CoordinateInputFormatDef int format : CoordinateInputFormats.VALUES) {
boolean selectedRow = format == selectedFormat; boolean selectedItem = format == selectedFormat;
View row = View.inflate(new ContextThemeWrapper(context, themeRes), BaseBottomSheetItem formatItem = new BottomSheetItemWithCompoundButton.Builder()
R.layout.bottom_sheet_item_with_radio_btn, null); .setChecked(selectedItem)
row.setTag(format); .setButtonTintList(selectedItem
row.setOnClickListener(formatsOnClickListener); ? ColorStateList.valueOf(ContextCompat.getColor(context, getActiveColorId()))
: null)
((ImageView) row.findViewById(R.id.icon_iv)).setImageDrawable(selectedRow .setIcon(selectedItem ? getActiveIcon(R.drawable.ic_action_coordinates_latitude) : formatIcon)
? getActiveIcon(R.drawable.ic_action_coordinates_latitude) : formatIcon); .setTitle(CoordinateInputFormats.formatToHumanString(context, format))
TextView nameTv = (TextView) row.findViewById(R.id.name_tv); .setTitleColorId(selectedItem ? getActiveColorId() : BaseBottomSheetItem.INVALID_ID)
nameTv.setText(CoordinateInputFormats.formatToHumanString(context, format)); .setLayoutId(R.layout.bottom_sheet_item_with_radio_btn)
if (selectedRow) { .setOnClickListener(formatsOnClickListener)
nameTv.setTextColor(getResolvedActiveColor()); .setTag(format)
RadioButton rb = (RadioButton) row.findViewById(R.id.radio_button); .create();
rb.setChecked(true); items.add(formatItem);
CompoundButtonCompat.setButtonTintList(rb, ColorStateList.valueOf(getResolvedActiveColor()));
}
formatsContainer.addView(row);
} }
setupHeightAndBackground(mainView, R.id.marker_coordinate_input_scroll_view);
return mainView;
} }
@Override @Override
@ -151,9 +141,14 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@ColorInt @Override
private int getResolvedActiveColor() { protected int getCloseRowTextId() {
return ContextCompat.getColor(getContext(), nightMode ? R.color.osmand_orange : R.color.color_myloc_distance); return R.string.shared_string_close;
}
@ColorRes
private int getActiveColorId() {
return nightMode ? R.color.osmand_orange : R.color.color_myloc_distance;
} }
interface CoordinateInputFormatChangeListener { interface CoordinateInputFormatChangeListener {

View file

@ -1,17 +1,16 @@
package net.osmand.plus.mapmarkers; package net.osmand.plus.mapmarkers;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.util.Algorithms;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -32,63 +31,69 @@ public class HistoryMarkerMenuBottomSheetDialogFragment extends MenuBottomSheetD
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_history_bottom_sheet_dialog, container);
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
final int pos = arguments.getInt(MARKER_POSITION); final int pos = arguments.getInt(MARKER_POSITION);
String markerName = arguments.getString(MARKER_NAME); final String markerName = arguments.getString(MARKER_NAME);
int markerColorIndex = arguments.getInt(MARKER_COLOR_INDEX); final int markerColorIndex = arguments.getInt(MARKER_COLOR_INDEX);
long markerVisitedDate = arguments.getLong(MARKER_VISITED_DATE); final long markerVisitedDate = arguments.getLong(MARKER_VISITED_DATE);
((TextView) mainView.findViewById(R.id.map_marker_title)).setText(markerName);
((ImageView) mainView.findViewById(R.id.map_marker_icon)).setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(markerColorIndex)));
Date date = new Date(markerVisitedDate); Date date = new Date(markerVisitedDate);
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date); String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
if (month.length() > 1) { month = Algorithms.capitalizeFirstLetter(month);
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
month = month.replaceAll("\\.", ""); month = month.replaceAll("\\.", "");
String day = new SimpleDateFormat("d", Locale.getDefault()).format(date); String day = new SimpleDateFormat("d", Locale.getDefault()).format(date);
((TextView) mainView.findViewById(R.id.map_marker_passed_info)).setText(getString(R.string.passed, month + " " + day));
mainView.findViewById(R.id.make_active_row).setOnClickListener(new View.OnClickListener() { BaseBottomSheetItem markerItem = new BottomSheetItemWithDescription.Builder()
@Override .setDescription(getString(R.string.passed, month + " " + day))
public void onClick(View view) { .setIcon(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(markerColorIndex)))
if (listener != null) { .setTitle(markerName)
listener.onMakeMarkerActive(pos); .setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
} .create();
dismiss(); items.add(markerItem);
}
}); items.add(new DividerItem(getContext()));
mainView.findViewById(R.id.delete_row).setOnClickListener(new View.OnClickListener() {
@Override BaseBottomSheetItem makeActiveItem = new SimpleBottomSheetItem.Builder()
public void onClick(View view) { .setIcon(getContentIcon(R.drawable.ic_action_reset_to_default_dark))
if (listener != null) { .setTitle(getString(R.string.make_active))
listener.onDeleteMarker(pos); .setLayoutId(R.layout.bottom_sheet_item_simple)
} .setOnClickListener(new View.OnClickListener() {
dismiss(); @Override
} public void onClick(View v) {
}); if (listener != null) {
listener.onMakeMarkerActive(pos);
}
dismiss();
}
})
.create();
items.add(makeActiveItem);
BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_delete_dark))
.setTitle(getString(R.string.shared_string_delete))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onDeleteMarker(pos);
}
dismiss();
}
})
.create();
items.add(deleteItem);
} }
}
((ImageView) mainView.findViewById(R.id.make_active_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_reset_to_default_dark)); @Override
((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark)); protected int getCloseRowTextId() {
return R.string.shared_string_close;
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.history_marker_scroll_view);
return mainView;
} }
interface HistoryMarkerMenuFragmentListener { interface HistoryMarkerMenuFragmentListener {

View file

@ -2,19 +2,16 @@ package net.osmand.plus.mapmarkers;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef; import net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef;
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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -26,69 +23,101 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_marker_order_by_bottom_sheet_dialog, container);
if (nightMode) {
((TextView) mainView.findViewById(R.id.order_by_title)).setTextColor(
ContextCompat.getColor(getContext(), R.color.ctx_menu_info_text_dark)
);
}
Drawable distanceIcon = getContentIcon(R.drawable.ic_action_markers_dark); Drawable distanceIcon = getContentIcon(R.drawable.ic_action_markers_dark);
Drawable dateIcon = getContentIcon(R.drawable.ic_action_sort_by_date); Drawable dateIcon = getContentIcon(R.drawable.ic_action_sort_by_date);
((ImageView) mainView.findViewById(R.id.name_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_by_name));
((ImageView) mainView.findViewById(R.id.distance_nearest_icon)).setImageDrawable(distanceIcon);
((ImageView) mainView.findViewById(R.id.distance_farthest_icon)).setImageDrawable(distanceIcon);
((ImageView) mainView.findViewById(R.id.date_added_asc_icon)).setImageDrawable(dateIcon);
((ImageView) mainView.findViewById(R.id.date_added_desc_icon)).setImageDrawable(dateIcon);
((TextView) mainView.findViewById(R.id.date_added_asc_text)).setText(getString(R.string.date_added) + " (" + getString(R.string.ascendingly) + ")"); items.add(new TitleItem(getString(R.string.sort_by)));
((TextView) mainView.findViewById(R.id.date_added_desc_text)).setText(getString(R.string.date_added) + " (" + getString(R.string.descendingly) + ")");
View.OnClickListener onClickListener = new View.OnClickListener() { BaseBottomSheetItem byNameItem = new SimpleBottomSheetItem.Builder()
@Override .setIcon(getContentIcon(R.drawable.ic_action_sort_by_name))
public void onClick(View v) { .setTitle(getString(R.string.shared_string_name))
int sortByMode = -1; .setLayoutId(R.layout.bottom_sheet_item_simple)
switch (v.getId()) { .setOnClickListener(new View.OnClickListener() {
case R.id.name_row: @Override
sortByMode = MapMarkersHelper.BY_NAME; public void onClick(View v) {
break; if (listener != null) {
case R.id.distance_nearest_row: listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_NAME);
sortByMode = MapMarkersHelper.BY_DISTANCE_ASC; }
break; dismiss();
case R.id.distance_farthest_row: }
sortByMode = MapMarkersHelper.BY_DISTANCE_DESC; })
break; .create();
case R.id.date_added_asc_row: items.add(byNameItem);
sortByMode = MapMarkersHelper.BY_DATE_ADDED_ASC;
break;
case R.id.date_added_desc_row:
sortByMode = MapMarkersHelper.BY_DATE_ADDED_DESC;
break;
}
if (sortByMode != -1 && listener != null) {
listener.onMapMarkersOrderByModeChanged(sortByMode);
}
dismiss();
}
};
mainView.findViewById(R.id.name_row).setOnClickListener(onClickListener); items.add(new DividerHalfItem(getContext()));
mainView.findViewById(R.id.distance_nearest_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.distance_farthest_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.date_added_asc_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.date_added_desc_row).setOnClickListener(onClickListener);
mainView.findViewById(R.id.close_row).setOnClickListener(onClickListener);
setupHeightAndBackground(mainView, R.id.marker_order_by_scroll_view); BaseBottomSheetItem distNearestItem = new SimpleBottomSheetItem.Builder()
.setIcon(distanceIcon)
.setTitle(getString(R.string.distance_nearest))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DISTANCE_ASC);
}
dismiss();
}
})
.create();
items.add(distNearestItem);
return mainView; BaseBottomSheetItem distFarthestItem = new SimpleBottomSheetItem.Builder()
.setIcon(distanceIcon)
.setTitle(getString(R.string.distance_farthest))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DISTANCE_DESC);
}
dismiss();
}
})
.create();
items.add(distFarthestItem);
items.add(new DividerHalfItem(getContext()));
BaseBottomSheetItem dateAscItem = new SimpleBottomSheetItem.Builder()
.setIcon(dateIcon)
.setTitle(getString(R.string.date_added) + " (" + getString(R.string.ascendingly) + ")")
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DATE_ADDED_ASC);
}
dismiss();
}
})
.create();
items.add(dateAscItem);
BaseBottomSheetItem dateDescItem = new SimpleBottomSheetItem.Builder()
.setIcon(dateIcon)
.setTitle(getString(R.string.date_added) + " (" + getString(R.string.descendingly) + ")")
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DATE_ADDED_DESC);
}
dismiss();
}
})
.create();
items.add(dateDescItem);
}
@Override
protected int getCloseRowTextId() {
return R.string.shared_string_close;
} }
interface OrderByFragmentListener { interface OrderByFragmentListener {

View file

@ -150,9 +150,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
} }
Fragment optionsFragment = fragmentManager.findFragmentByTag(PlanRouteOptionsBottomSheetDialogFragment.TAG); Fragment optionsFragment = fragmentManager.findFragmentByTag(PlanRouteOptionsBottomSheetDialogFragment.TAG);
if (optionsFragment != null) { if (optionsFragment != null) {
PlanRouteOptionsBottomSheetDialogFragment fragment = (PlanRouteOptionsBottomSheetDialogFragment) optionsFragment; ((PlanRouteOptionsBottomSheetDialogFragment) optionsFragment).setListener(createOptionsFragmentListener());
fragment.setSelectAll(!(selectedCount == markersHelper.getMapMarkers().size() && markersHelper.isStartFromMyLocation()));
fragment.setListener(createOptionsFragmentListener());
} }
toolbarHeight = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar); toolbarHeight = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
@ -722,9 +720,12 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
private void optionsOnClick() { private void optionsOnClick() {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
Bundle args = new Bundle();
args.putBoolean(PlanRouteOptionsBottomSheetDialogFragment.SELECT_ALL_KEY,
!(selectedCount == markersHelper.getMapMarkers().size() && markersHelper.isStartFromMyLocation()));
PlanRouteOptionsBottomSheetDialogFragment fragment = new PlanRouteOptionsBottomSheetDialogFragment(); PlanRouteOptionsBottomSheetDialogFragment fragment = new PlanRouteOptionsBottomSheetDialogFragment();
fragment.setArguments(args);
fragment.setUsedOnMap(true); fragment.setUsedOnMap(true);
fragment.setSelectAll(!(selectedCount == markersHelper.getMapMarkers().size() && markersHelper.isStartFromMyLocation()));
fragment.setListener(createOptionsFragmentListener()); fragment.setListener(createOptionsFragmentListener());
fragment.show(mapActivity.getSupportFragmentManager(), PlanRouteOptionsBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), PlanRouteOptionsBottomSheetDialogFragment.TAG);
} }

View file

@ -1,118 +1,128 @@
package net.osmand.plus.mapmarkers; package net.osmand.plus.mapmarkers;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
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.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleDividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.SubtitleItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
public class PlanRouteOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class PlanRouteOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "PlanRouteOptionsBottomSheetDialogFragment"; public static final String TAG = "PlanRouteOptionsBottomSheetDialogFragment";
public static final String SELECT_ALL_KEY = "select_all";
private PlanRouteOptionsFragmentListener listener; private PlanRouteOptionsFragmentListener listener;
private boolean selectAll;
public void setListener(PlanRouteOptionsFragmentListener listener) { public void setListener(PlanRouteOptionsFragmentListener listener) {
this.listener = listener; this.listener = listener;
} }
public void setSelectAll(boolean selectAll) { @Override
this.selectAll = selectAll; public void createMenuItems(Bundle savedInstanceState) {
items.add(new TitleItem(getString(R.string.shared_string_options)));
if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
boolean selectAll = getArguments().getBoolean(SELECT_ALL_KEY);
BaseBottomSheetItem selectItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(selectAll ? R.drawable.ic_action_select_all : R.drawable.ic_action_deselect_all))
.setTitle(getString(selectAll ? R.string.shared_string_select_all : R.string.shared_string_deselect_all))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.selectOnClick();
}
dismiss();
}
})
.create();
items.add(selectItem);
}
BaseBottomSheetItem navigateItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_gdirections_dark))
.setTitle(getString(R.string.get_directions))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.navigateOnClick();
}
dismiss();
}
})
.create();
items.add(navigateItem);
BaseBottomSheetItem roundTripItem = new BottomSheetItemWithCompoundButton.Builder()
.setChecked(getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get())
.setDescription(getString(R.string.make_round_trip_descr))
.setIcon(getContentIcon(R.drawable.ic_action_trip_round))
.setTitle(getString(R.string.make_round_trip))
.setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.makeRoundTripOnClick();
}
dismiss();
}
})
.create();
items.add(roundTripItem);
items.add(new SubtitleDividerItem(getContext()));
items.add(new SubtitleItem(getString(R.string.sort_by)));
BaseBottomSheetItem doorToDoorItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_sort_door_to_door))
.setTitle(getString(R.string.intermediate_items_sort_by_distance))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.doorToDoorOnClick();
}
dismiss();
}
})
.create();
items.add(doorToDoorItem);
BaseBottomSheetItem reversItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_sort_reverse_order))
.setTitle(getString(R.string.shared_string_reverse_order))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.reverseOrderOnClick();
}
dismiss();
}
})
.create();
items.add(reversItem);
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { protected int getCloseRowTextId() {
boolean portrait = AndroidUiHelper.isOrientationPortrait(getActivity()); return R.string.shared_string_close;
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_plan_route_options_bottom_sheet_dialog, container);
if (nightMode) {
((TextView) mainView.findViewById(R.id.title)).setTextColor(ContextCompat.getColor(getActivity(), R.color.ctx_menu_info_text_dark));
}
((ImageView) mainView.findViewById(R.id.navigate_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_gdirections_dark));
((ImageView) mainView.findViewById(R.id.make_round_trip_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_trip_round));
((ImageView) mainView.findViewById(R.id.door_to_door_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_door_to_door));
((ImageView) mainView.findViewById(R.id.reverse_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_sort_reverse_order));
((CompoundButton) mainView.findViewById(R.id.make_round_trip_switch)).setChecked(getMyApplication().getSettings().ROUTE_MAP_MARKERS_ROUND_TRIP.get());
if (!portrait) {
((ImageView) mainView.findViewById(R.id.select_icon))
.setImageDrawable(getContentIcon(selectAll ? R.drawable.ic_action_select_all : R.drawable.ic_action_deselect_all));
((TextView) mainView.findViewById(R.id.select_title))
.setText(getString(selectAll ? R.string.shared_string_select_all : R.string.shared_string_deselect_all));
View selectRow = mainView.findViewById(R.id.select_row);
selectRow.setVisibility(View.VISIBLE);
selectRow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.selectOnClick();
dismiss();
}
});
}
mainView.findViewById(R.id.navigate_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.navigateOnClick();
dismiss();
}
}
});
mainView.findViewById(R.id.make_round_trip_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.makeRoundTripOnClick();
dismiss();
}
}
});
mainView.findViewById(R.id.door_to_door_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.doorToDoorOnClick();
dismiss();
}
}
});
mainView.findViewById(R.id.reverse_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.reverseOrderOnClick();
dismiss();
}
}
});
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.sort_by_scroll_view);
return mainView;
} }
interface PlanRouteOptionsFragmentListener { interface PlanRouteOptionsFragmentListener {

View file

@ -1,16 +1,14 @@
package net.osmand.plus.mapmarkers; package net.osmand.plus.mapmarkers;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -22,48 +20,48 @@ public class SelectionMarkersGroupBottomSheetDialogFragment extends MenuBottomSh
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.add_group)));
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_add_markers_group_bottom_sheet_dialog, container);
if (nightMode) { items.add(new DescriptionItem(getString(R.string.add_group_descr)));
((TextView) mainView.findViewById(R.id.add_group_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
((ImageView) mainView.findViewById(R.id.favourites_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark)); BaseBottomSheetItem favoritesItem = new SimpleBottomSheetItem.Builder()
((ImageView) mainView.findViewById(R.id.waypoints_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark)); .setIcon(getContentIcon(R.drawable.ic_action_fav_dark))
.setTitle(getString(R.string.favourites_group))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.favouritesOnClick();
}
dismiss();
}
})
.create();
items.add(favoritesItem);
mainView.findViewById(R.id.favourites_row).setOnClickListener(new View.OnClickListener() { BaseBottomSheetItem waypointsItem = new SimpleBottomSheetItem.Builder()
@Override .setIcon(getContentIcon(R.drawable.ic_action_polygom_dark))
public void onClick(View view) { .setTitle(getString(R.string.track_waypoints))
if (listener != null) { .setLayoutId(R.layout.bottom_sheet_item_simple)
listener.favouritesOnClick(); .setOnClickListener(new View.OnClickListener() {
} @Override
dismiss(); public void onClick(View v) {
} if (listener != null) {
}); listener.waypointsOnClick();
mainView.findViewById(R.id.waypoints_row).setOnClickListener(new View.OnClickListener() { }
@Override dismiss();
public void onClick(View view) { }
if (listener != null) { })
listener.waypointsOnClick(); .create();
} items.add(waypointsItem);
dismiss(); }
}
});
mainView.findViewById(R.id.close_row).setOnClickListener(new View.OnClickListener() { @Override
@Override protected int getCloseRowTextId() {
public void onClick(View view) { return R.string.shared_string_close;
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.add_markers_group_scroll_view);
return mainView;
} }
interface AddMarkersGroupFragmentListener { interface AddMarkersGroupFragmentListener {

View file

@ -272,11 +272,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Bundle args = new Bundle();
args.putBoolean(OptionsBottomSheetDialogFragment.SNAP_TO_ROAD_ENABLED_KEY, editingCtx.isInSnapToRoadMode());
args.putBoolean(OptionsBottomSheetDialogFragment.ADD_LINE_MODE_KEY, newGpxData != null);
OptionsBottomSheetDialogFragment fragment = new OptionsBottomSheetDialogFragment(); OptionsBottomSheetDialogFragment fragment = new OptionsBottomSheetDialogFragment();
fragment.setArguments(args);
fragment.setUsedOnMap(true); fragment.setUsedOnMap(true);
fragment.setSnapToRoadEnabled(editingCtx.isInSnapToRoadMode());
fragment.setListener(createOptionsFragmentListener()); fragment.setListener(createOptionsFragmentListener());
fragment.setAddLineMode(newGpxData != null);
fragment.show(mapActivity.getSupportFragmentManager(), OptionsBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), OptionsBottomSheetDialogFragment.TAG);
} }
}); });

View file

@ -1,124 +1,131 @@
package net.osmand.plus.measurementtool; package net.osmand.plus.measurementtool;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.SwitchCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
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.widgets.TextViewEx; 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.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class OptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class OptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "OptionsBottomSheetDialogFragment"; public static final String TAG = "OptionsBottomSheetDialogFragment";
public static final String SNAP_TO_ROAD_ENABLED_KEY = "snap_to_road_enabled";
public static final String ADD_LINE_MODE_KEY = "add_line_mode";
private OptionsFragmentListener listener; private OptionsFragmentListener listener;
private boolean addLineMode;
private boolean snapToRoadEnabled;
public void setListener(OptionsFragmentListener listener) { public void setListener(OptionsFragmentListener listener) {
this.listener = listener; this.listener = listener;
} }
public void setAddLineMode(boolean addLineMode) {
this.addLineMode = addLineMode;
}
public void setSnapToRoadEnabled(boolean snapToRoadEnabled) {
this.snapToRoadEnabled = snapToRoadEnabled;
}
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; Bundle args = getArguments();
boolean snapToRoadEnabled = args.getBoolean(SNAP_TO_ROAD_ENABLED_KEY);
boolean addLineMode = args.getBoolean(ADD_LINE_MODE_KEY);
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_options_bottom_sheet_dialog, null); items.add(new TitleItem(getString(R.string.shared_string_options)));
if (nightMode) { BaseBottomSheetItem snapToRoadItem = new BottomSheetItemWithCompoundButton.Builder()
((TextViewEx) mainView.findViewById(R.id.options_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark)); .setChecked(snapToRoadEnabled)
} .setDescription(getString(snapToRoadEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled))
if (snapToRoadEnabled) { .setIcon(snapToRoadEnabled
mainView.findViewById(R.id.snap_to_road_enabled_text_view).setVisibility(View.VISIBLE); ? getActiveIcon(R.drawable.ic_action_snap_to_road)
((SwitchCompat) mainView.findViewById(R.id.snap_to_road_switch)).setChecked(true); : getContentIcon(R.drawable.ic_action_snap_to_road))
} .setTitle(getString(R.string.snap_to_road))
((ImageView) mainView.findViewById(R.id.snap_to_road_icon)).setImageDrawable(snapToRoadEnabled .setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp)
? getActiveIcon(R.drawable.ic_action_snap_to_road) .setOnClickListener(new View.OnClickListener() {
: getContentIcon(R.drawable.ic_action_snap_to_road)); @Override
((ImageView) mainView.findViewById(R.id.clear_all_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_reset_to_default_dark)); public void onClick(View v) {
if (!addLineMode) { if (listener != null) {
((ImageView) mainView.findViewById(R.id.save_as_new_track_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark)); listener.snapToRoadOnCLick();
((ImageView) mainView.findViewById(R.id.add_to_the_track_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_split_interval)); }
dismiss();
}
})
.create();
items.add(snapToRoadItem);
items.add(new DividerHalfItem(getContext()));
if (addLineMode) {
BaseBottomSheetItem saveAsNewSegmentItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_polygom_dark))
.setTitle(getString(R.string.shared_string_save))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.addToGpxOnClick();
}
dismiss();
}
})
.create();
items.add(saveAsNewSegmentItem);
} else { } else {
mainView.findViewById(R.id.save_as_new_track_row).setVisibility(View.GONE); BaseBottomSheetItem saveAsNewTrackItem = new SimpleBottomSheetItem.Builder()
mainView.findViewById(R.id.add_to_the_track_row).setVisibility(View.GONE); .setIcon(getContentIcon(R.drawable.ic_action_polygom_dark))
mainView.findViewById(R.id.save_as_new_segment_row).setVisibility(View.VISIBLE); .setTitle(getString(R.string.shared_string_save_as_gpx))
((ImageView) mainView.findViewById(R.id.save_as_new_segment_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark)); .setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.saveAsNewTrackOnClick();
}
dismiss();
}
})
.create();
items.add(saveAsNewTrackItem);
BaseBottomSheetItem addToTrackItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_split_interval))
.setTitle(getString(R.string.add_segment_to_the_track))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.addToTheTrackOnClick();
}
dismiss();
}
})
.create();
items.add(addToTrackItem);
} }
mainView.findViewById(R.id.snap_to_road_row).setOnClickListener(new View.OnClickListener() { items.add(new DividerHalfItem(getContext()));
@Override
public void onClick(View view) {
if (listener != null) {
listener.snapToRoadOnCLick();
}
dismiss();
}
});
mainView.findViewById(R.id.clear_all_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.clearAllOnClick();
}
dismiss();
}
});
if (!addLineMode) {
mainView.findViewById(R.id.save_as_new_track_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.saveAsNewTrackOnClick();
}
dismiss();
}
});
mainView.findViewById(R.id.add_to_the_track_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.addToTheTrackOnClick();
}
dismiss();
}
});
} else {
mainView.findViewById(R.id.save_as_new_segment_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.addToGpxOnClick();
}
dismiss();
}
});
}
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.measure_options_scroll_view); BaseBottomSheetItem clearAllItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_reset_to_default_dark))
.setTitle(getString(R.string.shared_string_clear_all))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.clearAllOnClick();
}
dismiss();
}
})
.create();
items.add(clearAllItem);
}
return mainView; @Override
protected int getCloseRowTextId() {
return R.string.shared_string_close;
} }
interface OptionsFragmentListener { interface OptionsFragmentListener {

View file

@ -1,17 +1,18 @@
package net.osmand.plus.measurementtool; package net.osmand.plus.measurementtool;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView; 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.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -23,63 +24,55 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.shared_string_save_as_gpx)));
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_save_as_new_track_bottom_sheet_dialog, container); items.add(new DescriptionItem(getString(R.string.measurement_tool_save_as_new_track_descr)));
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { if (Build.VERSION.SDK_INT >= 17) {
mainView.findViewById(R.id.images_row).setVisibility(View.GONE); final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
} else { View imagesRow = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
final ImageView routePointImage = (ImageView) mainView.findViewById(R.id.route_point_image); R.layout.fragment_save_as_new_track_images_row, null);
ImageView lineImage = (ImageView) mainView.findViewById(R.id.line_image);
if (nightMode) {
routePointImage.setImageResource(R.drawable.img_help_trip_route_points_night);
lineImage.setImageResource(R.drawable.img_help_trip_track_night);
} else {
routePointImage.setImageResource(R.drawable.img_help_trip_route_points_day);
lineImage.setImageResource(R.drawable.img_help_trip_track_day);
}
mainView.findViewById(R.id.line_text).setOnTouchListener(new View.OnTouchListener() { final ImageView routePointImage = (ImageView) imagesRow.findViewById(R.id.route_point_image);
@Override final ImageView lineImage = (ImageView) imagesRow.findViewById(R.id.line_image);
public boolean onTouch(View view, MotionEvent motionEvent) { routePointImage.setImageResource(nightMode
return false; ? R.drawable.img_help_trip_route_points_night
} : R.drawable.img_help_trip_route_points_day);
}); lineImage.setImageResource(nightMode
? R.drawable.img_help_trip_track_night
: R.drawable.img_help_trip_track_day);
routePointImage.setOnClickListener(saveAsRoutePointOnClickListener);
lineImage.setOnClickListener(saveAsLineOnClickListener); lineImage.setOnClickListener(saveAsLineOnClickListener);
mainView.findViewById(R.id.route_point_text).setOnTouchListener(new View.OnTouchListener() { View.OnTouchListener textOnTouchListener = new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View view, MotionEvent motionEvent) { public boolean onTouch(View v, MotionEvent event) {
return false; return false;
} }
}); };
routePointImage.setOnClickListener(saveAsRoutePointOnClickListener); imagesRow.findViewById(R.id.line_text).setOnTouchListener(textOnTouchListener);
imagesRow.findViewById(R.id.route_point_text).setOnTouchListener(textOnTouchListener);
items.add(new BaseBottomSheetItem.Builder().setCustomView(imagesRow).create());
} }
if (nightMode) { BaseBottomSheetItem saveAsRoutePointsItem = new SimpleBottomSheetItem.Builder()
((TextView) mainView.findViewById(R.id.save_as_new_track_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark)); .setIcon(getContentIcon(R.drawable.ic_action_route_points))
} .setTitle(getString(R.string.save_as_route_point))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(saveAsRoutePointOnClickListener)
.create();
items.add(saveAsRoutePointsItem);
((ImageView) mainView.findViewById(R.id.route_point_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_route_points)); BaseBottomSheetItem saveAsLineItem = new SimpleBottomSheetItem.Builder()
((ImageView) mainView.findViewById(R.id.line_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_split_interval)); .setIcon(getContentIcon(R.drawable.ic_action_split_interval))
.setTitle(getString(R.string.save_as_line))
mainView.findViewById(R.id.save_as_line_row).setOnClickListener(saveAsLineOnClickListener); .setLayoutId(R.layout.bottom_sheet_item_simple)
mainView.findViewById(R.id.save_as_route_point_row).setOnClickListener(saveAsRoutePointOnClickListener); .setOnClickListener(saveAsLineOnClickListener)
.create();
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { items.add(saveAsLineItem);
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.save_as_new_track_scroll_view);
return mainView;
} }
private View.OnClickListener saveAsLineOnClickListener = new View.OnClickListener() { private View.OnClickListener saveAsLineOnClickListener = new View.OnClickListener() {

View file

@ -1,21 +1,23 @@
package net.osmand.plus.measurementtool; package net.osmand.plus.measurementtool;
import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; 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.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleDividerItem;
import net.osmand.plus.measurementtool.NewGpxData.ActionType; import net.osmand.plus.measurementtool.NewGpxData.ActionType;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
@ -31,117 +33,83 @@ public class SelectedPointBottomSheetDialogFragment extends MenuBottomSheetDialo
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final MapActivity mapActivity = (MapActivity) getActivity(); BaseBottomSheetItem titleItem = new BottomSheetItemWithDescription.Builder()
final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); .setDescription(getDescription())
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; .setIcon(getActiveIcon(R.drawable.ic_action_measure_point))
.setTitle(getTitle())
.setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
.create();
items.add(titleItem);
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_selected_menu_bottom_sheet_dialog, null); items.add(new TitleDividerItem(getContext()));
((ImageView) mainView.findViewById(R.id.selected_point_icon)).setImageDrawable(getActiveIcon(R.drawable.ic_action_measure_point)); BaseBottomSheetItem moveItem = new SimpleBottomSheetItem.Builder()
((ImageView) mainView.findViewById(R.id.move_point_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_move_point)); .setIcon(getContentIcon(R.drawable.ic_action_move_point))
((ImageView) mainView.findViewById(R.id.delete_point_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_remove_dark)); .setTitle(getString(R.string.shared_string_move))
((ImageView) mainView.findViewById(R.id.add_point_after_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_addpoint_above)); .setLayoutId(R.layout.bottom_sheet_item_simple)
((ImageView) mainView.findViewById(R.id.add_point_before_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_addpoint_below)); .setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.moveOnClick();
}
dismiss();
}
})
.create();
items.add(moveItem);
mainView.findViewById(R.id.move_point_row).setOnClickListener(new View.OnClickListener() { BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder()
@Override .setIcon(getContentIcon(R.drawable.ic_action_remove_dark))
public void onClick(View view) { .setTitle(getString(R.string.shared_string_delete))
if (listener != null) { .setLayoutId(R.layout.bottom_sheet_item_simple)
listener.moveOnClick(); .setOnClickListener(new View.OnClickListener() {
} @Override
dismiss(); public void onClick(View v) {
} if (listener != null) {
}); listener.deleteOnClick();
mainView.findViewById(R.id.delete_point_row).setOnClickListener(new View.OnClickListener() { }
@Override dismiss();
public void onClick(View view) { }
if (listener != null) { })
listener.deleteOnClick(); .create();
} items.add(deleteItem);
dismiss();
}
});
mainView.findViewById(R.id.add_point_after_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.addPointAfterOnClick();
}
dismiss();
}
});
mainView.findViewById(R.id.add_point_before_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.addPointBeforeOnClick();
}
dismiss();
}
});
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onClearSelection();
}
dismiss();
}
});
List<WptPt> points = measurementLayer.getEditingCtx().getPoints(); items.add(new DividerHalfItem(getContext()));
int pos = measurementLayer.getEditingCtx().getSelectedPointPosition();
WptPt pt = points.get(pos);
String pointTitle = pt.name;
if (!TextUtils.isEmpty(pointTitle)) {
((TextView) mainView.findViewById(R.id.selected_point_title)).setText(pointTitle);
} else {
NewGpxData newGpxData = measurementLayer.getEditingCtx().getNewGpxData();
if (newGpxData != null) {
ActionType actionType = measurementLayer.getEditingCtx().getNewGpxData().getActionType();
if (actionType == ActionType.ADD_ROUTE_POINTS) {
((TextView) mainView.findViewById(R.id.selected_point_title)).setText(mapActivity.getString(R.string.route_point) + " - " + (pos + 1));
} else {
((TextView) mainView.findViewById(R.id.selected_point_title)).setText(mapActivity.getString(R.string.plugin_distance_point) + " - " + (pos + 1));
}
} else {
((TextView) mainView.findViewById(R.id.selected_point_title)).setText(mapActivity.getString(R.string.plugin_distance_point) + " - " + (pos + 1));
}
}
String pointDesc = pt.desc;
if (!TextUtils.isEmpty(pointDesc)) {
((TextView) mainView.findViewById(R.id.selected_point_distance)).setText(pointDesc);
} else {
if (pos < 1) {
((TextView) mainView.findViewById(R.id.selected_point_distance)).setText(mapActivity.getString(R.string.shared_string_control_start));
} else {
float dist = 0;
for (int i = 1; i <= pos; i++) {
dist += MapUtils.getDistance(points.get(i - 1).lat, points.get(i - 1).lon, points.get(i).lat, points.get(i).lon);
}
((TextView) mainView.findViewById(R.id.selected_point_distance)).setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
}
}
NewGpxData newGpxData = measurementLayer.getEditingCtx().getNewGpxData();
if (newGpxData != null && newGpxData.getActionType() == ActionType.EDIT_SEGMENT) {
double elevation = pt.ele;
if (!Double.isNaN(elevation)) {
String eleStr = (mapActivity.getString(R.string.altitude)).substring(0, 1);
((TextView) mainView.findViewById(R.id.selected_point_ele)).setText(eleStr + ": " + OsmAndFormatter.getFormattedAlt(elevation, mapActivity.getMyApplication()));
}
float speed = (float) pt.speed;
if (speed != 0) {
String speedStr = (mapActivity.getString(R.string.map_widget_speed)).substring(0, 1);
((TextView) mainView.findViewById(R.id.selected_point_speed)).setText(speedStr + ": " + OsmAndFormatter.getFormattedSpeed(speed, mapActivity.getMyApplication()));
}
}
setupHeightAndBackground(mainView, R.id.selected_point_options_scroll_view); BaseBottomSheetItem addAfterItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_addpoint_above))
.setTitle(getString(R.string.add_point_after))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.addPointAfterOnClick();
}
dismiss();
}
})
.create();
items.add(addAfterItem);
return mainView; BaseBottomSheetItem addBeforeItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_addpoint_below))
.setTitle(getString(R.string.add_point_before))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.addPointBeforeOnClick();
}
dismiss();
}
})
.create();
items.add(addBeforeItem);
} }
@Override @Override
@ -161,6 +129,96 @@ public class SelectedPointBottomSheetDialogFragment extends MenuBottomSheetDialo
super.onCancel(dialog); super.onCancel(dialog);
} }
@Override
protected int getCloseRowTextId() {
return R.string.shared_string_close;
}
@Override
protected void onCloseRowClickAction() {
if (listener != null) {
listener.onClearSelection();
}
}
@Nullable
private MapActivity getMapActivity() {
Activity activity = getActivity();
if (activity instanceof MapActivity) {
return (MapActivity) activity;
}
return null;
}
@NonNull
private String getTitle() {
MapActivity mapActivity = getMapActivity();
if (mapActivity == null) {
return "";
}
MeasurementEditingContext editingCtx = mapActivity.getMapLayers().getMeasurementToolLayer().getEditingCtx();
int pos = editingCtx.getSelectedPointPosition();
String pointName = editingCtx.getPoints().get(pos).name;
if (!TextUtils.isEmpty(pointName)) {
return pointName;
}
NewGpxData newGpxData = editingCtx.getNewGpxData();
if (newGpxData != null && newGpxData.getActionType() == ActionType.ADD_ROUTE_POINTS) {
return getString(R.string.route_point) + " - " + (pos + 1);
}
return getString(R.string.plugin_distance_point) + " - " + (pos + 1);
}
@NonNull
private String getDescription() {
MapActivity mapActivity = getMapActivity();
if (mapActivity == null) {
return "";
}
StringBuilder description = new StringBuilder();
MeasurementEditingContext editingCtx = mapActivity.getMapLayers().getMeasurementToolLayer().getEditingCtx();
int pos = editingCtx.getSelectedPointPosition();
List<WptPt> points = editingCtx.getPoints();
WptPt pt = points.get(pos);
String pointDesc = pt.desc;
if (!TextUtils.isEmpty(pointDesc)) {
description.append(pointDesc);
} else if (pos < 1) {
description.append(getString(R.string.shared_string_control_start));
} else {
float dist = 0;
for (int i = 1; i <= pos; i++) {
WptPt first = points.get(i - 1);
WptPt second = points.get(i);
dist += MapUtils.getDistance(first.lat, first.lon, second.lat, second.lon);
}
description.append(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
}
NewGpxData newGpxData = editingCtx.getNewGpxData();
if (newGpxData != null && newGpxData.getActionType() == ActionType.EDIT_SEGMENT) {
double elevation = pt.ele;
if (!Double.isNaN(elevation)) {
description.append(" ").append((getString(R.string.altitude)).substring(0, 1)).append(": ");
description.append(OsmAndFormatter.getFormattedAlt(elevation, mapActivity.getMyApplication()));
}
float speed = (float) pt.speed;
if (speed != 0) {
description.append(" ").append((getString(R.string.map_widget_speed)).substring(0, 1)).append(": ");
description.append(OsmAndFormatter.getFormattedSpeed(speed, mapActivity.getMyApplication()));
}
}
return description.toString();
}
interface SelectedPointFragmentListener { interface SelectedPointFragmentListener {
void moveOnClick(); void moveOnClick();

View file

@ -1,18 +1,15 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
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 {
@ -29,91 +26,71 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(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() {
@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 {

View file

@ -2,17 +2,15 @@ package net.osmand.plus.osmedit;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
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.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.osmedit.OsmEditsFragment.FileTypesDef; import net.osmand.plus.osmedit.OsmEditsFragment.FileTypesDef;
import net.osmand.plus.widgets.TextViewEx;
public class FileTypeBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class FileTypeBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
@ -24,51 +22,47 @@ public class FileTypeBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; items.add(new TitleItem(getString(R.string.choose_file_type)));
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.fragment_osm_file_type_bottom_sheet_dialog, container);
if (nightMode) {
((TextViewEx) mainView.findViewById(R.id.title_text_view)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
Drawable fileIcon = getContentIcon(R.drawable.ic_type_file); Drawable fileIcon = getContentIcon(R.drawable.ic_type_file);
((ImageView) mainView.findViewById(R.id.osc_file_icon)).setImageDrawable(fileIcon);
((ImageView) mainView.findViewById(R.id.gpx_file_icon)).setImageDrawable(fileIcon);
mainView.findViewById(R.id.osc_file_row).setOnClickListener(new View.OnClickListener() { BaseBottomSheetItem oscItem = new BottomSheetItemWithDescription.Builder()
@Override .setDescription(getString(R.string.osc_file_desc))
public void onClick(View v) { .setIcon(fileIcon)
if (listener != null) { .setTitle(getString(R.string.osc_file))
listener.onClick(OsmEditsFragment.FILE_TYPE_OSC); .setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
} .setOnClickListener(new View.OnClickListener() {
dismiss(); @Override
} public void onClick(View v) {
}); if (listener != null) {
listener.onClick(OsmEditsFragment.FILE_TYPE_OSC);
}
dismiss();
}
})
.create();
items.add(oscItem);
mainView.findViewById(R.id.gpx_file_row).setOnClickListener(new View.OnClickListener() { items.add(new DividerHalfItem(getContext()));
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(OsmEditsFragment.FILE_TYPE_GPX);
}
dismiss();
}
});
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { BaseBottomSheetItem gpxItem = new BottomSheetItemWithDescription.Builder()
@Override .setDescription(getString(R.string.gpx_file_desc))
public void onClick(View view) { .setIcon(fileIcon)
dismiss(); .setTitle(getString(R.string.gpx_file))
} .setLayoutId(R.layout.bottom_sheet_item_with_descr_56dp)
}); .setOnClickListener(new View.OnClickListener() {
@Override
setupHeightAndBackground(mainView, R.id.scroll_view); public void onClick(View v) {
if (listener != null) {
return mainView; listener.onClick(OsmEditsFragment.FILE_TYPE_GPX);
}
dismiss();
}
})
.create();
items.add(gpxItem);
} }
public interface FileTypeFragmentListener { public interface FileTypeFragmentListener {

View file

@ -1,20 +1,18 @@
package net.osmand.plus.osmedit; package net.osmand.plus.osmedit;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
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.widgets.TextViewEx; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
public class OsmEditOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { public class OsmEditOptionsBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
public final static String TAG = "OsmEditOptionsBottomSheetDialogFragment"; public static final String TAG = "OsmEditOptionsBottomSheetDialogFragment";
public static final String OSM_POINT = "osm_point"; public static final String OSM_POINT = "osm_point";
@ -24,94 +22,105 @@ public class OsmEditOptionsBottomSheetDialogFragment extends MenuBottomSheetDial
this.listener = listener; this.listener = listener;
} }
@Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public void createMenuItems(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_edit_options_bottom_sheet_dialog, container);
Bundle args = getArguments(); Bundle args = getArguments();
if (args != null) { if (args != null) {
final OsmPoint osmPoint = (OsmPoint) args.getSerializable(OSM_POINT); final OsmPoint osmPoint = (OsmPoint) args.getSerializable(OSM_POINT);
((TextViewEx) mainView.findViewById(R.id.osm_edit_name)).setText(OsmEditingPlugin.getName(osmPoint) + ":"); items.add(new TitleItem(OsmEditingPlugin.getName(osmPoint) + ":"));
((ImageView) mainView.findViewById(R.id.upload_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_export)); BaseBottomSheetItem uploadItem = new SimpleBottomSheetItem.Builder()
mainView.findViewById(R.id.upload_row).setOnClickListener(new View.OnClickListener() { .setIcon(getContentIcon(R.drawable.ic_action_export))
@Override .setTitle(getString(R.string.local_openstreetmap_upload))
public void onClick(View view) { .setLayoutId(R.layout.bottom_sheet_item_simple)
if (listener != null) { .setOnClickListener(new View.OnClickListener() {
listener.onUploadClick(osmPoint); @Override
} public void onClick(View v) {
dismiss(); if (listener != null) {
} listener.onUploadClick(osmPoint);
}); }
dismiss();
}
})
.create();
items.add(uploadItem);
((ImageView) mainView.findViewById(R.id.show_on_map_icon)).setImageDrawable(getContentIcon(R.drawable.ic_show_on_map)); BaseBottomSheetItem showOnMapItem = new SimpleBottomSheetItem.Builder()
mainView.findViewById(R.id.show_on_map_row).setOnClickListener(new View.OnClickListener() { .setIcon(getContentIcon(R.drawable.ic_show_on_map))
@Override .setTitle(getString(R.string.shared_string_show_on_map))
public void onClick(View view) { .setLayoutId(R.layout.bottom_sheet_item_simple)
if (listener != null) { .setOnClickListener(new View.OnClickListener() {
listener.onShowOnMapClick(osmPoint); @Override
} public void onClick(View v) {
dismiss(); if (listener != null) {
} listener.onShowOnMapClick(osmPoint);
}); }
dismiss();
}
})
.create();
items.add(showOnMapItem);
items.add(new DividerHalfItem(getContext()));
if (osmPoint instanceof OpenstreetmapPoint && osmPoint.getAction() != OsmPoint.Action.DELETE) { if (osmPoint instanceof OpenstreetmapPoint && osmPoint.getAction() != OsmPoint.Action.DELETE) {
mainView.findViewById(R.id.modify_osm_change_row).setVisibility(View.VISIBLE); BaseBottomSheetItem modifyOsmChangeItem = new SimpleBottomSheetItem.Builder()
((ImageView) mainView.findViewById(R.id.modify_osm_change_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark)); .setIcon(getContentIcon(R.drawable.ic_action_edit_dark))
mainView.findViewById(R.id.modify_osm_change_row).setOnClickListener(new View.OnClickListener() { .setTitle(getString(R.string.poi_context_menu_modify_osm_change))
@Override .setLayoutId(R.layout.bottom_sheet_item_simple)
public void onClick(View view) { .setOnClickListener(new View.OnClickListener() {
if (listener != null) { @Override
listener.onModifyOsmChangeClick(osmPoint); public void onClick(View v) {
} if (listener != null) {
dismiss(); listener.onModifyOsmChangeClick(osmPoint);
} }
}); dismiss();
}
})
.create();
items.add(modifyOsmChangeItem);
} }
if (osmPoint instanceof OsmNotesPoint) { if (osmPoint instanceof OsmNotesPoint) {
mainView.findViewById(R.id.modify_osm_note_row).setVisibility(View.VISIBLE); BaseBottomSheetItem modifyOsmNoteItem = new SimpleBottomSheetItem.Builder()
((ImageView) mainView.findViewById(R.id.modify_osm_note_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark)); .setIcon(getContentIcon(R.drawable.ic_action_edit_dark))
mainView.findViewById(R.id.modify_osm_note_row).setOnClickListener(new View.OnClickListener() { .setTitle(getString(R.string.context_menu_item_modify_note))
@Override .setLayoutId(R.layout.bottom_sheet_item_simple)
public void onClick(View view) { .setOnClickListener(new View.OnClickListener() {
if (listener != null) { @Override
listener.onModifyOsmNoteClick(osmPoint); public void onClick(View v) {
if (listener != null) {
listener.onModifyOsmNoteClick(osmPoint);
}
dismiss();
}
})
.create();
items.add(modifyOsmNoteItem);
}
BaseBottomSheetItem deleteItem = new SimpleBottomSheetItem.Builder()
.setIcon(getContentIcon(R.drawable.ic_action_delete_dark))
.setTitle(getString(R.string.shared_string_delete))
.setLayoutId(R.layout.bottom_sheet_item_simple)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onDeleteClick(osmPoint);
}
dismiss();
} }
dismiss(); })
} .create();
}); items.add(deleteItem);
}
((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark));
mainView.findViewById(R.id.delete_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onDeleteClick(osmPoint);
}
dismiss();
}
});
} }
}
if (nightMode) { @Override
((TextViewEx) mainView.findViewById(R.id.osm_edit_name)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark)); protected int getCloseRowTextId() {
} return R.string.shared_string_close;
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
setupHeightAndBackground(mainView, R.id.osm_edit_options_scroll_view);
return mainView;
} }
public interface OsmEditOptionsFragmentListener { public interface OsmEditOptionsFragmentListener {