Profile preferences Ui improvements
This commit is contained in:
parent
ebfc53f19a
commit
1a797d29fa
36 changed files with 586 additions and 474 deletions
12
OsmAnd/res/drawable/rectangle_rounded.xml
Normal file
12
OsmAnd/res/drawable/rectangle_rounded.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/context_menu_padding_margin_tiny" />
|
||||
<solid android:color="@color/list_background_color_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
13
OsmAnd/res/drawable/ripple_circle.xml
Normal file
13
OsmAnd/res/drawable/ripple_circle.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/active_buttons_and_links_trans_dark">
|
||||
<item
|
||||
android:id="@android:id/mask"
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/active_color_primary_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
14
OsmAnd/res/drawable/ripple_rectangle_rounded.xml
Normal file
14
OsmAnd/res/drawable/ripple_rectangle_rounded.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/active_buttons_and_links_trans_dark">
|
||||
<item
|
||||
android:id="@android:id/mask"
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/context_menu_padding_margin_tiny" />
|
||||
<solid android:color="@color/active_color_primary_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
|
@ -1,6 +1,7 @@
|
|||
<?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/list_background_color"
|
||||
|
@ -10,7 +11,7 @@
|
|||
android:id="@+id/selectable_list_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
|
@ -27,9 +28,9 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginBottom="@dimen/list_header_settings_top_margin"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/list_header_settings_top_margin"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
<?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/list_background_color"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/selectable_list_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height">
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<RadioButton
|
||||
android:id="@android:id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding_small"
|
||||
android:layout_marginRight="@dimen/content_padding_small"
|
||||
android:background="@null"
|
||||
android:clickable="true"
|
||||
android:focusable="true" />
|
||||
|
@ -28,10 +30,11 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/gpx_small_text_margin"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/title"
|
||||
|
@ -49,10 +52,18 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="4"
|
||||
android:paddingBottom="@dimen/gpx_small_text_margin"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/divider_color_basic" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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/list_background_color"
|
||||
|
@ -10,8 +11,8 @@
|
|||
android:id="@+id/selectable_list_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height">
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
|
@ -25,10 +26,10 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/title"
|
||||
|
|
|
@ -20,32 +20,25 @@
|
|||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding" />
|
||||
|
||||
<LinearLayout
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textColor="?attr/text_color_tab_active"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<Switch
|
||||
android:id="@android:id/switch_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding" />
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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/list_background_color"
|
||||
|
@ -10,8 +11,8 @@
|
|||
android:id="@+id/selectable_list_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height">
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
|
@ -27,10 +28,10 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/title"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?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/list_background_color"
|
||||
|
@ -10,7 +11,7 @@
|
|||
android:id="@+id/selectable_list_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
tools:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
|
@ -26,10 +27,10 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@android:id/title"
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:minHeight="56dp"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
osmand:contentInsetLeft="0dp"
|
||||
osmand:contentInsetStart="0dp"
|
||||
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||
|
@ -14,55 +13,49 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/card_and_list_background_basic"
|
||||
android:orientation="vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
<ImageButton
|
||||
android:id="@+id/close_button"
|
||||
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
||||
android:layout_width="@dimen/toolbar_height"
|
||||
android:layout_height="@dimen/toolbar_height"
|
||||
android:contentDescription="@string/access_shared_string_navigate_up"
|
||||
android:src="@drawable/ic_action_mode_back"
|
||||
android:tint="?attr/default_icon_color" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/toolbar_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:orientation="horizontal">
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="@string/routing_settings_2" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/close_button"
|
||||
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:contentDescription="@string/access_shared_string_navigate_up"
|
||||
android:src="@drawable/ic_action_mode_back"
|
||||
android:tint="?attr/default_icon_color" />
|
||||
<FrameLayout
|
||||
android:id="@+id/switch_profile_button"
|
||||
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
tools:background="?attr/bg_circle"
|
||||
tools:backgroundTint="@color/active_buttons_and_links_trans_light">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/toolbar_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/routing_settings_2"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
<ImageView
|
||||
android:id="@+id/profile_icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center"
|
||||
tools:src="@drawable/ic_action_car_dark"
|
||||
tools:tint="@color/active_color_primary_light" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/switch_profile_button"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center"
|
||||
tools:src="@drawable/ic_action_car_dark"
|
||||
tools:tint="@color/active_color_primary_light" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:minHeight="56dp"
|
||||
osmand:contentInsetLeft="0dp"
|
||||
osmand:contentInsetStart="0dp"
|
||||
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||
|
@ -20,14 +18,14 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:minHeight="@dimen/toolbar_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/close_button"
|
||||
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_width="@dimen/toolbar_height"
|
||||
android:layout_height="@dimen/toolbar_height"
|
||||
android:contentDescription="@string/access_shared_string_navigate_up"
|
||||
android:src="@drawable/ic_action_mode_back"
|
||||
android:tint="?attr/default_icon_color" />
|
||||
|
@ -35,110 +33,93 @@
|
|||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/toolbar_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size_large"
|
||||
android:textStyle="bold"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="@string/routing_settings_2" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:padding="@dimen/content_padding"
|
||||
android:src="@drawable/ic_overflow_menu_dark"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_button"
|
||||
android:id="@+id/switch_profile_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginRight="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
tools:src="@drawable/ic_action_bus_dark"
|
||||
tools:tint="?attr/default_icon_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/switch_profile_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="horizontal">
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_icon"
|
||||
android:layout_width="wrap_content"
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/profile_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
android:src="@drawable/ic_action_coordinates_latitude"
|
||||
tools:tint="?attr/default_icon_color" />
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="@string/profile_type_base_string" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/profile_type"
|
||||
android:layout_width="match_parent"
|
||||
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:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/profile_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/profile_type_base_string"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/profile_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Item additional description" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"
|
||||
android:tint="?attr/default_icon_color" />
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="Item additional description" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/toolbar_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:visibility="visible"
|
||||
tools:background="?attr/active_color_basic" />
|
||||
<ImageView
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_image_text_margin_start"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"
|
||||
android:tint="?attr/default_icon_color" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/toolbar_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:visibility="visible"
|
||||
tools:background="?attr/active_color_basic" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
|
@ -424,6 +424,7 @@
|
|||
<color name="text_field_box_light">#eeeeee</color>
|
||||
|
||||
<color name="preference_category_title">#7E33FF</color>
|
||||
<color name="preference_top_switch_off">#808080</color>
|
||||
|
||||
<!-- Basic colors -->
|
||||
<color name="app_bar_main_dark">#101112</color>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
|
||||
<string name="plugins_settings">Plugin settings</string>
|
||||
<string name="logcat_buffer">Logcat buffer</string>
|
||||
<string name="application_profile_changed">Application profile changed to \"%s\"</string>
|
||||
<string name="switch_profile">Switch profile</string>
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
android:key="plugin_settings"
|
||||
android:layout="@layout/preference_category_with_descr"
|
||||
android:summary="@string/list_of_installed_plugins"
|
||||
android:title="@string/plugin_settings" />
|
||||
android:title="@string/plugins_settings" />
|
||||
|
||||
<Preference
|
||||
android:layout="@layout/card_bottom_divider"
|
||||
android:selectable="false" />
|
||||
|
||||
</PreferenceScreen>
|
|
@ -5,7 +5,6 @@
|
|||
<Preference
|
||||
android:key="coordinates_format_info"
|
||||
android:layout="@layout/preference_info"
|
||||
android:order="0"
|
||||
android:persistent="false"
|
||||
android:selectable="false"
|
||||
android:title="@string/coordinates_format_info"
|
||||
|
@ -14,35 +13,30 @@
|
|||
<CheckBoxPreference
|
||||
android:key="format_degrees"
|
||||
android:layout="@layout/preference_radio_button"
|
||||
android:order="1"
|
||||
android:persistent="false"
|
||||
android:title="@string/navigate_point_format_D" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="format_minutes"
|
||||
android:layout="@layout/preference_radio_button"
|
||||
android:order="2"
|
||||
android:persistent="false"
|
||||
android:title="@string/navigate_point_format_DM" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="format_seconds"
|
||||
android:layout="@layout/preference_radio_button"
|
||||
android:order="3"
|
||||
android:persistent="false"
|
||||
android:title="@string/navigate_point_format_DMS" />
|
||||
|
||||
<!-- This pref added in code -->
|
||||
<!-- <CheckBoxPreference-->
|
||||
<!-- android:key="utm_format"-->
|
||||
<!-- android:layout="@layout/preference_radio_button"-->
|
||||
<!-- android:persistent="false"-->
|
||||
<!-- android:title="@string/navigate_point_format_utm" />-->
|
||||
<CheckBoxPreference
|
||||
android:key="utm_format"
|
||||
android:layout="@layout/preference_radio_button"
|
||||
android:persistent="false"
|
||||
android:title="@string/navigate_point_format_utm" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="olc_format"
|
||||
android:layout="@layout/preference_radio_button"
|
||||
android:order="5"
|
||||
android:persistent="false"
|
||||
android:title="@string/navigate_point_format_olc" />
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:key="turn_screen_on_enabled"
|
||||
android:layout="@layout/preference_dialog_and_switch"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_off"
|
||||
android:summaryOn="@string/shared_string_on"
|
||||
android:title="@string/turn_screen_on"
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
<net.osmand.plus.settings.preferences.ListPreferenceEx
|
||||
android:dependency="turn_screen_on_enabled"
|
||||
android:key="turn_screen_on_time_int"
|
||||
android:layout="@layout/preference_with_descr"
|
||||
android:title="@string/wake_time" />
|
||||
|
||||
<net.osmand.plus.settings.preferences.SwitchPreferenceEx
|
||||
android:dependency="turn_screen_on_enabled"
|
||||
android:key="turn_screen_on_sensor"
|
||||
android:layout="@layout/preference_dialog_and_switch"
|
||||
android:layout="@layout/preference_with_descr_dialog_and_switch"
|
||||
android:summaryOff="@string/shared_string_off"
|
||||
android:summaryOn="@string/shared_string_on"
|
||||
android:title="@string/turn_screen_on_sensor" />
|
||||
|
|
|
@ -318,14 +318,21 @@ public class AndroidUtils {
|
|||
tv.setMaxLines(maxLines);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) {
|
||||
Drawable drawable;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
view.setBackground(ctx.getResources().getDrawable(night ? darkResId : lightResId,
|
||||
ctx.getTheme()));
|
||||
drawable = ctx.getResources().getDrawable(night ? darkResId : lightResId, ctx.getTheme());
|
||||
} else {
|
||||
view.setBackgroundDrawable(ctx.getResources().getDrawable(night ? darkResId : lightResId));
|
||||
drawable = ctx.getResources().getDrawable(night ? darkResId : lightResId);
|
||||
}
|
||||
setBackground(view, drawable);
|
||||
}
|
||||
|
||||
public static void setBackground(View view, Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
view.setBackground(drawable);
|
||||
} else {
|
||||
view.setBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ package net.osmand.plus;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
@ -199,9 +201,13 @@ public class ContextMenuAdapter {
|
|||
View fatDivider = convertView.findViewById(R.id.fatDivider);
|
||||
fatDivider.setBackgroundColor(colorNoAlpha);
|
||||
}
|
||||
|
||||
int colorListBackground = ContextCompat.getColor(app, lightTheme ? R.color.list_background_color_light : R.color.list_background_color_dark);
|
||||
// convertView.setBackgroundDrawable(UiUtilities.getAlphaStateDrawable(colorListBackground, colorNoAlpha));
|
||||
|
||||
Drawable selectableBg = UiUtilities.getColoredSelectableDrawable(app, colorNoAlpha, 0.3f);
|
||||
Drawable[] layers = {new ColorDrawable(UiUtilities.getColorWithAlpha(colorNoAlpha, 0.15f)), selectableBg};
|
||||
LayerDrawable layerDrawable = new LayerDrawable(layers);
|
||||
|
||||
AndroidUtils.setBackground(convertView, layerDrawable);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
if (layoutId == R.layout.help_to_improve_item) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus;
|
|||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
|
@ -17,7 +16,6 @@ import android.support.annotation.DrawableRes;
|
|||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v4.graphics.drawable.TintAwareDrawable;
|
||||
import android.support.v7.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -72,9 +70,7 @@ public class UiUtilities {
|
|||
Drawable d = drawableCache.get(hash);
|
||||
if (d == null) {
|
||||
d = ContextCompat.getDrawable(app, resId);
|
||||
d = DrawableCompat.wrap(d);
|
||||
d.mutate();
|
||||
DrawableCompat.setTint(d, color);
|
||||
d = tintDrawable(d, color);
|
||||
|
||||
drawableCache.put(hash, d);
|
||||
}
|
||||
|
@ -110,41 +106,42 @@ public class UiUtilities {
|
|||
return getDrawable(id, light ? R.color.icon_color_default_light : R.color.icon_color_default_dark);
|
||||
}
|
||||
|
||||
public Drawable colorDrawable(Drawable drawable, int color) {
|
||||
Drawable wrappedDrawable = DrawableCompat.wrap(drawable);
|
||||
DrawableCompat.setTint(wrappedDrawable.mutate(), color);
|
||||
return wrappedDrawable;
|
||||
}
|
||||
|
||||
public static void setBackgroundDrawable(View view, Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||
view.setBackgroundDrawable(drawable);
|
||||
} else {
|
||||
view.setBackground(drawable);
|
||||
public static Drawable getSelectableDrawable(Context ctx) {
|
||||
int bgResId = AndroidUtils.resolveAttribute(ctx, R.attr.selectableItemBackground);
|
||||
if (bgResId != 0) {
|
||||
return ContextCompat.getDrawable(ctx, bgResId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Drawable setRippleColor(@DrawableRes int id, int rippleColor) {
|
||||
return setRippleColor(getIcon(id), rippleColor);
|
||||
}
|
||||
|
||||
public Drawable setRippleColor(Drawable drawable, int rippleColor) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && drawable instanceof RippleDrawable) {
|
||||
((RippleDrawable) drawable).setColor(ColorStateList.valueOf(rippleColor));
|
||||
} else {
|
||||
if (drawable != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
drawable.setTintList(ColorStateList.valueOf(rippleColor));
|
||||
} else if (drawable instanceof TintAwareDrawable) {
|
||||
((TintAwareDrawable) drawable).setTintList(ColorStateList.valueOf(rippleColor));
|
||||
} else {
|
||||
drawable.setColorFilter(rippleColor, PorterDuff.Mode.DST_ATOP);
|
||||
}
|
||||
public static Drawable getColoredSelectableDrawable(Context ctx, int color, float alpha) {
|
||||
Drawable drawable = null;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
Drawable bg = getSelectableDrawable(ctx);
|
||||
if (bg != null) {
|
||||
drawable = tintDrawable(bg, getColorWithAlpha(color, alpha));
|
||||
}
|
||||
} else {
|
||||
drawable = AndroidUtils.createPressedStateListDrawable(new ColorDrawable(Color.TRANSPARENT), new ColorDrawable(getColorWithAlpha(color, alpha)));
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public static Drawable tintDrawable(Drawable drawable, int color) {
|
||||
Drawable coloredDrawable = null;
|
||||
if (drawable != null) {
|
||||
coloredDrawable = DrawableCompat.wrap(drawable);
|
||||
coloredDrawable.mutate();
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && coloredDrawable instanceof RippleDrawable) {
|
||||
((RippleDrawable) coloredDrawable).setColor(ColorStateList.valueOf(color));
|
||||
} else {
|
||||
DrawableCompat.setTint(coloredDrawable, color);
|
||||
}
|
||||
}
|
||||
|
||||
return coloredDrawable;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
public static int getDefaultColorRes(Context context) {
|
||||
final OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
||||
|
@ -192,18 +189,6 @@ public class UiUtilities {
|
|||
return a << ALPHA_CHANNEL | r << RED_CHANNEL | g << GREEN_CHANNEL | b << BLUE_CHANNEL;
|
||||
}
|
||||
|
||||
public static Drawable getAlphaStateDrawable(@ColorInt int colorNoAlpha, float normalAlphaRatio, float pressedAlphaRatio) {
|
||||
int colorAlpha25 = getColorWithAlpha(colorNoAlpha, normalAlphaRatio);
|
||||
int colorAlpha30 = getColorWithAlpha(colorNoAlpha, pressedAlphaRatio);
|
||||
return AndroidUtils.createPressedStateListDrawable(new ColorDrawable(colorAlpha25), new ColorDrawable(colorAlpha30));
|
||||
}
|
||||
|
||||
public static Drawable getAlphaStateDrawable(@ColorInt int colorBackground, @ColorInt int colorForeground) {
|
||||
int colorAlpha25 = UiUtilities.mixTwoColors(colorForeground, colorBackground, 0.125f);
|
||||
int colorAlpha30 = UiUtilities.mixTwoColors(colorForeground, colorBackground, 0.15f);
|
||||
return AndroidUtils.createPressedStateListDrawable(new ColorDrawable(colorAlpha25), new ColorDrawable(colorAlpha30));
|
||||
}
|
||||
|
||||
public UpdateLocationViewCache getUpdateLocationViewCache(){
|
||||
UpdateLocationViewCache uvc = new UpdateLocationViewCache();
|
||||
uvc.screenOrientation = getScreenOrientation();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package net.osmand.plus.profiles;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -11,6 +12,7 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -106,8 +108,14 @@ public class SelectProfileMenuAdapter extends AbstractProfileMenuAdapter<SelectP
|
|||
//set up cell color
|
||||
int colorNoAlpha = ContextCompat.getColor(app, profileColorResId);
|
||||
boolean selectedMode = app.getSettings().APPLICATION_MODE.get() == item;
|
||||
holder.profileOptions.setBackgroundDrawable(UiUtilities.getAlphaStateDrawable(colorNoAlpha, selectedMode ? 0.25f : 0, 0.3f));
|
||||
|
||||
Drawable drawable = UiUtilities.getColoredSelectableDrawable(app, colorNoAlpha, 0.3f);
|
||||
|
||||
if (selectedMode) {
|
||||
Drawable[] layers = {new ColorDrawable(UiUtilities.getColorWithAlpha(colorNoAlpha, 0.15f)), drawable};
|
||||
drawable = new LayerDrawable(layers);
|
||||
}
|
||||
AndroidUtils.setBackground(holder.profileOptions, drawable);
|
||||
|
||||
updateViewHolder(holder, item);
|
||||
} else {
|
||||
final String title = (String) obj;
|
||||
|
@ -119,15 +127,14 @@ public class SelectProfileMenuAdapter extends AbstractProfileMenuAdapter<SelectP
|
|||
holder.descr.setVisibility(View.GONE);
|
||||
holder.switcher.setVisibility(View.GONE);
|
||||
holder.menuIcon.setVisibility(View.GONE);
|
||||
int colorResId = nightMode
|
||||
int color = ContextCompat.getColor(app, nightMode
|
||||
? R.color.active_color_primary_dark
|
||||
: R.color.active_color_primary_light;
|
||||
holder.title.setTextColor(app.getResources().getColor(colorResId));
|
||||
: R.color.active_color_primary_light);
|
||||
holder.title.setTextColor(color);
|
||||
holder.title.setText(bottomButtonText);
|
||||
int colorAlpha25 = UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, colorResId), 0.25f);
|
||||
StateListDrawable sld = new StateListDrawable();
|
||||
sld.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(colorAlpha25));
|
||||
holder.profileOptions.setBackgroundDrawable(sld);
|
||||
|
||||
Drawable drawable = UiUtilities.getColoredSelectableDrawable(app, color, 0.3f);
|
||||
AndroidUtils.setBackground(holder.profileOptions, drawable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,16 @@ import android.annotation.SuppressLint;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.annotation.XmlRes;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
|
@ -21,6 +23,8 @@ import android.support.v4.content.ContextCompat;
|
|||
import android.support.v7.preference.EditTextPreference;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.support.v7.preference.Preference.OnPreferenceClickListener;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import android.support.v7.preference.PreferenceGroupAdapter;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
@ -44,6 +48,7 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.activities.OsmandInAppPurchaseActivity;
|
||||
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment;
|
||||
import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment.AppModeChangedListener;
|
||||
import net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet;
|
||||
import net.osmand.plus.settings.bottomsheets.EditTextPreferenceBottomSheet;
|
||||
import net.osmand.plus.settings.bottomsheets.MultiSelectPreferencesBottomSheet;
|
||||
|
@ -54,14 +59,16 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener, SelectAppModesBottomSheetDialogFragment.AppModeChangedListener {
|
||||
public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener,
|
||||
OnPreferenceClickListener, AppModeChangedListener {
|
||||
|
||||
private final Log log = PlatformUtil.getLog(this.getClass());
|
||||
protected final Log log = PlatformUtil.getLog(this.getClass());
|
||||
|
||||
protected OsmandApplication app;
|
||||
protected OsmandSettings settings;
|
||||
protected UiUtilities iconsCache;
|
||||
|
||||
private int themeRes;
|
||||
private boolean nightMode;
|
||||
private boolean wasDrawerDisabled;
|
||||
|
||||
|
@ -80,6 +87,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
nightMode = !settings.isLightContent();
|
||||
themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view != null) {
|
||||
|
@ -87,6 +95,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
createToolbar(inflater, view);
|
||||
setDivider(null);
|
||||
updateAllSettings();
|
||||
view.setBackgroundColor(ContextCompat.getColor(app, getBackgroundColorRes()));
|
||||
}
|
||||
|
||||
return view;
|
||||
|
@ -94,48 +103,27 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
|
||||
@Override
|
||||
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||
int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
Context themedContext = new ContextThemeWrapper(getActivity(), themeRes);
|
||||
LayoutInflater themedInflater = inflater.cloneInContext(themedContext);
|
||||
|
||||
return super.onCreateRecyclerView(themedInflater, parent, savedInstanceState);
|
||||
RecyclerView recyclerView = super.onCreateRecyclerView(themedInflater, parent, savedInstanceState);
|
||||
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(app, 80));
|
||||
|
||||
return recyclerView;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
|
||||
|
||||
return new PreferenceGroupAdapter(preferenceScreen) {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder holder, int position) {
|
||||
super.onBindViewHolder(holder, position);
|
||||
|
||||
if (BaseSettingsFragment.this.getClass().equals(ConfigureProfileFragment.class)) {
|
||||
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
|
||||
if (selectableView != null) {
|
||||
Drawable selectableBg = selectableView.getBackground();
|
||||
|
||||
int color = ContextCompat.getColor(app, getActiveProfileColor());
|
||||
int colorWithAlpha;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP && selectableBg instanceof RippleDrawable) {
|
||||
colorWithAlpha = UiUtilities.getColorWithAlpha(color, 0.4f);
|
||||
}else {
|
||||
colorWithAlpha = UiUtilities.getColorWithAlpha(color, 0.2f);
|
||||
|
||||
}
|
||||
if (selectableBg != null) {
|
||||
Drawable drawable = app.getUIUtilities().setRippleColor(selectableBg, colorWithAlpha);
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
selectableView.setBackground(drawable);
|
||||
} else {
|
||||
selectableView.setBackgroundDrawable(drawable);
|
||||
}
|
||||
selectableView.invalidate();
|
||||
}
|
||||
}
|
||||
Preference preference = getItem(position);
|
||||
if (preference != null) {
|
||||
onBindPreferenceViewHolder(preference, holder);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -157,27 +145,76 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (!wasDrawerDisabled && mapActivity != null) {
|
||||
mapActivity.enableDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayPreferenceDialog(Preference preference) {
|
||||
if (preference instanceof ListPreferenceEx) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
SingleSelectPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
|
||||
}
|
||||
} else if (preference instanceof SwitchPreferenceEx) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
BooleanPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
|
||||
}
|
||||
} else if (preference instanceof EditTextPreference) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
EditTextPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
|
||||
}
|
||||
} else if (preference instanceof MultiSelectBooleanPreference) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
MultiSelectPreferencesBottomSheet.showInstance(getFragmentManager(), preference.getKey(), this);
|
||||
}
|
||||
} else {
|
||||
super.onDisplayPreferenceDialog(preference);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppModeChanged() {
|
||||
updateAllSettings();
|
||||
}
|
||||
|
||||
protected abstract void setupPreferences();
|
||||
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
if (preference.isSelectable()) {
|
||||
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
|
||||
if (selectableView != null) {
|
||||
Drawable drawable = UiUtilities.getColoredSelectableDrawable(app, getActiveProfileColor(), 0.3f);
|
||||
AndroidUtils.setBackground(selectableView, drawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createToolbar(LayoutInflater inflater, View view) {
|
||||
AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.appbar);
|
||||
|
||||
int toolbarRes = getToolbarResId();
|
||||
if (toolbarRes != -1) {
|
||||
Context activityContext = getActivity();
|
||||
Context themedContext = new ContextThemeWrapper(getActivity(), themeRes);
|
||||
View toolbarContainer = inflater.cloneInContext(themedContext).inflate(toolbarRes, appBarLayout);
|
||||
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
final Context themedContext = new ContextThemeWrapper(activityContext, themeRes);
|
||||
LayoutInflater themedInflater = LayoutInflater.from(themedContext);
|
||||
|
||||
View toolbarContainer = themedInflater.inflate(toolbarRes, null);
|
||||
appBarLayout.addView(toolbarContainer);
|
||||
|
||||
view.findViewById(R.id.close_button).setOnClickListener(new View.OnClickListener() {
|
||||
toolbarContainer.findViewById(R.id.close_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
|
@ -186,35 +223,8 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
}
|
||||
}
|
||||
});
|
||||
View switchProfile = view.findViewById(R.id.switch_profile_button);
|
||||
View switchProfile = toolbarContainer.findViewById(R.id.switch_profile_button);
|
||||
if (switchProfile != null) {
|
||||
|
||||
if (this.getClass().equals(ConfigureProfileFragment.class)) {
|
||||
int drawableId;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
drawableId = nightMode ? R.drawable.ripple_dark : R.drawable.ripple_light;
|
||||
} else {
|
||||
drawableId = nightMode ? R.drawable.btn_border_trans_dark : R.drawable.btn_border_trans_light;
|
||||
}
|
||||
|
||||
int color = ContextCompat.getColor(app, getActiveProfileColor());
|
||||
int colorWithAlpha = UiUtilities.getColorWithAlpha(color, 0.40f);
|
||||
|
||||
Drawable drawable = app.getUIUtilities().setRippleColor(drawableId, colorWithAlpha);
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
switchProfile.setBackground(drawable);
|
||||
} else {
|
||||
switchProfile.setBackgroundDrawable(drawable);
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, switchProfile, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, switchProfile, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
}
|
||||
|
||||
switchProfile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -225,7 +235,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
}
|
||||
});
|
||||
}
|
||||
updateToolbar(view);
|
||||
updateToolbar(toolbarContainer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,9 +245,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
}
|
||||
|
||||
ApplicationMode selectedAppMode = getSelectedAppMode();
|
||||
int iconRes = selectedAppMode.getIconRes();
|
||||
int iconColor = selectedAppMode.getIconColorInfo().getColor(nightMode);
|
||||
String title = selectedAppMode.isCustomProfile() ? selectedAppMode.getCustomProfileName() : getResources().getString(selectedAppMode.getNameKeyResource());
|
||||
int iconColor = getActiveProfileColor();
|
||||
|
||||
TextView toolbarTitle = (TextView) view.findViewById(R.id.toolbar_title);
|
||||
if (toolbarTitle != null) {
|
||||
|
@ -245,11 +253,13 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
}
|
||||
ImageView profileIcon = (ImageView) view.findViewById(R.id.profile_icon);
|
||||
if (profileIcon != null) {
|
||||
profileIcon.setImageDrawable(getIcon(iconRes, iconColor));
|
||||
int iconRes = selectedAppMode.getIconRes();
|
||||
profileIcon.setImageDrawable(getPaintedIcon(iconRes, iconColor));
|
||||
}
|
||||
TextView profileTitle = (TextView) view.findViewById(R.id.profile_title);
|
||||
if (profileTitle != null) {
|
||||
profileTitle.setText(title);
|
||||
String appName = selectedAppMode.toHumanString(app);
|
||||
profileTitle.setText(appName);
|
||||
}
|
||||
TextView profileType = (TextView) view.findViewById(R.id.profile_type);
|
||||
if (profileType != null) {
|
||||
|
@ -257,12 +267,40 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
}
|
||||
View toolbarDivider = view.findViewById(R.id.toolbar_divider);
|
||||
if (toolbarDivider != null) {
|
||||
toolbarDivider.setBackgroundColor(ContextCompat.getColor(app, iconColor));
|
||||
toolbarDivider.setBackgroundColor(iconColor);
|
||||
}
|
||||
view.setBackgroundColor(ContextCompat.getColor(app, getBackgroundColor()));
|
||||
}
|
||||
View profileButton = view.findViewById(R.id.switch_profile_button);
|
||||
if (profileButton != null) {
|
||||
int toolbarRes = getToolbarResId();
|
||||
int bgColor = UiUtilities.getColorWithAlpha(iconColor, 0.1f);
|
||||
int selectedColor = UiUtilities.getColorWithAlpha(iconColor, 0.3f);
|
||||
|
||||
protected abstract void setupPreferences();
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
int bgResId = 0;
|
||||
int selectableResId = 0;
|
||||
if (toolbarRes == R.layout.profile_preference_toolbar) {
|
||||
bgResId = R.drawable.circle_background_light;
|
||||
selectableResId = R.drawable.ripple_circle;
|
||||
} else if (toolbarRes == R.layout.profile_preference_toolbar_big) {
|
||||
bgResId = R.drawable.rectangle_rounded;
|
||||
selectableResId = R.drawable.ripple_rectangle_rounded;
|
||||
}
|
||||
Drawable bgDrawable = getPaintedIcon(bgResId, bgColor);
|
||||
Drawable selectable = getPaintedIcon(selectableResId, selectedColor);
|
||||
Drawable[] layers = {bgDrawable, selectable};
|
||||
AndroidUtils.setBackground(profileButton, new LayerDrawable(layers));
|
||||
} else {
|
||||
int bgResId = 0;
|
||||
if (toolbarRes == R.layout.profile_preference_toolbar) {
|
||||
bgResId = R.drawable.circle_background_light;
|
||||
} else if (toolbarRes == R.layout.profile_preference_toolbar_big) {
|
||||
bgResId = R.drawable.rectangle_rounded;
|
||||
}
|
||||
Drawable bgDrawable = getPaintedIcon(bgResId, bgColor);
|
||||
AndroidUtils.setBackground(profileButton, bgDrawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePreferencesScreen() {
|
||||
if (getSelectedAppMode() != null) {
|
||||
|
@ -304,8 +342,9 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return -1;
|
||||
}
|
||||
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.shared_string_settings);
|
||||
@StringRes
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.shared_string_settings;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
|
@ -320,13 +359,18 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return -1;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
@ColorInt
|
||||
protected int getActiveProfileColor() {
|
||||
return ContextCompat.getColor(app, getActiveProfileColorRes());
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getActiveProfileColorRes() {
|
||||
return getSelectedAppMode().getIconColorInfo().getColor(isNightMode());
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getBackgroundColor() {
|
||||
protected int getBackgroundColorRes() {
|
||||
return isNightMode() ? R.color.list_background_color_dark : R.color.list_background_color_light;
|
||||
}
|
||||
|
||||
|
@ -412,7 +456,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
|
||||
protected Drawable getActiveIcon(@DrawableRes int id) {
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getIcon(id, getActiveProfileColor()) : null;
|
||||
return cache != null ? cache.getIcon(id, getActiveProfileColorRes()) : null;
|
||||
}
|
||||
|
||||
protected Drawable getIcon(@DrawableRes int id, @ColorRes int colorId) {
|
||||
|
@ -425,6 +469,11 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return cache != null ? cache.getThemedIcon(id) : null;
|
||||
}
|
||||
|
||||
protected Drawable getPaintedIcon(@DrawableRes int id, @ColorInt int color) {
|
||||
UiUtilities cache = getIconsCache();
|
||||
return cache != null ? cache.getPaintedIcon(id, color) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected OsmandSettings getSettings() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
|
@ -441,48 +490,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
|
|||
return app.getSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayPreferenceDialog(Preference preference) {
|
||||
if (preference instanceof ListPreferenceEx) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
SingleSelectPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
|
||||
}
|
||||
} else if (preference instanceof SwitchPreferenceEx) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
BooleanPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
|
||||
}
|
||||
} else if (preference instanceof EditTextPreference) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
EditTextPreferenceBottomSheet.showInstance(fragmentManager, preference.getKey(), this);
|
||||
}
|
||||
} else if (preference instanceof MultiSelectBooleanPreference) {
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
if (fragmentManager != null) {
|
||||
MultiSelectPreferencesBottomSheet.showInstance(getFragmentManager(), preference.getKey(), this);
|
||||
}
|
||||
} else {
|
||||
super.onDisplayPreferenceDialog(preference);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppModeChanged() {
|
||||
updateAllSettings();
|
||||
}
|
||||
|
||||
public SwitchPreference createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, int title, int summary, int layoutId) {
|
||||
return createSwitchPreference(b, getString(title), getString(summary), layoutId);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,25 @@ package net.osmand.plus.settings;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceCategory;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.support.v7.preference.PreferenceGroupAdapter;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.aidl.OsmandAidlApi;
|
||||
import net.osmand.aidl.OsmandAidlApi.ConnectedApp;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -40,27 +53,84 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.configure_profile);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.configure_profile;
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getBackgroundColor() {
|
||||
protected int getBackgroundColorRes() {
|
||||
return isNightMode() ? R.color.activity_background_color_dark : R.color.activity_background_color_light;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
getListView().addItemDecoration(createDividerItemDecoration());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private RecyclerView.ItemDecoration createDividerItemDecoration() {
|
||||
final Drawable dividerLight = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_light));
|
||||
final Drawable dividerDark = new ColorDrawable(ContextCompat.getColor(app, R.color.list_background_color_dark));
|
||||
final int pluginDividerHeight = AndroidUtils.dpToPx(app, 3);
|
||||
|
||||
return new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
|
||||
int dividerLeft = parent.getPaddingLeft();
|
||||
int dividerRight = parent.getWidth() - parent.getPaddingRight();
|
||||
|
||||
int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount - 1; i++) {
|
||||
View child = parent.getChildAt(i);
|
||||
|
||||
if (shouldDrawDivider(child)) {
|
||||
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||
|
||||
int dividerTop = child.getBottom() + params.bottomMargin;
|
||||
int dividerBottom = dividerTop + pluginDividerHeight;
|
||||
|
||||
Drawable divider = isNightMode() ? dividerDark : dividerLight;
|
||||
divider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
|
||||
divider.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
if (shouldDrawDivider(view)) {
|
||||
outRect.set(0, 0, 0, pluginDividerHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldDrawDivider(View view) {
|
||||
int position = getListView().getChildAdapterPosition(view);
|
||||
Preference pref = ((PreferenceGroupAdapter) getListView().getAdapter()).getItem(position);
|
||||
if (pref != null && pref.getParent() != null) {
|
||||
PreferenceGroup preferenceGroup = pref.getParent();
|
||||
return preferenceGroup.hasKey() && preferenceGroup.getKey().equals("plugin_settings");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Preference generalSettings = findPreference("general_settings");
|
||||
Preference pluginSettings = findPreference("plugin_settings");
|
||||
pluginSettings.setIconSpaceReserved(false);
|
||||
|
||||
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
|
||||
|
||||
setupNavigationSettingsPref();
|
||||
setupConfigureMapPref();
|
||||
setupConnectedAppsPref();
|
||||
setupOsmandPluginsPref();
|
||||
|
||||
PreferenceCategory pluginSettings = (PreferenceCategory) findPreference("plugin_settings");
|
||||
pluginSettings.setIconSpaceReserved(false);
|
||||
|
||||
setupConnectedAppsPref(pluginSettings);
|
||||
setupOsmandPluginsPref(pluginSettings);
|
||||
}
|
||||
|
||||
private void setupNavigationSettingsPref() {
|
||||
|
@ -86,7 +156,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
configureMap.setVisible(false);
|
||||
}
|
||||
|
||||
private void setupConnectedAppsPref() {
|
||||
private void setupConnectedAppsPref(PreferenceCategory preferenceCategory) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app == null) {
|
||||
return;
|
||||
|
@ -101,11 +171,11 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
preference.setChecked(connectedApp.isEnabled());
|
||||
preference.setLayoutResource(R.layout.preference_switch);
|
||||
|
||||
getPreferenceScreen().addPreference(preference);
|
||||
preferenceCategory.addPreference(preference);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupOsmandPluginsPref() {
|
||||
private void setupOsmandPluginsPref(PreferenceCategory preferenceCategory) {
|
||||
Context ctx = getContext();
|
||||
if (ctx == null) {
|
||||
return;
|
||||
|
@ -121,7 +191,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
|
|||
preference.setLayoutResource(R.layout.preference_dialog_and_switch);
|
||||
preference.setIntent(getPluginIntent(plugin));
|
||||
|
||||
getPreferenceScreen().addPreference(preference);
|
||||
preferenceCategory.addPreference(preference);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,26 +51,21 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.coordinates_format);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.coordinates_format;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
screen.setOrderingAsAdded(false);
|
||||
|
||||
Preference generalSettings = findPreference("coordinates_format_info");
|
||||
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||
|
||||
CheckBoxPreference degreesPref = (CheckBoxPreference) findPreference(FORMAT_DEGREES);
|
||||
CheckBoxPreference minutesPref = (CheckBoxPreference) findPreference(FORMAT_MINUTES);
|
||||
CheckBoxPreference secondsPref = (CheckBoxPreference) findPreference(FORMAT_SECONDS);
|
||||
CheckBoxPreference utmPref = (CheckBoxPreference) findPreference(UTM_FORMAT);
|
||||
CheckBoxPreference olcPref = (CheckBoxPreference) findPreference(OLC_FORMAT);
|
||||
|
||||
CheckBoxPreference utmPref = createUtmFormatPref();
|
||||
screen.addPreference(utmPref);
|
||||
|
||||
Location loc = app.getLocationProvider().getLastKnownLocation();
|
||||
|
||||
degreesPref.setSummary(getCoordinatesFormatSummary(loc, PointDescription.FORMAT_DEGREES));
|
||||
|
@ -84,24 +79,16 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
|
|||
updateSelectedFormatPrefs(currentPrefKey);
|
||||
}
|
||||
|
||||
private CheckBoxPreference createUtmFormatPref() {
|
||||
CheckBoxPreference utmPref = new CheckBoxPreference(app) {
|
||||
@Override
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
super.onBindPreferenceViewHolder(preference, holder);
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
||||
super.onBindViewHolder(holder);
|
||||
TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
|
||||
if (summaryView != null) {
|
||||
summaryView.setOnTouchListener(getSummaryTouchListener());
|
||||
}
|
||||
if (UTM_FORMAT.equals(preference.getKey())) {
|
||||
TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
|
||||
if (summaryView != null) {
|
||||
summaryView.setOnTouchListener(getSummaryTouchListener());
|
||||
}
|
||||
};
|
||||
utmPref.setKey(UTM_FORMAT);
|
||||
utmPref.setTitle(R.string.navigate_point_format_utm);
|
||||
utmPref.setPersistent(false);
|
||||
utmPref.setOrder(4);
|
||||
utmPref.setLayoutResource(R.layout.preference_radio_button);
|
||||
return utmPref;
|
||||
}
|
||||
}
|
||||
|
||||
private View.OnTouchListener getSummaryTouchListener() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -42,16 +41,12 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.general_settings_2);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.general_settings_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
Context ctx = getContext();
|
||||
if (ctx == null) {
|
||||
return;
|
||||
}
|
||||
Preference appearanceCategory = findPreference("appearance_category");
|
||||
Preference unitsAndFormats = findPreference("units_and_formats");
|
||||
Preference other = findPreference("other");
|
||||
|
@ -72,9 +67,9 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
private void setupAppThemePref() {
|
||||
ListPreferenceEx appTheme = (ListPreferenceEx) findPreference(settings.OSMAND_THEME.getId());
|
||||
appTheme.setEntries(new String[] {getString(R.string.dark_theme), getString(R.string.light_theme)});
|
||||
appTheme.setEntryValues(new Integer[] {OsmandSettings.OSMAND_DARK_THEME, OsmandSettings.OSMAND_LIGHT_THEME});
|
||||
final ListPreferenceEx appTheme = (ListPreferenceEx) findPreference(settings.OSMAND_THEME.getId());
|
||||
appTheme.setEntries(new String[]{getString(R.string.dark_theme), getString(R.string.light_theme)});
|
||||
appTheme.setEntryValues(new Integer[]{OsmandSettings.OSMAND_DARK_THEME, OsmandSettings.OSMAND_LIGHT_THEME});
|
||||
appTheme.setIcon(getOsmandThemeIcon());
|
||||
}
|
||||
|
||||
|
@ -83,9 +78,9 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
private void setupRotateMapPref() {
|
||||
ListPreferenceEx rotateMap = (ListPreferenceEx) findPreference(settings.ROTATE_MAP.getId());
|
||||
rotateMap.setEntries(new String[] {getString(R.string.rotate_map_none_opt), getString(R.string.rotate_map_bearing_opt), getString(R.string.rotate_map_compass_opt)});
|
||||
rotateMap.setEntryValues(new Integer[] {OsmandSettings.ROTATE_MAP_NONE, OsmandSettings.ROTATE_MAP_BEARING, OsmandSettings.ROTATE_MAP_COMPASS});
|
||||
final ListPreferenceEx rotateMap = (ListPreferenceEx) findPreference(settings.ROTATE_MAP.getId());
|
||||
rotateMap.setEntries(new String[]{getString(R.string.rotate_map_none_opt), getString(R.string.rotate_map_bearing_opt), getString(R.string.rotate_map_compass_opt)});
|
||||
rotateMap.setEntryValues(new Integer[]{OsmandSettings.ROTATE_MAP_NONE, OsmandSettings.ROTATE_MAP_BEARING, OsmandSettings.ROTATE_MAP_COMPASS});
|
||||
rotateMap.setIcon(getRotateMapIcon());
|
||||
}
|
||||
|
||||
|
@ -101,9 +96,9 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
private void setupMapScreenOrientationPref() {
|
||||
ListPreferenceEx mapScreenOrientation = (ListPreferenceEx) findPreference(settings.MAP_SCREEN_ORIENTATION.getId());
|
||||
mapScreenOrientation.setEntries(new String[] {getString(R.string.map_orientation_portrait), getString(R.string.map_orientation_landscape), getString(R.string.map_orientation_default)});
|
||||
mapScreenOrientation.setEntryValues(new Integer[] {ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED});
|
||||
final ListPreferenceEx mapScreenOrientation = (ListPreferenceEx) findPreference(settings.MAP_SCREEN_ORIENTATION.getId());
|
||||
mapScreenOrientation.setEntries(new String[]{getString(R.string.map_orientation_portrait), getString(R.string.map_orientation_landscape), getString(R.string.map_orientation_default)});
|
||||
mapScreenOrientation.setEntryValues(new Integer[]{ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED});
|
||||
mapScreenOrientation.setIcon(getMapScreenOrientationIcon());
|
||||
}
|
||||
|
||||
|
@ -190,14 +185,14 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
|
|||
|
||||
private void setupExternalInputDevicePref() {
|
||||
ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId());
|
||||
externalInputDevice.setEntries(new String[] {
|
||||
externalInputDevice.setEntries(new String[]{
|
||||
getString(R.string.sett_no_ext_input),
|
||||
getString(R.string.sett_generic_ext_input),
|
||||
getString(R.string.sett_wunderlinq_ext_input),
|
||||
getString(R.string.sett_parrot_ext_input)
|
||||
});
|
||||
|
||||
externalInputDevice.setEntryValues(new Integer[] {
|
||||
externalInputDevice.setEntryValues(new Integer[]{
|
||||
OsmandSettings.NO_EXTERNAL_DEVICE,
|
||||
OsmandSettings.GENERIC_EXTERNAL_DEVICE,
|
||||
OsmandSettings.WUNDERLINQ_EXTERNAL_DEVICE,
|
||||
|
|
|
@ -34,8 +34,8 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.osmand_settings);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.osmand_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Intent;
|
|||
import android.support.annotation.ColorRes;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceCategory;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -26,8 +25,8 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.shared_string_settings);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.shared_string_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +35,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getBackgroundColor() {
|
||||
protected int getBackgroundColorRes() {
|
||||
return isNightMode() ? R.color.activity_background_color_dark : R.color.activity_background_color_light;
|
||||
}
|
||||
|
||||
|
@ -58,10 +57,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
private void setupConfigureProfilePref() {
|
||||
ApplicationMode selectedMode = getSelectedAppMode();
|
||||
|
||||
int iconRes = selectedMode.getIconRes();
|
||||
int iconColor = getActiveProfileColor();
|
||||
String title = selectedMode.toHumanString(getContext());
|
||||
|
||||
String profileType;
|
||||
if (selectedMode.isCustomProfile()) {
|
||||
profileType = String.format(getString(R.string.profile_type_descr_string), Algorithms.capitalizeFirstLetterAndLowercase(selectedMode.getParent().toHumanString(getContext())));
|
||||
|
@ -69,8 +65,10 @@ public class MainSettingsFragment extends BaseSettingsFragment {
|
|||
profileType = getString(R.string.profile_type_base_string);
|
||||
}
|
||||
|
||||
int iconRes = selectedMode.getIconRes();
|
||||
|
||||
Preference configureProfile = findPreference("configure_profile");
|
||||
configureProfile.setIcon(getIcon(iconRes, iconColor));
|
||||
configureProfile.setIcon(getPaintedIcon(iconRes, getActiveProfileColor()));
|
||||
configureProfile.setTitle(title);
|
||||
configureProfile.setSummary(profileType);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ public class MapDuringNavigationFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.map_during_navigation);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.map_during_navigation;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,8 +20,8 @@ public class NavigationFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.routing_settings_2);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.routing_settings_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -25,8 +24,8 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.proxy_pref_title);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.proxy_pref_title;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,8 +52,8 @@ public class RouteParametersFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.route_parameters);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.route_parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class ScreenAlertsFragment extends BaseSettingsFragment {
|
||||
|
@ -19,14 +23,13 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
|
|||
return R.layout.profile_preference_toolbar;
|
||||
}
|
||||
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.screen_alerts);
|
||||
@Override
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.screen_alerts;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupShowRoutingAlarmsPref();
|
||||
|
||||
Preference showRoutingAlarmsInfo = findPreference("show_routing_alarms_info");
|
||||
SwitchPreference showTrafficWarnings = (SwitchPreference) findPreference(settings.SHOW_TRAFFIC_WARNINGS.getId());
|
||||
SwitchPreference showPedestrian = (SwitchPreference) findPreference(settings.SHOW_PEDESTRIAN.getId());
|
||||
|
@ -40,8 +43,15 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
|
|||
showTunnels.setIcon(getIcon(R.drawable.list_warnings_tunnel));
|
||||
}
|
||||
|
||||
private void setupShowRoutingAlarmsPref() {
|
||||
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
|
||||
@Override
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
super.onBindPreferenceViewHolder(preference, holder);
|
||||
|
||||
if (settings.SHOW_ROUTING_ALARMS.getId().equals(preference.getKey())) {
|
||||
boolean checked = ((SwitchPreference) preference).isChecked();
|
||||
int color = checked ? getActiveProfileColor() : ContextCompat.getColor(app, R.color.preference_top_switch_off);
|
||||
|
||||
AndroidUtils.setBackground(holder.itemView, new ColorDrawable(color));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
package net.osmand.plus.settings;
|
||||
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.settings.preferences.ListPreferenceEx;
|
||||
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
|
||||
|
@ -22,14 +26,12 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.turn_screen_on);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.turn_screen_on;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupTurnScreenOnPref();
|
||||
|
||||
Preference turnScreenOnInfo = findPreference("turn_screen_on_info");
|
||||
turnScreenOnInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||
|
||||
|
@ -37,8 +39,16 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
|
|||
setupTurnScreenOnSensorPref();
|
||||
}
|
||||
|
||||
private void setupTurnScreenOnPref() {
|
||||
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
|
||||
@Override
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
super.onBindPreferenceViewHolder(preference, holder);
|
||||
|
||||
if (settings.TURN_SCREEN_ON_ENABLED.getId().equals(preference.getKey())) {
|
||||
boolean checked = ((SwitchPreference) preference).isChecked();
|
||||
int color = checked ? getActiveProfileColor() : ContextCompat.getColor(app, R.color.preference_top_switch_off);
|
||||
|
||||
AndroidUtils.setBackground(holder.itemView, new ColorDrawable(color));
|
||||
}
|
||||
}
|
||||
|
||||
private void setupTurnScreenOnTimePref() {
|
||||
|
|
|
@ -32,8 +32,8 @@ public class VehicleParametersFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.vehicle_parameters);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.vehicle_parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,11 +4,15 @@ import android.app.Activity;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.media.AudioManager;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceViewHolder;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -37,13 +41,12 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getToolbarTitle() {
|
||||
return getString(R.string.voice_announces);
|
||||
protected int getToolbarTitle() {
|
||||
return R.string.voice_announces;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupPreferences() {
|
||||
setupSpeakRoutingAlarmsPref();
|
||||
|
||||
Preference voiceAnnouncesInfo = findPreference("voice_announces_info");
|
||||
voiceAnnouncesInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
|
||||
|
||||
|
@ -59,9 +62,16 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupSpeakRoutingAlarmsPref() {
|
||||
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
|
||||
@Override
|
||||
protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) {
|
||||
super.onBindPreferenceViewHolder(preference, holder);
|
||||
|
||||
if (settings.SPEAK_ROUTING_ALARMS.getId().equals(preference.getKey())) {
|
||||
boolean checked = ((SwitchPreference) preference).isChecked();
|
||||
int color = checked ? getActiveProfileColor() : ContextCompat.getColor(app, R.color.preference_top_switch_off);
|
||||
|
||||
AndroidUtils.setBackground(holder.itemView, new ColorDrawable(color));
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSpeedLimitExceedPref() {
|
||||
|
|
Loading…
Reference in a new issue