Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
63ca9d3a0d
17 changed files with 846 additions and 619 deletions
416
OsmAnd/res/layout/fragment_direction_indication_dialog.xml
Normal file
416
OsmAnd/res/layout/fragment_direction_indication_dialog.xml
Normal file
|
@ -0,0 +1,416 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/actionModeBackground"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
app:contentInsetLeft="54dp"
|
||||
app:contentInsetStart="54dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_settings"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/app_mode_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:drawableRight="@drawable/ic_action_car_dark"
|
||||
tools:text="car"/>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableScrollView
|
||||
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">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_bar_image_height"
|
||||
android:background="?attr/actionModeBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/action_bar_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="@dimen/action_bar_image_side_margin"
|
||||
android:layout_marginRight="@dimen/action_bar_image_side_margin"
|
||||
tools:src="@drawable/img_help_markers_direction_device_night"/>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding">
|
||||
|
||||
<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/active_markers"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/active_markers_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||
tools:text="Two"/>
|
||||
</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:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding_small"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:text="@string/active_markers_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/distance_indication_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<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/show_direction"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/distance_indication_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
|
||||
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_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding_small"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:text="@string/distance_indication_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_bar_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/top_bar_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:background="@drawable/ic_action_device_top"
|
||||
tools:src="@drawable/ic_action_device_topbar"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_topbar"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/top_bar_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_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:background="@drawable/ic_action_device_top"
|
||||
tools:src="@drawable/ic_action_device_widget"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_widgets"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/widget_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/show_arrows_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<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/show_arrows_on_the_map"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_arrows_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
|
||||
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_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding_small"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:text="@string/show_arrows_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/show_guide_line_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<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/show_guide_line"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_guide_line_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_margin_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_margin_small"
|
||||
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_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding_small"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:text="@string/show_guide_line_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.github.ksoichiro.android.observablescrollview.ObservableScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/app_bar_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,356 +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_show_direction_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/show_direction_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/show_direction"
|
||||
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/marker_show_distance_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/top_bar_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/top_bar_image_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/top_bar_image"
|
||||
android:layout_alignStart="@id/top_bar_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/shared_string_topbar"
|
||||
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/widget_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/widget_image_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/widget_image"
|
||||
android:layout_alignStart="@id/widget_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/shared_string_widgets"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_split_segments_sub"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/show_arrows_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">
|
||||
|
||||
<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/show_arrows_on_the_map"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_arrows_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/show_guide_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:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<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/show_guide_line"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_guide_line_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>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_content_padding_small"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/top_bar_row_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height">
|
||||
|
||||
<LinearLayout
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/top_bar_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
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/top_bar_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:background="@drawable/ic_action_device_top"
|
||||
tools:src="@drawable/ic_action_device_topbar"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
android:id="@+id/top_bar_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_topbar"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/top_bar_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/widget_row_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height">
|
||||
|
||||
<LinearLayout
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/widget_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:foreground="?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/widget_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:background="@drawable/ic_action_device_top"
|
||||
tools:src="@drawable/ic_action_device_widget"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
android:id="@+id/widget_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_widgets"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/widget_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/none_row_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height">
|
||||
|
||||
<LinearLayout
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/none_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:foreground="?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/none_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:background="@drawable/ic_action_device_top"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
android:id="@+id/none_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_none"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/none_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</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>
|
10
OsmAnd/res/menu/active_markers_menu.xml
Normal file
10
OsmAnd/res/menu/active_markers_menu.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/action_one"
|
||||
android:title="@string/shared_string_one"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_two"
|
||||
android:title="@string/shared_string_two"/>
|
||||
</menu>
|
|
@ -2947,7 +2947,7 @@ Repræsenterer område: %1$s x %2$s</string>
|
|||
<string name="shared_string_left">Venstre</string>
|
||||
<string name="show_number_pad">Vis numerisk tastatur</string>
|
||||
<string name="shared_string_paste">Indsæt</string>
|
||||
<string name="coordinate_input_accuracy_description">Skift automatisk til det næste felt efter indtastning af %1$ d cifre efter decimaltegnet</string>
|
||||
<string name="coordinate_input_accuracy_description">Skift automatisk til det næste felt efter indtastning af %1$d cifre efter decimaltegnet</string>
|
||||
<string name="coordinate_input_accuracy">%1$d cifre</string>
|
||||
<string name="go_to_next_field">Gå til næste felt</string>
|
||||
</resources>
|
||||
|
|
|
@ -2218,7 +2218,7 @@
|
|||
\nԴուք կարող եք հետեւել իրական խմբում առկա բոլոր սարքերի հետ: Դուք կարող եք նաև տեսնել այն կետը և հետքերը, որոնք վերագրվում են այն խմբին, որը դուք պատկանում եք:
|
||||
\n
|
||||
\nԽումբը չի հանվել մի ամիս հետո, այն կհամապատասխանի OsMo.mobi կայքում տեղադրված խմբերի կանոններին</string>
|
||||
<string name="osmo_auth_error">OsMo-ի մուտի թույլտվության սխալն առաջացավ`% 1 $ s:
|
||||
<string name="osmo_auth_error">OsMo-ի մուտի թույլտվության սխալն առաջացավ`%1$s:
|
||||
\nԴա կարող է լինել ժամանակավոր ծառայության խափանում, կամ ձեր գրանցման ժամկետը լրացել է:
|
||||
\nՑանկանում եք շարունակել նոր գրանցումը?</string>
|
||||
<string name="route_head">Շարժվեք ուղիղ</string>
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<dimen name="bottom_sheet_content_margin">24dp</dimen>
|
||||
<dimen name="bottom_sheet_content_margin_small">12dp</dimen>
|
||||
<dimen name="content_padding">24dp</dimen>
|
||||
<dimen name="content_padding_small">18dp</dimen>
|
||||
<dimen name="bottom_sheet_content_padding_small">12dp</dimen>
|
||||
<dimen name="measurement_tool_divider_margin">12dp</dimen>
|
||||
<dimen name="measurement_tool_content_padding_medium">18dp</dimen>
|
||||
|
@ -126,6 +127,9 @@
|
|||
<dimen name="bottom_sheet_image_text_margin_start">15dp</dimen>
|
||||
<dimen name="bottom_sheet_selected_item_title_height">84dp</dimen>
|
||||
|
||||
<dimen name="action_bar_image_height">330dp</dimen>
|
||||
<dimen name="action_bar_image_side_margin">105dp</dimen>
|
||||
|
||||
<dimen name="map_markers_recycler_view_padding_bottom">78dp</dimen>
|
||||
<dimen name="map_markers_recycler_view_padding_top">15dp</dimen>
|
||||
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
<dimen name="bottom_sheet_content_margin">16dp</dimen>
|
||||
<dimen name="bottom_sheet_content_margin_small">8dp</dimen>
|
||||
<dimen name="content_padding">16dp</dimen>
|
||||
<dimen name="content_padding_small">12dp</dimen>
|
||||
<dimen name="bottom_sheet_content_padding_small">8dp</dimen>
|
||||
<dimen name="measurement_tool_divider_margin">8dp</dimen>
|
||||
<dimen name="measurement_tool_content_padding_medium">12dp</dimen>
|
||||
|
@ -189,6 +190,9 @@
|
|||
<dimen name="bottom_sheet_image_text_margin_start">10dp</dimen>
|
||||
<dimen name="bottom_sheet_selected_item_title_height">56dp</dimen>
|
||||
|
||||
<dimen name="action_bar_image_height">220dp</dimen>
|
||||
<dimen name="action_bar_image_side_margin">70dp</dimen>
|
||||
|
||||
<dimen name="map_markers_recycler_view_padding_bottom">52dp</dimen>
|
||||
<dimen name="map_markers_recycler_view_padding_top">10dp</dimen>
|
||||
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="shared_string_two">Two</string>
|
||||
<string name="shared_string_one">One</string>
|
||||
<string name="show_guide_line_descr">A line connecting your location to locations of the active markers will be shown on the map.</string>
|
||||
<string name="show_arrows_descr">One or two arrows indicating the direction to the active markers will be shown on the map.</string>
|
||||
<string name="distance_indication_descr">Choose how you\'d like to view the distance to the active markers.</string>
|
||||
<string name="active_markers_descr">Choose how many direction indicators you\'d like to see.</string>
|
||||
<string name="digits_quantity">Digits quantity</string>
|
||||
<string name="shared_string_right">Right</string>
|
||||
<string name="shared_string_left">Left</string>
|
||||
|
|
|
@ -713,8 +713,8 @@ public class OsmandSettings {
|
|||
|
||||
public final CommonPreference<RulerMode> RULER_MODE = new EnumIntPreference<>("ruler_mode", RulerMode.FIRST, RulerMode.values()).makeGlobal();
|
||||
|
||||
public final CommonPreference<Boolean> SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeGlobal();
|
||||
public final CommonPreference<Boolean> SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeGlobal();
|
||||
public final CommonPreference<Boolean> SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile();
|
||||
public final CommonPreference<Boolean> SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile();
|
||||
|
||||
public final CommonPreference<Boolean> USE_MAPILLARY_FILTER = new BooleanPreference("use_mapillary_filters", false).makeGlobal();
|
||||
public final CommonPreference<String> MAPILLARY_FILTER_USER_KEY = new StringPreference("mapillary_filter_user_key", "").makeGlobal();
|
||||
|
@ -1315,6 +1315,10 @@ public class OsmandSettings {
|
|||
|
||||
public final OsmandPreference<Boolean> USE_MAP_MARKERS = new BooleanPreference("use_map_markers", true).makeGlobal().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> MARKERS_DISTANCE_INDICATION_ENABLED = new BooleanPreference("markers_distance_indication_enabled", true).makeProfile();
|
||||
|
||||
public final OsmandPreference<Integer> DISPLAYED_MARKERS_WIDGETS_COUNT = new IntPreference("displayed_markers_widgets_count", 1).makeProfile();
|
||||
|
||||
public final CommonPreference<MapMarkersMode> MAP_MARKERS_MODE =
|
||||
new EnumIntPreference<>("map_markers_mode", MapMarkersMode.TOOLBAR, MapMarkersMode.values());
|
||||
|
||||
|
|
|
@ -0,0 +1,353 @@
|
|||
package net.osmand.plus.mapmarkers;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.CompoundButtonCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.PopupMenu.OnMenuItemClickListener;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollView;
|
||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
||||
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.MapMarkersMode;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment {
|
||||
|
||||
public final static String TAG = "DirectionIndicationDialogFragment";
|
||||
|
||||
private DirectionIndicationFragmentListener listener;
|
||||
private View mainView;
|
||||
|
||||
private int helpImgHeight;
|
||||
private boolean shadowVisible;
|
||||
|
||||
public void setListener(DirectionIndicationFragmentListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final OsmandSettings settings = getSettings();
|
||||
helpImgHeight = getResources().getDimensionPixelSize(R.dimen.action_bar_image_height);
|
||||
|
||||
mainView = inflater.inflate(R.layout.fragment_direction_indication_dialog, container);
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
TextView appModeTv = (TextView) mainView.findViewById(R.id.app_mode_text_view);
|
||||
ApplicationMode appMode = settings.APPLICATION_MODE.get();
|
||||
appModeTv.setText(appMode.getStringResource());
|
||||
appModeTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getIconsCache().getIcon(appMode.getSmallIconDark()), null);
|
||||
|
||||
((ObservableScrollView) mainView.findViewById(R.id.scroll_view)).setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
|
||||
@Override
|
||||
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
|
||||
if (scrollY >= helpImgHeight) {
|
||||
if (!shadowVisible) {
|
||||
mainView.findViewById(R.id.app_bar_shadow).setVisibility(View.VISIBLE);
|
||||
shadowVisible = true;
|
||||
}
|
||||
} else if (shadowVisible) {
|
||||
mainView.findViewById(R.id.app_bar_shadow).setVisibility(View.GONE);
|
||||
shadowVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownMotionEvent() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
updateHelpImage();
|
||||
|
||||
final TextView menuTv = (TextView) mainView.findViewById(R.id.active_markers_text_view);
|
||||
menuTv.setText(settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 1 ? R.string.shared_string_one : R.string.shared_string_two);
|
||||
menuTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getContentIcon(R.drawable.ic_action_arrow_drop_down), null);
|
||||
menuTv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int count = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||
PopupMenu popupMenu = new PopupMenu(getActivity(), menuTv);
|
||||
Menu menu = popupMenu.getMenu();
|
||||
popupMenu.getMenuInflater().inflate(R.menu.active_markers_menu, menu);
|
||||
setupActiveMenuItem(menu.findItem(count == 1 ? R.id.action_one : R.id.action_two));
|
||||
popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_one:
|
||||
updateDisplayedMarkersCount(1);
|
||||
return true;
|
||||
case R.id.action_two:
|
||||
updateDisplayedMarkersCount(2);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popupMenu.show();
|
||||
}
|
||||
});
|
||||
|
||||
final CompoundButton distanceIndicationToggle = (CompoundButton) mainView.findViewById(R.id.distance_indication_switch);
|
||||
distanceIndicationToggle.setChecked(settings.MARKERS_DISTANCE_INDICATION_ENABLED.get());
|
||||
mainView.findViewById(R.id.distance_indication_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
updateChecked(settings.MARKERS_DISTANCE_INDICATION_ENABLED, distanceIndicationToggle);
|
||||
updateSelection(true);
|
||||
}
|
||||
});
|
||||
|
||||
mainView.findViewById(R.id.top_bar_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
settings.MAP_MARKERS_MODE.set(MapMarkersMode.TOOLBAR);
|
||||
updateSelection(true);
|
||||
}
|
||||
});
|
||||
|
||||
mainView.findViewById(R.id.widget_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
settings.MAP_MARKERS_MODE.set(MapMarkersMode.WIDGETS);
|
||||
updateSelection(true);
|
||||
}
|
||||
});
|
||||
|
||||
updateSelection(false);
|
||||
|
||||
final CompoundButton showArrowsToggle = (CompoundButton) mainView.findViewById(R.id.show_arrows_switch);
|
||||
showArrowsToggle.setChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS.get());
|
||||
mainView.findViewById(R.id.show_arrows_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
updateChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS, showArrowsToggle);
|
||||
}
|
||||
});
|
||||
|
||||
final CompoundButton showLinesToggle = (CompoundButton) mainView.findViewById(R.id.show_guide_line_switch);
|
||||
showLinesToggle.setChecked(settings.SHOW_LINES_TO_FIRST_MARKERS.get());
|
||||
mainView.findViewById(R.id.show_guide_line_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
updateChecked(settings.SHOW_LINES_TO_FIRST_MARKERS, showLinesToggle);
|
||||
}
|
||||
});
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Drawable getContentIcon(int id) {
|
||||
return getIcon(id, getSettings().isLightContent() ? R.color.icon_color : R.color.ctx_menu_info_text_dark);
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && activity instanceof MapActivity) {
|
||||
return (MapActivity) activity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void updateHelpImage() {
|
||||
OsmandSettings settings = getSettings();
|
||||
int count = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||
LinkedList<Drawable> imgList = new LinkedList<>();
|
||||
imgList.add(getDeviceImg());
|
||||
if (settings.SHOW_LINES_TO_FIRST_MARKERS.get()) {
|
||||
imgList.add(getGuideLineTwoImg());
|
||||
if (count == 2) {
|
||||
imgList.add(getGuideLineOneImg());
|
||||
}
|
||||
}
|
||||
if (settings.SHOW_ARROWS_TO_FIRST_MARKERS.get()) {
|
||||
imgList.add(getArrowTwoImg());
|
||||
if (count == 2) {
|
||||
imgList.add(getArrowOneImg());
|
||||
}
|
||||
}
|
||||
if (settings.MARKERS_DISTANCE_INDICATION_ENABLED.get()) {
|
||||
if (settings.MAP_MARKERS_MODE.get().isWidgets()) {
|
||||
imgList.add(getWidget1Img());
|
||||
if (count == 2) {
|
||||
imgList.add(getWidget2Img());
|
||||
}
|
||||
} else {
|
||||
imgList.add(getTopBar1Img());
|
||||
if (count == 2) {
|
||||
imgList.add(getTopBar2Img());
|
||||
}
|
||||
}
|
||||
}
|
||||
((ImageView) mainView.findViewById(R.id.action_bar_image))
|
||||
.setImageDrawable(new LayerDrawable(imgList.toArray(new Drawable[imgList.size()])));
|
||||
}
|
||||
|
||||
private Drawable getTopBar2Img() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_topbar_2_day : R.drawable.img_help_markers_direction_topbar_2_night);
|
||||
}
|
||||
|
||||
private Drawable getTopBar1Img() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_topbar_1_day : R.drawable.img_help_markers_direction_topbar_1_night);
|
||||
}
|
||||
|
||||
private Drawable getWidget2Img() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_widget_2_day : R.drawable.img_help_markers_direction_widget_2_night);
|
||||
}
|
||||
|
||||
private Drawable getWidget1Img() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_widget_1_day : R.drawable.img_help_markers_direction_widget_1_night);
|
||||
}
|
||||
|
||||
private Drawable getArrowOneImg() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_arrow_one_day : R.drawable.img_help_markers_direction_arrow_one_night);
|
||||
}
|
||||
|
||||
private Drawable getArrowTwoImg() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_arrow_two_day : R.drawable.img_help_markers_direction_arrow_two_night);
|
||||
}
|
||||
|
||||
private Drawable getGuideLineOneImg() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_guideline_one_day : R.drawable.img_help_markers_direction_guideline_one_night);
|
||||
}
|
||||
|
||||
private Drawable getGuideLineTwoImg() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_guideline_two_day : R.drawable.img_help_markers_direction_guideline_two_night);
|
||||
}
|
||||
|
||||
private Drawable getDeviceImg() {
|
||||
return getIconsCache().getIcon(getSettings().isLightContent()
|
||||
? R.drawable.img_help_markers_direction_device_day : R.drawable.img_help_markers_direction_device_night);
|
||||
}
|
||||
|
||||
private void setupActiveMenuItem(MenuItem item) {
|
||||
int stringId = item.getItemId() == R.id.action_one ? R.string.shared_string_one : R.string.shared_string_two;
|
||||
SpannableString title = new SpannableString(getString(stringId));
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getActivity(), getSettings().isLightContent()
|
||||
? R.color.dashboard_blue : R.color.osmand_orange)), 0, title.length(), 0);
|
||||
item.setTitle(title);
|
||||
}
|
||||
|
||||
private Drawable getIconBackground(boolean active) {
|
||||
return active ? getIcon(R.drawable.ic_action_device_top, R.color.dashboard_blue)
|
||||
: getContentIcon(R.drawable.ic_action_device_top);
|
||||
}
|
||||
|
||||
private Drawable getIconTop(int id, boolean active) {
|
||||
return active ? getIcon(id, R.color.osmand_orange) : getContentIcon(id);
|
||||
}
|
||||
|
||||
private void updateDisplayedMarkersCount(int count) {
|
||||
((TextView) mainView.findViewById(R.id.active_markers_text_view))
|
||||
.setText(count == 1 ? R.string.shared_string_one : R.string.shared_string_two);
|
||||
getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.set(count);
|
||||
updateSelection(true);
|
||||
}
|
||||
|
||||
private void updateChecked(OsmandPreference<Boolean> setting, CompoundButton button) {
|
||||
boolean newState = !setting.get();
|
||||
setting.set(newState);
|
||||
button.setChecked(newState);
|
||||
refreshMap();
|
||||
updateHelpImage();
|
||||
}
|
||||
|
||||
private void refreshMap() {
|
||||
if (getMapActivity() != null) {
|
||||
getMapActivity().refreshMap();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListener() {
|
||||
if (listener != null) {
|
||||
listener.onMapMarkersModeChanged(getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSelection(boolean notifyListener) {
|
||||
OsmandSettings settings = getSettings();
|
||||
MapMarkersMode mode = settings.MAP_MARKERS_MODE.get();
|
||||
boolean distIndEnabled = settings.MARKERS_DISTANCE_INDICATION_ENABLED.get();
|
||||
int count = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||
int topBarIconId = count == 1 ? R.drawable.ic_action_device_topbar : R.drawable.ic_action_device_topbar_two;
|
||||
int widgetIconId = count == 1 ? R.drawable.ic_action_device_widget : R.drawable.ic_action_device_widget_two;
|
||||
updateIcon(R.id.top_bar_icon, topBarIconId, mode.isToolbar() && distIndEnabled);
|
||||
updateIcon(R.id.widget_icon, widgetIconId, mode.isWidgets() && distIndEnabled);
|
||||
updateMarkerModeRow(R.id.top_bar_row, R.id.top_bar_radio_button, mode.isToolbar(), distIndEnabled);
|
||||
updateMarkerModeRow(R.id.widget_row, R.id.widget_radio_button, mode.isWidgets(), distIndEnabled);
|
||||
if (notifyListener) {
|
||||
notifyListener();
|
||||
}
|
||||
updateHelpImage();
|
||||
}
|
||||
|
||||
private void updateIcon(int imageViewId, int drawableId, boolean active) {
|
||||
ImageView iv = (ImageView) mainView.findViewById(imageViewId);
|
||||
iv.setBackgroundDrawable(getIconBackground(active));
|
||||
iv.setImageDrawable(getIconTop(drawableId, active));
|
||||
}
|
||||
|
||||
private void updateMarkerModeRow(int rowId, int radioButtonId, boolean checked, boolean active) {
|
||||
boolean night = !getSettings().isLightContent();
|
||||
RadioButton rb = (RadioButton) mainView.findViewById(radioButtonId);
|
||||
int colorId = active ? night ? R.color.osmand_orange : R.color.dashboard_blue
|
||||
: night ? R.color.ctx_menu_info_text_dark : R.color.icon_color;
|
||||
rb.setChecked(checked);
|
||||
CompoundButtonCompat.setButtonTintList(rb, ColorStateList.valueOf(ContextCompat.getColor(getContext(), colorId)));
|
||||
mainView.findViewById(rowId).setEnabled(active);
|
||||
}
|
||||
|
||||
public interface DirectionIndicationFragmentListener {
|
||||
void onMapMarkersModeChanged(boolean showDirectionEnabled);
|
||||
}
|
||||
}
|
|
@ -27,10 +27,10 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.OnMapMarkersSavedListener;
|
||||
import net.osmand.plus.mapmarkers.DirectionIndicationDialogFragment.DirectionIndicationFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener;
|
||||
import net.osmand.plus.mapmarkers.ShowDirectionBottomSheetDialogFragment.ShowDirectionFragmentListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -99,9 +99,9 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
if (optionsFragment != null) {
|
||||
((OptionsBottomSheetDialogFragment) optionsFragment).setListener(createOptionsFragmentListener());
|
||||
}
|
||||
Fragment showDirectionFragment = fragmentManager.findFragmentByTag(ShowDirectionBottomSheetDialogFragment.TAG);
|
||||
if (showDirectionFragment != null) {
|
||||
((ShowDirectionBottomSheetDialogFragment) showDirectionFragment).setListener(createShowDirectionFragmentListener());
|
||||
Fragment directionIndicationFragment = fragmentManager.findFragmentByTag(DirectionIndicationDialogFragment.TAG);
|
||||
if (directionIndicationFragment != null) {
|
||||
((DirectionIndicationDialogFragment) directionIndicationFragment).setListener(createShowDirectionFragmentListener());
|
||||
}
|
||||
final Fragment orderByFragment = fragmentManager.findFragmentByTag(OrderByBottomSheetDialogFragment.TAG);
|
||||
if (orderByFragment != null) {
|
||||
|
@ -238,17 +238,16 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
OrderByBottomSheetDialogFragment fragment = new OrderByBottomSheetDialogFragment();
|
||||
fragment.setUsedOnMap(false);
|
||||
fragment.setListener(createOrderByFragmentListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), OrderByBottomSheetDialogFragment.TAG);
|
||||
fragment.show(getChildFragmentManager(), OrderByBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showDirectionOnClick() {
|
||||
if (mapActivity != null) {
|
||||
ShowDirectionBottomSheetDialogFragment fragment = new ShowDirectionBottomSheetDialogFragment();
|
||||
fragment.setUsedOnMap(false);
|
||||
DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
|
||||
fragment.setListener(createShowDirectionFragmentListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), ShowDirectionBottomSheetDialogFragment.TAG);
|
||||
fragment.show(getChildFragmentManager(), DirectionIndicationDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,7 +257,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
CoordinateInputDialogFragment fragment = new CoordinateInputDialogFragment();
|
||||
fragment.setRetainInstance(true);
|
||||
fragment.setListener(createOnMapMarkersSavedListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), CoordinateInputDialogFragment.TAG);
|
||||
fragment.show(getChildFragmentManager(), CoordinateInputDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +281,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
} else {
|
||||
SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment();
|
||||
fragment.setListener(createSaveAsTrackFragmentListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), SaveAsTrackBottomSheetDialogFragment.TAG);
|
||||
fragment.show(getChildFragmentManager(), SaveAsTrackBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -319,8 +318,8 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
};
|
||||
}
|
||||
|
||||
private ShowDirectionFragmentListener createShowDirectionFragmentListener() {
|
||||
return new ShowDirectionFragmentListener() {
|
||||
private DirectionIndicationFragmentListener createShowDirectionFragmentListener() {
|
||||
return new DirectionIndicationFragmentListener() {
|
||||
|
||||
final MapActivity mapActivity = getMapActivity();
|
||||
|
||||
|
|
|
@ -1,233 +0,0 @@
|
|||
package net.osmand.plus.mapmarkers;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Typeface;
|
||||
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.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
|
||||
public class ShowDirectionBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||
|
||||
public final static String TAG = "ShowDirectionBottomSheetDialogFragment";
|
||||
|
||||
private ShowDirectionFragmentListener listener;
|
||||
private View mainView;
|
||||
|
||||
public void setListener(ShowDirectionFragmentListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final OsmandSettings settings = getMyApplication().getSettings();
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_show_direction_bottom_sheet_dialog, container);
|
||||
|
||||
OsmandSettings.MapMarkersMode mode = settings.MAP_MARKERS_MODE.get();
|
||||
highlightSelectedItem(mode, true);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
mainView.findViewById(R.id.images_row).setVisibility(View.GONE);
|
||||
} else {
|
||||
ImageView topBarImage = (ImageView) mainView.findViewById(R.id.top_bar_image);
|
||||
ImageView widgetImage = (ImageView) mainView.findViewById(R.id.widget_image);
|
||||
if (nightMode) {
|
||||
topBarImage.setImageResource(R.drawable.img_help_markers_topbar_night);
|
||||
widgetImage.setImageResource(R.drawable.img_help_markers_widgets_night);
|
||||
} else {
|
||||
topBarImage.setImageResource(R.drawable.img_help_markers_topbar_day);
|
||||
widgetImage.setImageResource(R.drawable.img_help_markers_widgets_day);
|
||||
}
|
||||
|
||||
mainView.findViewById(R.id.top_bar_image_text).setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
topBarImage.setOnClickListener(showDirectionOnClickListener);
|
||||
|
||||
mainView.findViewById(R.id.widget_image_text).setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
widgetImage.setOnClickListener(showDirectionOnClickListener);
|
||||
}
|
||||
|
||||
if (nightMode) {
|
||||
((TextView) mainView.findViewById(R.id.show_direction_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
|
||||
}
|
||||
|
||||
final CompoundButton showArrowsToggle = (CompoundButton) mainView.findViewById(R.id.show_arrows_switch);
|
||||
showArrowsToggle.setChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS.get());
|
||||
mainView.findViewById(R.id.show_arrows_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean newState = !settings.SHOW_ARROWS_TO_FIRST_MARKERS.get();
|
||||
settings.SHOW_ARROWS_TO_FIRST_MARKERS.set(newState);
|
||||
showArrowsToggle.setChecked(newState);
|
||||
if (getMapActivity() != null) {
|
||||
getMapActivity().refreshMap();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final CompoundButton showLinesToggle = (CompoundButton) mainView.findViewById(R.id.show_guide_line_switch);
|
||||
showLinesToggle.setChecked(settings.SHOW_LINES_TO_FIRST_MARKERS.get());
|
||||
mainView.findViewById(R.id.show_guide_line_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean newState = !settings.SHOW_LINES_TO_FIRST_MARKERS.get();
|
||||
settings.SHOW_LINES_TO_FIRST_MARKERS.set(newState);
|
||||
showLinesToggle.setChecked(newState);
|
||||
if (getMapActivity() != null) {
|
||||
getMapActivity().refreshMap();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ImageView topBarIcon = (ImageView) mainView.findViewById(R.id.top_bar_icon);
|
||||
topBarIcon.setBackgroundDrawable(getContentIcon(R.drawable.ic_action_device_top));
|
||||
topBarIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, R.color.dashboard_blue));
|
||||
|
||||
ImageView widgetIcon = (ImageView) mainView.findViewById(R.id.widget_icon);
|
||||
widgetIcon.setBackgroundDrawable(getContentIcon(R.drawable.ic_action_device_top));
|
||||
widgetIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, R.color.dashboard_blue));
|
||||
|
||||
ImageView noneIcon = (ImageView) mainView.findViewById(R.id.none_icon);
|
||||
noneIcon.setBackgroundDrawable(getContentIcon(R.drawable.ic_action_device_top));
|
||||
|
||||
mainView.findViewById(R.id.top_bar_row).setOnClickListener(showDirectionOnClickListener);
|
||||
mainView.findViewById(R.id.widget_row).setOnClickListener(showDirectionOnClickListener);
|
||||
mainView.findViewById(R.id.none_row).setOnClickListener(showDirectionOnClickListener);
|
||||
|
||||
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
setupHeightAndBackground(mainView, R.id.marker_show_direction_scroll_view);
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
return (MapActivity) activity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void highlightSelectedItem(OsmandSettings.MapMarkersMode mode, boolean check) {
|
||||
int iconBgColor = check ? R.color.dashboard_blue : R.color.on_map_icon_color;
|
||||
int iconColor = check ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue;
|
||||
int textColor = ContextCompat.getColor(getContext(), check ? (nightMode ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : nightMode ? R.color.color_white : R.color.color_black);
|
||||
Typeface typeface = FontCache.getFont(getContext(), check ? "fonts/Roboto-Medium.ttf" : "fonts/Roboto-Regular.ttf");
|
||||
switch (mode) {
|
||||
case TOOLBAR:
|
||||
((RadioButton) mainView.findViewById(R.id.top_bar_radio_button)).setChecked(check);
|
||||
ImageView topBarIcon = (ImageView) mainView.findViewById(R.id.top_bar_icon);
|
||||
if (check) {
|
||||
mainView.findViewById(R.id.top_bar_row_frame).setBackgroundColor(ContextCompat.getColor(getContext(), R.color.show_direction_menu_selected_item_bg));
|
||||
} else {
|
||||
mainView.findViewById(R.id.top_bar_row_frame).setBackgroundResource(0);
|
||||
}
|
||||
TextView topBarText = (TextView) mainView.findViewById(R.id.top_bar_text);
|
||||
topBarText.setTextColor(textColor);
|
||||
topBarText.setTypeface(typeface);
|
||||
topBarIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
|
||||
topBarIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, iconColor));
|
||||
break;
|
||||
case WIDGETS:
|
||||
((RadioButton) mainView.findViewById(R.id.widget_radio_button)).setChecked(check);
|
||||
ImageView widgetIcon = (ImageView) mainView.findViewById(R.id.widget_icon);
|
||||
if (check) {
|
||||
mainView.findViewById(R.id.widget_row_frame).setBackgroundColor(ContextCompat.getColor(getContext(), R.color.show_direction_menu_selected_item_bg));
|
||||
} else {
|
||||
mainView.findViewById(R.id.widget_row_frame).setBackgroundResource(0);
|
||||
}
|
||||
TextView widgetText = (TextView) mainView.findViewById(R.id.widget_text);
|
||||
widgetText.setTextColor(textColor);
|
||||
widgetText.setTypeface(typeface);
|
||||
widgetIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
|
||||
widgetIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, iconColor));
|
||||
break;
|
||||
case NONE:
|
||||
((RadioButton) mainView.findViewById(R.id.none_radio_button)).setChecked(check);
|
||||
ImageView noneIcon = (ImageView) mainView.findViewById(R.id.none_icon);
|
||||
if (check) {
|
||||
mainView.findViewById(R.id.none_row_frame).setBackgroundColor(ContextCompat.getColor(getContext(), R.color.show_direction_menu_selected_item_bg));
|
||||
} else {
|
||||
mainView.findViewById(R.id.none_row_frame).setBackgroundResource(0);
|
||||
}
|
||||
TextView noneText = (TextView) mainView.findViewById(R.id.none_text);
|
||||
noneText.setTextColor(textColor);
|
||||
noneText.setTypeface(typeface);
|
||||
noneIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private View.OnClickListener showDirectionOnClickListener = new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OsmandSettings.MapMarkersMode previousMode = getMyApplication().getSettings().MAP_MARKERS_MODE.get();
|
||||
highlightSelectedItem(previousMode, false);
|
||||
boolean showDirectionEnabled = false;
|
||||
switch (view.getId()) {
|
||||
case R.id.top_bar_image:
|
||||
case R.id.top_bar_row:
|
||||
getMyApplication().getSettings().MAP_MARKERS_MODE.set(OsmandSettings.MapMarkersMode.TOOLBAR);
|
||||
highlightSelectedItem(OsmandSettings.MapMarkersMode.TOOLBAR, true);
|
||||
showDirectionEnabled = true;
|
||||
break;
|
||||
case R.id.widget_image:
|
||||
case R.id.widget_row:
|
||||
getMyApplication().getSettings().MAP_MARKERS_MODE.set(OsmandSettings.MapMarkersMode.WIDGETS);
|
||||
highlightSelectedItem(OsmandSettings.MapMarkersMode.WIDGETS, true);
|
||||
showDirectionEnabled = true;
|
||||
break;
|
||||
case R.id.none_row:
|
||||
getMyApplication().getSettings().MAP_MARKERS_MODE.set(OsmandSettings.MapMarkersMode.NONE);
|
||||
highlightSelectedItem(OsmandSettings.MapMarkersMode.NONE, true);
|
||||
showDirectionEnabled = false;
|
||||
break;
|
||||
}
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.refreshMap();
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onMapMarkersModeChanged(showDirectionEnabled);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
};
|
||||
|
||||
public interface ShowDirectionFragmentListener {
|
||||
void onMapMarkersModeChanged(boolean showDirectionEnabled);
|
||||
}
|
||||
}
|
|
@ -93,7 +93,8 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
int drawableResToUpdate;
|
||||
int markerColor = MapMarker.getColorId(marker.colorIndex);
|
||||
LatLon markerLatLon = new LatLon(marker.getLatitude(), marker.getLongitude());
|
||||
if (showDirectionEnabled && pos < 2) {
|
||||
int displayedWidgets = mapActivity.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||
if (showDirectionEnabled && pos < displayedWidgets) {
|
||||
holder.iconDirection.setVisibility(View.GONE);
|
||||
|
||||
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_arrow_marker_diretion, markerColor));
|
||||
|
|
|
@ -67,10 +67,20 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
}
|
||||
|
||||
public void updateShowDirectionMarkers() {
|
||||
showDirectionEnabled = app.getSettings().MAP_MARKERS_MODE.get() != OsmandSettings.MapMarkersMode.NONE;;
|
||||
showDirectionEnabled = app.getSettings().MAP_MARKERS_MODE.get() != OsmandSettings.MapMarkersMode.NONE;
|
||||
List<MapMarker> mapMarkers = app.getMapMarkersHelper().getMapMarkers();
|
||||
int markersCount = mapMarkers.size();
|
||||
showDirectionMarkers = new ArrayList<>(mapMarkers.subList(0, markersCount > 0 ? markersCount > 1 ? 2 : 1 : 0));
|
||||
showDirectionMarkers = new ArrayList<>(mapMarkers.subList(0, getToIndex(markersCount)));
|
||||
}
|
||||
|
||||
private int getToIndex(int markersCount) {
|
||||
if (markersCount > 0) {
|
||||
if (markersCount > 1 && app.getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 2) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void createDisplayGroups() {
|
||||
|
|
|
@ -222,6 +222,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
|
||||
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
|
||||
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
|
||||
int displayedWidgets = map.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||
|
||||
if (route != null && route.points.size() > 0) {
|
||||
planRouteAttrs.updatePaints(view, nightMode, tileBox);
|
||||
|
@ -239,6 +240,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
textAttrs.updatePaints(view, nightMode, tileBox);
|
||||
textAttrs.paint.setStyle(Paint.Style.FILL);
|
||||
|
||||
boolean drawMarkerName = map.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 1;
|
||||
|
||||
int locX;
|
||||
int locY;
|
||||
if (map.getMapViewTrackingUtilities().isMapLinkedToLocation()
|
||||
|
@ -251,7 +254,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
locY = (int) tileBox.getPixYFromLatLon(myLoc.getLatitude(), myLoc.getLongitude());
|
||||
}
|
||||
int[] colors = MapMarker.getColors(map);
|
||||
for (int i = 0; i < activeMapMarkers.size() && i < 2; i++) {
|
||||
for (int i = 0; i < activeMapMarkers.size() && i < displayedWidgets; i++) {
|
||||
MapMarker marker = activeMapMarkers.get(i);
|
||||
int markerX = (int) tileBox.getPixXFromLatLon(marker.getLatitude(), marker.getLongitude());
|
||||
int markerY = (int) tileBox.getPixYFromLatLon(marker.getLatitude(), marker.getLongitude());
|
||||
|
@ -272,7 +275,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
|
||||
float dist = (float) MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(), marker.getLatitude(), marker.getLongitude());
|
||||
String distSt = OsmAndFormatter.getFormattedDistance(dist, view.getApplication());
|
||||
String text = distSt + " • " + marker.getName(map);
|
||||
String text = distSt + (drawMarkerName ? " • " + marker.getName(map) : "");
|
||||
Rect bounds = new Rect();
|
||||
textAttrs.paint.getTextBounds(text, 0, text.length(), bounds);
|
||||
float hOffset = pm.getLength() / 2 - bounds.width() / 2;
|
||||
|
@ -300,6 +303,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
widgetsFactory.updateInfo(useFingerLocation ? fingerLocation : (myLoc == null
|
||||
? tileBox.getCenterLatLon() : new LatLon(myLoc.getLatitude(), myLoc.getLongitude())), tileBox.getZoom());
|
||||
OsmandSettings settings = map.getMyApplication().getSettings();
|
||||
int displayedWidgets = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
|
||||
|
||||
if (tileBox.getZoom() < 3 || !settings.USE_MAP_MARKERS.get()) {
|
||||
return;
|
||||
|
@ -340,7 +344,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
canvas.restore();
|
||||
}
|
||||
i++;
|
||||
if (i > 1) {
|
||||
if (i > displayedWidgets - 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,6 +201,7 @@ public class MapMarkersWidgetsFactory {
|
|||
|
||||
List<MapMarker> markers = helper.getMapMarkers();
|
||||
if (zoom < 3 || markers.size() == 0
|
||||
|| !map.getMyApplication().getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get()
|
||||
|| !map.getMyApplication().getSettings().MAP_MARKERS_MODE.get().isToolbar()
|
||||
|| map.getMyApplication().getRoutingHelper().isFollowingMode()
|
||||
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|
||||
|
@ -218,7 +219,7 @@ public class MapMarkersWidgetsFactory {
|
|||
MapMarker marker = markers.get(0);
|
||||
updateUI(loc, heading, marker, arrowImg, distText, okButton, addressText, true, customLocation != null);
|
||||
|
||||
if (markers.size() > 1) {
|
||||
if (markers.size() > 1 && map.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 2) {
|
||||
marker = markers.get(1);
|
||||
if (loc != null && customLocation == null) {
|
||||
for (int i = 1; i < markers.size(); i++) {
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.osmand.plus.OsmandSettings.OsmandPreference;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.mapmarkers.ShowDirectionBottomSheetDialogFragment;
|
||||
import net.osmand.plus.mapmarkers.DirectionIndicationDialogFragment;
|
||||
import net.osmand.plus.quickaction.QuickActionListFragment;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
import net.osmand.plus.views.MapQuickActionLayer;
|
||||
|
@ -327,9 +327,8 @@ public class MapWidgetRegistry {
|
|||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int position, boolean isChecked) {
|
||||
ShowDirectionBottomSheetDialogFragment fragment = new ShowDirectionBottomSheetDialogFragment();
|
||||
fragment.setUsedOnMap(true);
|
||||
fragment.setListener(new ShowDirectionBottomSheetDialogFragment.ShowDirectionFragmentListener() {
|
||||
DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
|
||||
fragment.setListener(new DirectionIndicationDialogFragment.DirectionIndicationFragmentListener() {
|
||||
@Override
|
||||
public void onMapMarkersModeChanged(boolean showDirectionEnabled) {
|
||||
updateMapMarkersMode(map);
|
||||
|
@ -337,7 +336,7 @@ public class MapWidgetRegistry {
|
|||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
fragment.show(map.getSupportFragmentManager(), ShowDirectionBottomSheetDialogFragment.TAG);
|
||||
fragment.show(map.getSupportFragmentManager(), DirectionIndicationDialogFragment.TAG);
|
||||
return false;
|
||||
}
|
||||
}).setLayout(R.layout.list_item_text_button).createItem());
|
||||
|
@ -346,8 +345,13 @@ public class MapWidgetRegistry {
|
|||
|
||||
public void updateMapMarkersMode(MapActivity mapActivity) {
|
||||
for (MapWidgetRegInfo info : rightWidgetSet) {
|
||||
if ("map_marker_1st".equals(info.key) || "map_marker_2nd".equals(info.key)) {
|
||||
setVisibility(info, settings.MAP_MARKERS_MODE.get().isWidgets(), false);
|
||||
if ("map_marker_1st".equals(info.key)) {
|
||||
setVisibility(info, settings.MAP_MARKERS_MODE.get().isWidgets()
|
||||
&& settings.MARKERS_DISTANCE_INDICATION_ENABLED.get(), false);
|
||||
} else if ("map_marker_2nd".equals(info.key)) {
|
||||
setVisibility(info, settings.MAP_MARKERS_MODE.get().isWidgets()
|
||||
&& settings.MARKERS_DISTANCE_INDICATION_ENABLED.get()
|
||||
&& settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get() == 2, false);
|
||||
}
|
||||
}
|
||||
MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
|
||||
|
|
Loading…
Reference in a new issue