Merge 'r3.6' to 'master'

This commit is contained in:
Nazar-Kutz 2020-03-10 12:03:41 +02:00
parent 2ef2c741c6
commit 60ee95d93c
41 changed files with 374 additions and 366 deletions

View file

@ -10,90 +10,107 @@
app:contentInsetLeft="4dp" app:contentInsetLeft="4dp"
app:contentInsetStart="4dp"> app:contentInsetStart="4dp">
<ImageView <LinearLayout
android:id="@+id/toolbar_back" android:layout_width="match_parent"
android:contentDescription="@string/back_to_map"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_arrow_back"
tools:visibility="visible"/>
<ImageView
android:id="@+id/toolbar_list"
android:contentDescription="@string/backToMenu"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_navigation_drawer"
tools:visibility="gone"/>
<ImageView
android:id="@+id/toolbar_settings"
android:contentDescription="@string/shared_string_settings"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_configure_screen_dark"/>
<TextView
android:id="@+id/toolbar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start" android:gravity="center_vertical"
android:scaleType="center" android:orientation="horizontal">
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
tools:text="Toolbar"
tools:visibility="visible"/>
<ImageView <LinearLayout
android:id="@+id/toolbar_ok" android:layout_width="0dp"
android:contentDescription="@string/shared_string_ok" android:layout_weight="1"
android:layout_width="@dimen/list_item_height" android:layout_height="wrap_content"
android:layout_height="match_parent" android:gravity="start"
android:layout_gravity="end" android:orientation="horizontal">
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_action_done"/>
<ImageView <ImageView
android:id="@+id/toolbar_sort" android:id="@+id/toolbar_back"
android:contentDescription="@string/intermediate_points_change_order" android:contentDescription="@string/back_to_map"
android:layout_width="@dimen/list_item_height" android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="end" android:background="@drawable/dashboard_button_light"
android:background="@drawable/dashboard_button_light" android:scaleType="center"
android:scaleType="center" android:src="@drawable/ic_arrow_back"
android:src="@drawable/ic_sort_waypoint_dark"/> tools:visibility="visible"/>
<ImageView
android:id="@+id/toolbar_list"
android:contentDescription="@string/backToMenu"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_navigation_drawer"
tools:visibility="gone"/>
<ImageView <TextView
android:id="@+id/toolbar_flat" android:id="@+id/toolbar_text"
android:contentDescription="@string/drawer" android:layout_width="wrap_content"
android:layout_width="@dimen/list_item_height" android:layout_height="wrap_content"
android:layout_height="match_parent" android:scaleType="center"
android:layout_gravity="end" android:textColor="@color/abc_primary_text_material_dark"
android:background="@drawable/dashboard_button_light" android:textSize="@dimen/abc_text_size_large_material"
android:scaleType="center" tools:text="Toolbar"
android:src="@drawable/ic_flat_list_dark" tools:visibility="visible"/>
android:visibility="gone"/>
<ImageView </LinearLayout>
android:id="@+id/toolbar_edit"
android:contentDescription="@string/shared_string_edit" <LinearLayout
android:layout_width="@dimen/list_item_height" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="end" android:gravity="end"
android:background="@drawable/dashboard_button_light" android:orientation="horizontal">
android:scaleType="center"
android:src="@drawable/ic_action_edit_dark" <ImageView
android:visibility="gone"/> android:id="@+id/toolbar_settings"
android:contentDescription="@string/shared_string_settings"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_configure_screen_dark"/>
<ImageView
android:id="@+id/toolbar_ok"
android:contentDescription="@string/shared_string_ok"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_action_done"/>
<ImageView
android:id="@+id/toolbar_sort"
android:contentDescription="@string/intermediate_points_change_order"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_sort_waypoint_dark"/>
<ImageView
android:id="@+id/toolbar_flat"
android:contentDescription="@string/drawer"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_flat_list_dark"
android:visibility="gone"/>
<ImageView
android:id="@+id/toolbar_edit"
android:contentDescription="@string/shared_string_edit"
android:layout_width="@dimen/list_item_height"
android:layout_height="match_parent"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_action_edit_dark"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
</androidx.appcompat.widget.Toolbar> </androidx.appcompat.widget.Toolbar>

View file

@ -19,9 +19,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="@dimen/list_content_padding" android:paddingLeft="@dimen/list_content_padding"
android:paddingStart="@dimen/list_content_padding"
android:paddingRight="0dp"
android:paddingEnd="0dp"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:background="?attr/expandable_list_item_background" android:background="?attr/expandable_list_item_background">
android:paddingStart="@dimen/list_content_padding">
<CheckBox <CheckBox
android:id="@+id/toggle_item" android:id="@+id/toggle_item"

View file

@ -53,7 +53,9 @@
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
android:maxLines="1" android:maxLines="1"
android:paddingLeft="@dimen/content_padding_small" android:paddingLeft="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_small" android:paddingRight="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_half"
android:text="@string/shared_string_select_all" android:text="@string/shared_string_select_all"
android:textColor="?attr/active_color_basic" android:textColor="?attr/active_color_basic"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
@ -78,10 +80,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center" android:gravity="end|center_vertical"
android:maxLines="1" android:maxLines="1"
android:paddingLeft="@dimen/content_padding_small" android:paddingLeft="@dimen/content_padding_small"
android:paddingTop="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_small" android:paddingRight="@dimen/content_padding_small"
android:paddingBottom="@dimen/content_padding_half"
android:text="@string/shared_string_continue" android:text="@string/shared_string_continue"
android:textColor="?attr/dlg_btn_primary_text" android:textColor="?attr/dlg_btn_primary_text"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"

View file

@ -24,12 +24,12 @@
android:id="@+id/searchEditText" android:id="@+id/searchEditText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="16dp" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:background="@null" android:background="@null"
android:gravity="center_vertical" android:gravity="center_vertical"
android:lines="1" android:lines="1"
tools:text="Search request" tools:text="Search request" />
android:layout_marginStart="16dp" />
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout

View file

@ -20,8 +20,10 @@
android:orientation="horizontal" android:orientation="horizontal"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:paddingLeft="@dimen/dialog_content_margin" android:paddingLeft="@dimen/dialog_content_margin"
android:gravity="center_vertical" android:paddingStart="@dimen/dialog_content_margin"
android:paddingStart="@dimen/dialog_content_margin"> android:paddingRight="0dp"
android:paddingEnd="0dp"
android:gravity="center_vertical">
<CheckBox <CheckBox
android:id="@+id/check_local_index" android:id="@+id/check_local_index"
@ -32,9 +34,11 @@
android:paddingTop="4dp" android:paddingTop="4dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingRight="@dimen/dialog_content_margin" android:paddingRight="@dimen/dialog_content_margin"
android:paddingEnd="@dimen/dialog_content_margin"
android:paddingLeft="0dp"
android:paddingStart="0dp"
android:clickable="false" android:clickable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false" />
android:paddingEnd="@dimen/dialog_content_margin" />
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
@ -51,23 +55,25 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/gpx_text_top_margin" android:paddingTop="@dimen/gpx_text_top_margin"
android:paddingBottom="@dimen/gpx_text_top_margin" android:paddingBottom="@dimen/gpx_text_top_margin"
android:paddingRight="@dimen/showAllButtonMarginRight" android:layout_marginRight="@dimen/showAllButtonMarginRight"
android:layout_marginEnd="@dimen/showAllButtonMarginRight"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical">
android:paddingEnd="@dimen/showAllButtonMarginRight">
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
tools:text="@string/current_track"/> tools:text="@string/current_track"/>
<LinearLayout <LinearLayout
android:id="@+id/read_section" android:id="@+id/read_section"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible" android:visibility="visible"
android:gravity="center_vertical"> android:gravity="center_vertical">
@ -77,8 +83,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/gpx_small_icon_margin" android:layout_marginRight="@dimen/gpx_small_icon_margin"
android:src="@drawable/ic_small_distance" android:layout_marginEnd="@dimen/gpx_small_icon_margin"
android:layout_marginEnd="@dimen/gpx_small_icon_margin" /> android:src="@drawable/ic_small_distance" />
<TextView <TextView
android:id="@+id/distance" android:id="@+id/distance"
@ -95,8 +101,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/gpx_small_icon_margin" android:layout_marginRight="@dimen/gpx_small_icon_margin"
android:src="@drawable/ic_small_point" android:layout_marginEnd="@dimen/gpx_small_icon_margin"
android:layout_marginEnd="@dimen/gpx_small_icon_margin" /> android:src="@drawable/ic_small_point" />
<TextView <TextView
android:id="@+id/points_count" android:id="@+id/points_count"
@ -113,8 +119,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/gpx_small_icon_margin" android:layout_marginRight="@dimen/gpx_small_icon_margin"
android:src="@drawable/ic_small_time" android:layout_marginEnd="@dimen/gpx_small_icon_margin"
android:layout_marginEnd="@dimen/gpx_small_icon_margin" /> android:src="@drawable/ic_small_time" />
<TextView <TextView
android:id="@+id/time" android:id="@+id/time"
@ -159,10 +165,10 @@
android:layout_width="@dimen/list_item_height" android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="@dimen/favorites_icon_right_margin" android:layout_marginLeft="@dimen/favorites_icon_right_margin"
android:layout_marginStart="@dimen/favorites_icon_right_margin"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_gsave_dark" android:src="@drawable/ic_action_gsave_dark"
android:visibility="gone" android:visibility="gone" />
android:layout_marginStart="@dimen/favorites_icon_right_margin" />
<ImageButton <ImageButton
android:id="@+id/stop" android:id="@+id/stop"
@ -198,9 +204,9 @@
android:clickable="false" android:clickable="false"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:paddingRight="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding"
android:gravity="center_vertical" android:layout_marginEnd="@dimen/list_content_padding"
android:paddingEnd="@dimen/list_content_padding" /> android:gravity="center_vertical" />
<androidx.appcompat.widget.AppCompatCheckBox <androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/toggle_checkbox_item" android:id="@+id/toggle_checkbox_item"
@ -208,12 +214,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="4dp" android:paddingTop="4dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingRight="@dimen/dialog_content_margin" android:layout_marginRight="@dimen/dialog_content_margin"
android:layout_marginEnd="@dimen/dialog_content_margin"
android:clickable="false" android:clickable="false"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
android:visibility="gone" android:visibility="gone" />
android:paddingEnd="@dimen/dialog_content_margin" />
</LinearLayout> </LinearLayout>

View file

@ -13,43 +13,62 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="24dp" android:layout_marginLeft="24dp"
android:layout_marginStart="24dp"
android:gravity="center" android:gravity="center"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" tools:visibility="visible" />
android:layout_marginStart="24dp" />
<androidx.appcompat.widget.AppCompatTextView <FrameLayout
android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="11dip" android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small" android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginTop="11dp" android:layout_marginTop="@dimen/content_padding_small"
android:layout_weight="1" android:layout_marginBottom="@dimen/content_padding_small"
android:gravity="center_vertical" android:layout_weight="1">
android:text="@string/layer_poi"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
android:layout_marginStart="@dimen/content_padding_small" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/icon_settings" android:id="@+id/title"
android:contentDescription="@string/shared_string_settings" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="match_parent" android:layout_gravity="center_vertical|start"
android:focusable="false" android:gravity="center_vertical|start"
android:gravity="center_vertical" android:layout_marginRight="52dp"
android:visibility="gone" android:layout_marginEnd="52dp"
tools:visibility="visible"/> android:text="@string/layer_poi"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" />
<!-- android:button="@drawable/ic_btn_wocheckbox" --> <LinearLayout
<androidx.appcompat.widget.AppCompatCheckBox android:layout_width="wrap_content"
android:id="@+id/toggle_item" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_gravity="center_vertical|end"
android:layout_height="match_parent" android:orientation="horizontal">
android:layout_marginRight="24dp"
android:layout_marginEnd="24dp" <androidx.appcompat.widget.AppCompatImageView
android:focusable="false" android:id="@+id/icon_settings"
app:buttonTint="?attr/active_color_basic" /> android:contentDescription="@string/shared_string_settings"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible" />
<!-- android:button="@drawable/ic_btn_wocheckbox" -->
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/toggle_item"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:focusable="false"
app:buttonTint="?attr/active_color_basic" />
</LinearLayout>
</FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background" android:paddingLeft="@dimen/list_content_padding"
android:descendantFocusability="blocksDescendants" android:paddingStart="@dimen/list_content_padding"
android:minHeight="@dimen/list_item_height" android:paddingRight="0dp"
android:orientation="horizontal" android:paddingEnd="0dp"
android:paddingLeft="@dimen/list_content_padding" android:background="?attr/expandable_list_item_background"
android:paddingStart="@dimen/list_content_padding"> android:descendantFocusability="blocksDescendants"
android:minHeight="@dimen/list_item_height"
android:orientation="horizontal">
<CheckBox <CheckBox
android:id="@+id/check_local_index" android:id="@+id/check_local_index"

View file

@ -43,9 +43,9 @@
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center|start" android:layout_gravity="center_vertical|start"
android:text="@string/configure_profile" android:text="@string/configure_profile"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
android:textColor="?attr/active_color_basic" android:textColor="?attr/active_color_basic"

View file

@ -48,8 +48,9 @@
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
@ -59,8 +60,9 @@
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"

View file

@ -170,9 +170,9 @@
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:paddingLeft="@dimen/context_menu_padding_margin_default" android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default" android:paddingRight="@dimen/context_menu_padding_margin_default"
android:paddingTop="3dp" android:paddingStart="@dimen/context_menu_padding_margin_default"
android:paddingStart="@dimen/context_menu_padding_margin_default" android:paddingEnd="@dimen/context_menu_padding_margin_default"
android:paddingEnd="@dimen/context_menu_padding_margin_default"> android:paddingTop="3dp">
<LinearLayout <LinearLayout
android:id="@+id/additional_info_row" android:id="@+id/additional_info_row"
@ -197,10 +197,10 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:layout_gravity="top"
android:paddingRight="@dimen/context_menu_padding_margin_small" android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:paddingTop="1dp" android:paddingTop="1dp"
tools:src="@drawable/ic_action_opening_hour_16" tools:src="@drawable/ic_action_opening_hour_16" />
android:paddingEnd="@dimen/context_menu_padding_margin_small" />
<TextView <TextView
android:id="@+id/additional_info_text_view" android:id="@+id/additional_info_text_view"
@ -263,10 +263,10 @@
android:paddingBottom="@dimen/context_menu_padding_margin_small" android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:paddingLeft="@dimen/content_padding_half" android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half" android:paddingRight="@dimen/content_padding_half"
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" tools:visibility="visible">
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half">
<include <include
android:id="@+id/title_button_view" android:id="@+id/title_button_view"
@ -293,10 +293,10 @@
android:paddingBottom="@dimen/context_menu_padding_margin_small" android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:paddingLeft="@dimen/content_padding_half" android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half" android:paddingRight="@dimen/content_padding_half"
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" tools:visibility="visible">
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half">
<include <include
android:id="@+id/download_button_left_view" android:id="@+id/download_button_left_view"
@ -323,10 +323,10 @@
android:paddingBottom="@dimen/context_menu_padding_margin_small" android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:paddingLeft="@dimen/content_padding_half" android:paddingLeft="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half" android:paddingRight="@dimen/content_padding_half"
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" tools:visibility="visible">
android:paddingStart="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half">
<include <include
android:id="@+id/title_button_bottom_view" android:id="@+id/title_button_bottom_view"
@ -368,9 +368,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/content_padding_small" android:layout_marginRight="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding_small"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical">
android:layout_marginEnd="@dimen/content_padding_small">
<TextView <TextView
android:id="@+id/progressTitle" android:id="@+id/progressTitle"
@ -573,13 +573,13 @@
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
android:paddingLeft="@dimen/context_menu_padding_margin_default" android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default" android:paddingRight="@dimen/context_menu_padding_margin_default"
android:paddingStart="@dimen/context_menu_padding_margin_default"
android:paddingEnd="@dimen/context_menu_padding_margin_default"
android:text="@string/rendering_category_details" android:text="@string/rendering_category_details"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
tools:textColor="?attr/contextMenuButtonColor" tools:textColor="?attr/contextMenuButtonColor" />
android:paddingStart="@dimen/context_menu_padding_margin_default"
android:paddingEnd="@dimen/context_menu_padding_margin_default" />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_directions_button" android:id="@+id/context_menu_directions_button"
@ -590,13 +590,13 @@
android:gravity="end|center_vertical" android:gravity="end|center_vertical"
android:paddingLeft="@dimen/context_menu_padding_margin_default" android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default" android:paddingRight="@dimen/context_menu_padding_margin_default"
android:paddingEnd="@dimen/context_menu_padding_margin_default"
android:paddingStart="@dimen/context_menu_padding_margin_default"
android:text="@string/get_directions" android:text="@string/get_directions"
android:textAllCaps="true" android:textAllCaps="true"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
tools:textColor="?attr/contextMenuButtonColor" tools:textColor="?attr/contextMenuButtonColor" />
android:paddingEnd="@dimen/context_menu_padding_margin_default"
android:paddingStart="@dimen/context_menu_padding_margin_default" />
</LinearLayout> </LinearLayout>

View file

@ -51,7 +51,6 @@
android:paddingRight="@dimen/content_padding" android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half" android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half" android:paddingBottom="@dimen/content_padding_half"
android:singleLine="true"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"

View file

@ -14,7 +14,7 @@
android:layout_marginTop="@dimen/list_header_top_margin" android:layout_marginTop="@dimen/list_header_top_margin"
android:layout_marginEnd="@dimen/list_content_padding" android:layout_marginEnd="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding" android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginBottom="8dp"> android:layout_marginBottom="@dimen/content_padding_half">
<ImageView <ImageView
android:id="@+id/type_down_arrow" android:id="@+id/type_down_arrow"
@ -30,7 +30,7 @@
android:id="@+id/master_profile_otfb" android:id="@+id/master_profile_otfb"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
app:labelText="@string/master_profile" app:labelText="@string/profile_type_base_string"
app:primaryColor="@color/active_color_primary_dark" app:primaryColor="@color/active_color_primary_dark"
app:secondaryColor="?android:textColorSecondary"> app:secondaryColor="?android:textColorSecondary">

View file

@ -8,10 +8,10 @@
android:minHeight="48dp" android:minHeight="48dp"
android:paddingRight="24dp" android:paddingRight="24dp"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingStart="24dp" android:paddingStart="24dp"
android:paddingEnd="24dp"> android:paddingEnd="24dp"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView <ImageView

View file

@ -33,12 +33,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_gravity="center" android:layout_gravity="center"
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
tools:text="Add marker" tools:text="Add marker" />
android:layout_marginStart="16dp" />
<ImageView <ImageView
android:id="@+id/delete" android:id="@+id/delete"

View file

@ -17,7 +17,7 @@
android:id="@+id/info_type_title" android:id="@+id/info_type_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical|start"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center" android:gravity="center"
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"

View file

@ -16,14 +16,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:drawablePadding="16dp" android:drawablePadding="@dimen/content_padding"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:paddingRight="0dp"
android:paddingEnd="0dp"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textStyle="normal" android:textStyle="normal"
tools:drawableLeft="@drawable/ic_action_search_dark" tools:drawableLeft="@drawable/ic_action_search_dark"
tools:text="@string/layer_poi" tools:text="@string/layer_poi"
android:paddingStart="16dp"
tools:drawableStart="@drawable/ic_action_search_dark" /> tools:drawableStart="@drawable/ic_action_search_dark" />
</LinearLayout> </LinearLayout>

View file

@ -58,11 +58,11 @@
android:layout_weight="1" android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:paddingRight="16dp" android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
tools:text="Amsterdam" tools:text="Amsterdam" />
android:paddingEnd="16dp" />
<LinearLayout <LinearLayout
android:id="@+id/compass_layout" android:id="@+id/compass_layout"

View file

@ -10,8 +10,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="24dp" android:paddingLeft="24dp"
android:orientation="vertical" android:paddingStart="24dp"
android:paddingStart="24dp"> android:paddingRight="0dp"
android:paddingEnd="0dp"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/title" android:id="@+id/title"
@ -28,10 +30,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginTop="8dp" android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginRight="8dp" android:layout_marginRight="@dimen/content_padding_half"
android:orientation="horizontal" android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginEnd="8dp"> android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="0dp" android:layout_width="0dp"
@ -45,13 +47,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="16dp" android:paddingLeft="@dimen/content_padding"
android:paddingRight="16dp" android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:clickable="true" android:clickable="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:orientation="horizontal" android:orientation="horizontal">
android:paddingStart="16dp"
android:paddingEnd="16dp">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/widthTitle" android:id="@+id/widthTitle"
@ -59,9 +61,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="end" android:gravity="end"
android:layout_marginRight="8dp" android:layout_marginRight="@dimen/content_padding_half"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginEnd="8dp" /> android:textAppearance="@style/TextAppearance.ListItemTitle" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/colorImage" android:id="@+id/colorImage"

View file

@ -13,7 +13,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:paddingLeft="@dimen/list_content_padding" android:paddingLeft="@dimen/list_content_padding"
android:paddingStart="@dimen/list_content_padding"> android:paddingStart="@dimen/list_content_padding"
android:paddingRight="0dp"
android:paddingEnd="0dp">
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"

View file

@ -11,6 +11,7 @@
Thx - Hardy Thx - Hardy
--> -->
<string name="clear_recorded_data_warning">Are you sure you want to clear recorded data?</string>
<string name="restore_all_profile_settings_descr">All profile settings will be restored to their original state after creating/importing this profile.</string> <string name="restore_all_profile_settings_descr">All profile settings will be restored to their original state after creating/importing this profile.</string>
<string name="restore_all_profile_settings">Restore all profile settings?</string> <string name="restore_all_profile_settings">Restore all profile settings?</string>
<string name="saving_new_profile">Saving new profile</string> <string name="saving_new_profile">Saving new profile</string>

View file

@ -102,6 +102,7 @@
<!-- Osmand themes styles --> <!-- Osmand themes styles -->
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light"> <style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
<item name="android:textDirection">locale</item>
<item name="android:statusBarColor">@color/status_bar_color_light</item> <item name="android:statusBarColor">@color/status_bar_color_light</item>
<item name="mapBackground">@color/map_background_color_light</item> <item name="mapBackground">@color/map_background_color_light</item>
<item name="chart_marker_background">@drawable/chart_marker_background_light</item> <item name="chart_marker_background">@drawable/chart_marker_background_light</item>
@ -378,6 +379,7 @@
</style> </style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat"> <style name="OsmandDarkTheme" parent="Theme.AppCompat">
<item name="android:textDirection">locale</item>
<item name="android:statusBarColor">@color/status_bar_color_dark</item> <item name="android:statusBarColor">@color/status_bar_color_dark</item>
<item name="mapBackground">@color/map_background_color_dark</item> <item name="mapBackground">@color/map_background_color_dark</item>
<item name="chart_marker_background">@drawable/chart_marker_background_dark</item> <item name="chart_marker_background">@drawable/chart_marker_background_dark</item>

View file

@ -39,6 +39,7 @@ import android.util.DisplayMetrics;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
@ -61,6 +62,7 @@ import net.osmand.util.Algorithms;
import java.io.File; import java.io.File;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
@ -652,11 +654,48 @@ public class AndroidUtils {
} }
} }
public static void setCompoundDrawablesWithIntrinsicBounds(@NonNull TextView tv, Drawable start, Drawable top, Drawable end, Drawable bottom){
if (isSupportRTL()) {
tv.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
} else {
tv.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom);
}
}
public static void setPadding(View view, int start, int top, int end, int bottom) {
if (isSupportRTL()) {
view.setPaddingRelative(start, top, end, bottom);
} else {
view.setPadding(start, top, end, bottom);
}
}
public static void setMargins(ViewGroup.MarginLayoutParams layoutParams, int start, int top, int end, int bottom) {
layoutParams.setMargins(start, top, end, bottom);
if (isSupportRTL()) {
layoutParams.setMarginStart(start);
layoutParams.setMarginEnd(end);
}
}
public static int getLayoutDirection(@NonNull Context ctx) { public static int getLayoutDirection(@NonNull Context ctx) {
Locale currentLocale = ctx.getResources().getConfiguration().locale; Locale currentLocale = ctx.getResources().getConfiguration().locale;
return TextUtilsCompat.getLayoutDirectionFromLocale(currentLocale); return TextUtilsCompat.getLayoutDirectionFromLocale(currentLocale);
} }
public static boolean isSupportRTL() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
}
public static ArrayList<View> getChildrenViews(ViewGroup vg) {
ArrayList<View> result = new ArrayList<>();
for (int i = 0; i < vg.getChildCount(); i++) {
View child = vg.getChildAt(i);
result.add(child);
}
return result;
}
public static float getFreeSpaceGb(File dir) { public static float getFreeSpaceGb(File dir) {
if (dir.canRead()) { if (dir.canRead()) {
StatFs fs = new StatFs(dir.getAbsolutePath()); StatFs fs = new StatFs(dir.getAbsolutePath());

View file

@ -203,7 +203,6 @@ public class ContextMenuAdapter {
convertView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), layoutId, null); convertView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), layoutId, null);
convertView.setTag(layoutId); convertView.setTag(layoutId);
} }
UiUtilities.setupLayoutDirection(convertView);
if (item.getMinHeight() > 0) { if (item.getMinHeight() > 0) {
convertView.setMinimumHeight(item.getMinHeight()); convertView.setMinimumHeight(item.getMinHeight());
} }
@ -341,7 +340,6 @@ public class ContextMenuAdapter {
drawable.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels); drawable.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
tv.setCompoundDrawablesRelative(drawable, null, null, null); tv.setCompoundDrawablesRelative(drawable, null, null, null);
UiUtilities.setupLayoutDirection(tv);
} else { } else {
tv.setCompoundDrawables(drawable, null, null, null); tv.setCompoundDrawables(drawable, null, null, null);
} }

View file

@ -80,7 +80,6 @@ public class DialogListItemAdapter extends BaseAdapter {
} }
View button = view.findViewById(R.id.button); View button = view.findViewById(R.id.button);
button.setTag(position); button.setTag(position);
UiUtilities.setupLayoutDirection(button);
final CompoundButton cb; final CompoundButton cb;
if (multiChoice) { if (multiChoice) {
cb = view.findViewById(R.id.checkbox); cb = view.findViewById(R.id.checkbox);

View file

@ -387,11 +387,6 @@ public class UiUtilities {
image.setRotationY(rotation); image.setRotationY(rotation);
} }
public static void setupLayoutDirection(View layout) {
int direction = AndroidUtils.getLayoutDirection(layout.getContext());
ViewCompat.setLayoutDirection(layout, direction);
}
public static void setupCompoundButtonDrawable(Context ctx, boolean nightMode, @ColorInt int activeColor, Drawable drawable) { public static void setupCompoundButtonDrawable(Context ctx, boolean nightMode, @ColorInt int activeColor, Drawable drawable) {
int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light); int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
int[][] states = new int[][] { int[][] states = new int[][] {

View file

@ -174,7 +174,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
View searchView = inflater.inflate(R.layout.search_fav_list_item, null); View searchView = inflater.inflate(R.layout.search_fav_list_item, null);
searchView.setBackgroundResource(light ? R.color.list_background_color_light : R.color.list_background_color_dark); searchView.setBackgroundResource(light ? R.color.list_background_color_light : R.color.list_background_color_dark);
TextView title = (TextView) searchView.findViewById(R.id.title); TextView title = (TextView) searchView.findViewById(R.id.title);
title.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null); Drawable searchIcon = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(title, searchIcon, null, null, null);
title.setHint(R.string.shared_string_search); title.setHint(R.string.shared_string_search);
searchView.setOnClickListener(new View.OnClickListener() { searchView.setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -345,6 +345,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
backPressed(); backPressed();
} }
}); });
int layoutDirection = AndroidUtils.getLayoutDirection(mapActivity);
UiUtilities.rotateImageByLayoutDirection(back, layoutDirection);
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) { if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
settingsButton.setVisibility(View.VISIBLE); settingsButton.setVisibility(View.VISIBLE);

View file

@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
@ -26,20 +27,20 @@ public class DownloadGroupViewHolder {
} }
private Drawable getIconForGroup(DownloadResourceGroup group) { private Drawable getIconForGroup(DownloadResourceGroup group) {
Drawable iconLeft; Drawable iconStart;
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) { || group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up); iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) { } else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) {
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language); iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else { } else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities(); UiUtilities cache = ctx.getMyApplication().getUIUtilities();
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) { if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
iconLeft = cache.getThemedIcon(R.drawable.ic_world_globe_dark); iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
} else { } else {
DownloadResourceGroup ggr = group DownloadResourceGroup ggr = group
.getSubGroupById(DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS.getDefaultId()); .getSubGroupById(DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS.getDefaultId());
iconLeft = cache.getThemedIcon(R.drawable.ic_map); iconStart = cache.getThemedIcon(R.drawable.ic_map);
if (ggr != null && ggr.getIndividualResources() != null) { if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null; IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) { for (IndexItem ii : ggr.getIndividualResources()) {
@ -53,21 +54,21 @@ public class DownloadGroupViewHolder {
} }
if (item != null) { if (item != null) {
if (item.isOutdated()) { if (item.isOutdated()) {
iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_distance); iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
} else { } else {
iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_ok); iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
} }
} }
} }
} }
} }
return iconLeft; return iconStart;
} }
public void bindItem(DownloadResourceGroup group) { public void bindItem(DownloadResourceGroup group) {
Drawable iconLeft = getIconForGroup(group);
textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
String name = group.getName(ctx); String name = group.getName(ctx);
textView.setText(name); textView.setText(name);
Drawable iconStart = getIconForGroup(group);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
} }
} }

View file

@ -534,20 +534,20 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
} }
private Drawable getIconForGroup(DownloadResourceGroup group) { private Drawable getIconForGroup(DownloadResourceGroup group) {
Drawable iconLeft; Drawable iconStart;
if (group.getType() == DownloadResourceGroupType.VOICE_REC if (group.getType() == DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) { || group.getType() == DownloadResourceGroupType.VOICE_TTS) {
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up); iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroupType.FONTS) { } else if (group.getType() == DownloadResourceGroupType.FONTS) {
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language); iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else { } else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities(); UiUtilities cache = ctx.getMyApplication().getUIUtilities();
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) { if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
iconLeft = cache.getThemedIcon(R.drawable.ic_world_globe_dark); iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
} else { } else {
DownloadResourceGroup ggr = group DownloadResourceGroup ggr = group
.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId()); .getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
iconLeft = cache.getThemedIcon(R.drawable.ic_map); iconStart = cache.getThemedIcon(R.drawable.ic_map);
if (ggr != null && ggr.getIndividualResources() != null) { if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null; IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) { for (IndexItem ii : ggr.getIndividualResources()) {
@ -561,22 +561,22 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
} }
if (item != null) { if (item != null) {
if (item.isOutdated()) { if (item.isOutdated()) {
iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_distance); iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
} else { } else {
iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_ok); iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
} }
} }
} }
} }
} }
return iconLeft; return iconStart;
} }
public void bindItem(DownloadResourceGroup group) { public void bindItem(DownloadResourceGroup group) {
Drawable iconLeft = getIconForGroup(group);
textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
String name = group.getName(ctx); String name = group.getName(ctx);
textView.setText(name); textView.setText(name);
Drawable iconStart = getIconForGroup(group);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
} }
} }

View file

@ -620,7 +620,7 @@ public class GpxUiHelper {
popup.setAnchorView(apprTitleView); popup.setAnchorView(apprTitleView);
popup.setContentWidth(AndroidUtils.dpToPx(activity, 200f)); popup.setContentWidth(AndroidUtils.dpToPx(activity, 200f));
popup.setModal(true); popup.setModal(true);
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP); popup.setDropDownGravity(Gravity.END | Gravity.TOP);
popup.setVerticalOffset(AndroidUtils.dpToPx(activity, -48f)); popup.setVerticalOffset(AndroidUtils.dpToPx(activity, -48f));
popup.setHorizontalOffset(AndroidUtils.dpToPx(activity, -6f)); popup.setHorizontalOffset(AndroidUtils.dpToPx(activity, -6f));
final GpxAppearanceAdapter gpxApprAdapter = new GpxAppearanceAdapter(new ContextThemeWrapper(activity, themeRes), final GpxAppearanceAdapter gpxApprAdapter = new GpxAppearanceAdapter(new ContextThemeWrapper(activity, themeRes),

View file

@ -628,8 +628,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
Drawable drawable = getIcon(iconResId, bottomButtonsColor); Drawable drawable = getIcon(iconResId, bottomButtonsColor);
directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor)); directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor));
directionsButton.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null); AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(directionsButton, null, null, drawable, null);
directionsButton.setCompoundDrawablePadding(dpToPx(8)); int contentPaddingHalf = (int) getResources().getDimension(R.dimen.content_padding_half);
directionsButton.setCompoundDrawablePadding(contentPaddingHalf);
directionsButton.setOnClickListener(new View.OnClickListener() { directionsButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

View file

@ -562,7 +562,7 @@ public class MenuBuilder {
ImageView iconView = new ImageView(view.getContext()); ImageView iconView = new ImageView(view.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f)); AndroidUtils.setMargins(llIconParams, dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconParams.gravity = Gravity.CENTER_VERTICAL; llIconParams.gravity = Gravity.CENTER_VERTICAL;
iconView.setLayoutParams(llIconParams); iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -575,7 +575,7 @@ public class MenuBuilder {
llText.setOrientation(LinearLayout.VERTICAL); llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f; llTextViewParams.weight = 1f;
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0); AndroidUtils.setMargins(llTextViewParams, 0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL; llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams); llText.setLayoutParams(llTextViewParams);
ll.addView(llText); ll.addView(llText);
@ -584,7 +584,7 @@ public class MenuBuilder {
if (!Algorithms.isEmpty(textPrefix)) { if (!Algorithms.isEmpty(textPrefix)) {
textPrefixView = new TextViewEx(view.getContext()); textPrefixView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0); AndroidUtils.setMargins(llTextParams, icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0);
textPrefixView.setLayoutParams(llTextParams); textPrefixView.setLayoutParams(llTextParams);
textPrefixView.setTypeface(FontCache.getRobotoRegular(view.getContext())); textPrefixView.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textPrefixView.setTextSize(12); textPrefixView.setTextSize(12);
@ -598,7 +598,8 @@ public class MenuBuilder {
// Primary text // Primary text
TextViewEx textView = new TextViewEx(view.getContext()); TextViewEx textView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(icon != null ? 0 : dpToPx(16f), dpToPx(textPrefixView != null ? 2f : (secondaryText != null ? 10f : 8f)), 0, dpToPx(secondaryText != null ? 6f : 8f)); AndroidUtils.setMargins(llTextParams,
icon != null ? 0 : dpToPx(16f), dpToPx(textPrefixView != null ? 2f : (secondaryText != null ? 10f : 8f)), 0, dpToPx(secondaryText != null ? 6f : 8f));
textView.setLayoutParams(llTextParams); textView.setLayoutParams(llTextParams);
textView.setTypeface(FontCache.getRobotoRegular(view.getContext())); textView.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textView.setTextSize(16); textView.setTextSize(16);
@ -629,7 +630,7 @@ public class MenuBuilder {
if (!TextUtils.isEmpty(secondaryText)) { if (!TextUtils.isEmpty(secondaryText)) {
TextViewEx textViewSecondary = new TextViewEx(view.getContext()); TextViewEx textViewSecondary = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextSecondaryParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextSecondaryParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextSecondaryParams.setMargins(icon != null ? 0 : dpToPx(16f), 0, 0, dpToPx(6f)); AndroidUtils.setMargins(llTextSecondaryParams, icon != null ? 0 : dpToPx(16f), 0, 0, dpToPx(6f));
textViewSecondary.setLayoutParams(llTextSecondaryParams); textViewSecondary.setLayoutParams(llTextSecondaryParams);
textViewSecondary.setTypeface(FontCache.getRobotoRegular(view.getContext())); textViewSecondary.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textViewSecondary.setTextSize(14); textViewSecondary.setTextSize(14);
@ -643,7 +644,7 @@ public class MenuBuilder {
TextViewEx buttonTextView = new TextViewEx(view.getContext()); TextViewEx buttonTextView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams buttonTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams buttonTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
buttonTextViewParams.gravity = Gravity.CENTER_VERTICAL; buttonTextViewParams.gravity = Gravity.CENTER_VERTICAL;
buttonTextViewParams.setMargins(dpToPx(8), 0, dpToPx(8), 0); AndroidUtils.setMargins(buttonTextViewParams, dpToPx(8), 0, dpToPx(8), 0);
buttonTextView.setLayoutParams(buttonTextViewParams); buttonTextView.setLayoutParams(buttonTextViewParams);
buttonTextView.setTypeface(FontCache.getRobotoMedium(view.getContext())); buttonTextView.setTypeface(FontCache.getRobotoMedium(view.getContext()));
buttonTextView.setAllCaps(true); buttonTextView.setAllCaps(true);
@ -662,7 +663,7 @@ public class MenuBuilder {
ll.addView(llIconCollapse); ll.addView(llIconCollapse);
LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(24f), dpToPx(12f)); AndroidUtils.setMargins(llIconCollapseParams, 0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL; llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -827,7 +828,7 @@ public class MenuBuilder {
Button buttonView = new Button(view.getContext()); Button buttonView = new Button(view.getContext());
LinearLayout.LayoutParams llBtnParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llBtnParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
buttonView.setLayoutParams(llBtnParams); buttonView.setLayoutParams(llBtnParams);
buttonView.setPadding(dpToPx(10f), 0, dpToPx(10f), 0); AndroidUtils.setPadding(buttonView, dpToPx(10f), 0, dpToPx(10f), 0);
buttonView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); buttonView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
//buttonView.setTextSize(view.getResources().getDimension(resolveAttribute(view.getContext(), R.dimen.default_desc_text_size))); //buttonView.setTextSize(view.getResources().getDimension(resolveAttribute(view.getContext(), R.dimen.default_desc_text_size)));
buttonView.setTextColor(view.getResources().getColor(AndroidUtils.resolveAttribute(view.getContext(), R.attr.contextMenuButtonColor))); buttonView.setTextColor(view.getResources().getColor(AndroidUtils.resolveAttribute(view.getContext(), R.attr.contextMenuButtonColor)));
@ -851,7 +852,7 @@ public class MenuBuilder {
LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f)); LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f));
llHorLineParams.gravity = Gravity.BOTTOM; llHorLineParams.gravity = Gravity.BOTTOM;
if (!matchWidthDivider) { if (!matchWidthDivider) {
llHorLineParams.setMargins(dpToPx(64f), 0, 0, 0); AndroidUtils.setMargins(llHorLineParams, dpToPx(64f), 0, 0, 0);
} }
horizontalLine.setLayoutParams(llHorLineParams); horizontalLine.setLayoutParams(llHorLineParams);
horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_divider_light : R.color.ctx_menu_bottom_view_divider_dark)); horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_divider_light : R.color.ctx_menu_bottom_view_divider_dark));
@ -915,12 +916,12 @@ public class MenuBuilder {
baseView.setOrientation(LinearLayout.HORIZONTAL); baseView.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llBaseViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llBaseViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
baseView.setLayoutParams(llBaseViewParams); baseView.setLayoutParams(llBaseViewParams);
baseView.setPadding(dpToPx(16), 0, dpToPx(16), dpToPx(12)); AndroidUtils.setPadding(baseView, dpToPx(16), 0, dpToPx(16), dpToPx(12));
baseView.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground)); baseView.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
TextViewEx transportRect = new TextViewEx(view.getContext()); TextViewEx transportRect = new TextViewEx(view.getContext());
LinearLayout.LayoutParams trParams = new LinearLayout.LayoutParams(dpToPx(32), dpToPx(18)); LinearLayout.LayoutParams trParams = new LinearLayout.LayoutParams(dpToPx(32), dpToPx(18));
trParams.setMargins(0, dpToPx(16), 0, 0); AndroidUtils.setMargins(trParams, 0, dpToPx(16), 0, 0);
transportRect.setLayoutParams(trParams); transportRect.setLayoutParams(trParams);
transportRect.setGravity(Gravity.CENTER); transportRect.setGravity(Gravity.CENTER);
transportRect.setAllCaps(true); transportRect.setAllCaps(true);
@ -943,7 +944,7 @@ public class MenuBuilder {
LinearLayout infoView = new LinearLayout(view.getContext()); LinearLayout infoView = new LinearLayout(view.getContext());
infoView.setOrientation(LinearLayout.VERTICAL); infoView.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams infoViewLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams infoViewLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
infoViewLayoutParams.setMargins(dpToPx(16), dpToPx(12), dpToPx(16), 0); AndroidUtils.setMargins(infoViewLayoutParams, dpToPx(16), dpToPx(12), dpToPx(16), 0);
infoView.setLayoutParams(infoViewLayoutParams); infoView.setLayoutParams(infoViewLayoutParams);
baseView.addView(infoView); baseView.addView(infoView);
@ -962,14 +963,14 @@ public class MenuBuilder {
LinearLayout typeView = new LinearLayout(view.getContext()); LinearLayout typeView = new LinearLayout(view.getContext());
typeView.setOrientation(LinearLayout.HORIZONTAL); typeView.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams typeViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams typeViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
typeViewParams.setMargins(0, dpToPx(8), 0, 0); AndroidUtils.setMargins(typeViewParams, 0, dpToPx(8), 0, 0);
typeView.setGravity(Gravity.CENTER); typeView.setGravity(Gravity.CENTER);
typeView.setLayoutParams(typeViewParams); typeView.setLayoutParams(typeViewParams);
infoView.addView(typeView); infoView.addView(typeView);
ImageView typeImageView = new ImageView(view.getContext()); ImageView typeImageView = new ImageView(view.getContext());
LinearLayout.LayoutParams typeImageParams = new LinearLayout.LayoutParams(dpToPx(16), dpToPx(16)); LinearLayout.LayoutParams typeImageParams = new LinearLayout.LayoutParams(dpToPx(16), dpToPx(16));
typeImageParams.setMargins(dpToPx(4), 0, dpToPx(4), 0); AndroidUtils.setMargins(typeImageParams, dpToPx(4), 0, dpToPx(4), 0);
typeImageView.setLayoutParams(typeImageParams); typeImageView.setLayoutParams(typeImageParams);
int drawableResId = route.type == null ? R.drawable.ic_action_polygom_dark : route.type.getResourceId(); int drawableResId = route.type == null ? R.drawable.ic_action_polygom_dark : route.type.getResourceId();
typeImageView.setImageDrawable(getRowIcon(drawableResId)); typeImageView.setImageDrawable(getRowIcon(drawableResId));
@ -1037,7 +1038,7 @@ public class MenuBuilder {
final TextViewEx textView = new TextViewEx(context); final TextViewEx textView = new TextViewEx(context);
textView.setVisibility(collapsed ? View.GONE : View.VISIBLE); textView.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llTextDescParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextDescParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextDescParams.setMargins(dpToPx(64f), 0, dpToPx(40f), dpToPx(13f)); AndroidUtils.setMargins(llTextDescParams, dpToPx(64f), 0, dpToPx(40f), dpToPx(13f));
textView.setLayoutParams(llTextDescParams); textView.setLayoutParams(llTextDescParams);
textView.setTypeface(FontCache.getRobotoRegular(context)); textView.setTypeface(FontCache.getRobotoRegular(context));
textView.setTextSize(16); textView.setTextSize(16);
@ -1074,7 +1075,7 @@ public class MenuBuilder {
view.setVisibility(collapsed ? View.GONE : View.VISIBLE); view.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
if (needMargin) { if (needMargin) {
llParams.setMargins(dpToPx(64f), 0, dpToPx(12f), 0); AndroidUtils.setMargins(llParams, dpToPx(64f), 0, dpToPx(12f), 0);
} }
view.setLayoutParams(llParams); view.setLayoutParams(llParams);
return view; return view;
@ -1087,7 +1088,7 @@ public class MenuBuilder {
protected TextViewEx buildButtonInCollapsableView(Context context, boolean selected, boolean showAll, boolean singleLine) { protected TextViewEx buildButtonInCollapsableView(Context context, boolean selected, boolean showAll, boolean singleLine) {
TextViewEx button = new TextViewEx(new ContextThemeWrapper(context, light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme)); TextViewEx button = new TextViewEx(new ContextThemeWrapper(context, light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llWikiButtonParams.setMargins(0, 0, 0, dpToPx(8f)); AndroidUtils.setMargins(llWikiButtonParams, 0, 0, 0, dpToPx(8f));
//button.setMinimumHeight(dpToPx(36f)); //button.setMinimumHeight(dpToPx(36f));
button.setLayoutParams(llWikiButtonParams); button.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoRegular(context)); button.setTypeface(FontCache.getRobotoRegular(context));
@ -1102,7 +1103,7 @@ public class MenuBuilder {
button.setBackgroundResource(bg); button.setBackgroundResource(bg);
button.setTextSize(14); button.setTextSize(14);
int paddingSides = dpToPx(10f); int paddingSides = dpToPx(10f);
button.setPadding(paddingSides, paddingSides, paddingSides, paddingSides); AndroidUtils.setPadding(button, paddingSides, paddingSides, paddingSides, paddingSides);
if (!selected) { if (!selected) {
ColorStateList buttonColorStateList = AndroidUtils.createPressedColorStateList(context, !light, ColorStateList buttonColorStateList = AndroidUtils.createPressedColorStateList(context, !light,
R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p, R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,

View file

@ -135,7 +135,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ImageView iconView = new ImageView(view.getContext()); ImageView iconView = new ImageView(view.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f)); AndroidUtils.setMargins(llIconParams, dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconParams.gravity = Gravity.CENTER_VERTICAL; llIconParams.gravity = Gravity.CENTER_VERTICAL;
iconView.setLayoutParams(llIconParams); iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -152,7 +152,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (!Algorithms.isEmpty(textPrefix)) { if (!Algorithms.isEmpty(textPrefix)) {
textPrefixView = new TextView(view.getContext()); textPrefixView = new TextView(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0); AndroidUtils.setMargins(llTextParams, icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0);
textPrefixView.setLayoutParams(llTextParams); textPrefixView.setLayoutParams(llTextParams);
textPrefixView.setTextSize(12); textPrefixView.setTextSize(12);
textPrefixView.setTextColor(app.getResources().getColor(R.color.ctx_menu_buttons_text_color)); textPrefixView.setTextColor(app.getResources().getColor(R.color.ctx_menu_buttons_text_color));
@ -164,7 +164,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
TextView textView = new TextView(view.getContext()); TextView textView = new TextView(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, AndroidUtils.setMargins(llTextParams, icon == null ? dpToPx(16f) : 0,
textPrefixView == null ? (collapsable ? dpToPx(13f) : dpToPx(8f)) : dpToPx(2f), 0, collapsable && textPrefixView == null ? dpToPx(13f) : dpToPx(8f)); textPrefixView == null ? (collapsable ? dpToPx(13f) : dpToPx(8f)) : dpToPx(2f), 0, collapsable && textPrefixView == null ? dpToPx(13f) : dpToPx(8f));
textView.setLayoutParams(llTextParams); textView.setLayoutParams(llTextParams);
textView.setTextSize(16); textView.setTextSize(16);
@ -200,7 +200,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f; llTextViewParams.weight = 1f;
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0); AndroidUtils.setMargins(llTextViewParams, 0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL; llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams); llText.setLayoutParams(llTextViewParams);
if (textPrefixView != null) { if (textPrefixView != null) {
@ -218,7 +218,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.addView(llIconCollapse); ll.addView(llIconCollapse);
LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(24f), dpToPx(12f)); AndroidUtils.setMargins(llIconCollapseParams, 0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL; llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -248,7 +248,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (isWiki) { if (isWiki) {
TextViewEx button = new TextViewEx(new ContextThemeWrapper(view.getContext(), light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme)); TextViewEx button = new TextViewEx(new ContextThemeWrapper(view.getContext(), light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dpToPx(36f)); LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dpToPx(36f));
llWikiButtonParams.setMargins(dpToPx(16f), 0, 0, dpToPx(16f)); AndroidUtils.setMargins(llWikiButtonParams, dpToPx(16f), 0, 0, dpToPx(16f));
button.setLayoutParams(llWikiButtonParams); button.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoMedium(app)); button.setTypeface(FontCache.getRobotoMedium(app));
button.setBackgroundResource(light ? R.drawable.context_menu_controller_bg_light : R.drawable.context_menu_controller_bg_dark); button.setBackgroundResource(light ? R.drawable.context_menu_controller_bg_light : R.drawable.context_menu_controller_bg_dark);

View file

@ -11,6 +11,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -65,7 +66,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
private void buildIcon(LinearLayout ll, int gpxSmallIconMargin, int iconId) { private void buildIcon(LinearLayout ll, int gpxSmallIconMargin, int iconId) {
ImageView icon = new ImageView(ll.getContext()); ImageView icon = new ImageView(ll.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llIconParams.setMargins(0, 0, gpxSmallIconMargin, 0); AndroidUtils.setMargins(llIconParams, 0, 0, gpxSmallIconMargin, 0);
llIconParams.gravity = Gravity.CENTER_VERTICAL; llIconParams.gravity = Gravity.CENTER_VERTICAL;
icon.setLayoutParams(llIconParams); icon.setLayoutParams(llIconParams);
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(iconId)); icon.setImageDrawable(app.getUIUtilities().getThemedIcon(iconId));
@ -75,7 +76,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
private void buildTextView(LinearLayout ll, int gpxSmallTextMargin, float gpxTextSize, int textColor, String text) { private void buildTextView(LinearLayout ll, int gpxSmallTextMargin, float gpxTextSize, int textColor, String text) {
TextView textView = new TextView(ll.getContext()); TextView textView = new TextView(ll.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(0, 0, gpxSmallTextMargin, 0); AndroidUtils.setMargins(llTextParams, 0, 0, gpxSmallTextMargin, 0);
textView.setLayoutParams(llTextParams); textView.setLayoutParams(llTextParams);
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, gpxTextSize); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, gpxTextSize);
textView.setTextColor(textColor); textView.setTextColor(textColor);

View file

@ -107,9 +107,6 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
nameEditText.setText(displayedName); nameEditText.setText(displayedName);
nameEditText.setTextColor(ContextCompat.getColor(getContext(), textPrimaryColor)); nameEditText.setTextColor(ContextCompat.getColor(getContext(), textPrimaryColor));
if (textBox instanceof OsmandTextFieldBoxes) {
((OsmandTextFieldBoxes) textBox).activate(true);
}
mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -87,7 +87,6 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment {
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
nameEditText.setText(savedGpxName); nameEditText.setText(savedGpxName);
nameEditText.setTextColor(ContextCompat.getColor(ctx, textPrimaryColor)); nameEditText.setTextColor(ContextCompat.getColor(ctx, textPrimaryColor));
textBox.activate(true);
nameEditText.addTextChangedListener(new TextWatcher() { nameEditText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {

View file

@ -331,18 +331,21 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
LayoutInflater inflater = UiUtilities.getInflater(viewGroup.getContext(), nightMode); LayoutInflater inflater = UiUtilities.getInflater(viewGroup.getContext(), nightMode);
View itemView;
RecyclerView.ViewHolder viewHolder;
if (viewType == INFO_TYPE) { if (viewType == INFO_TYPE) {
View itemView = inflater.inflate(R.layout.bottom_sheet_item_description_long, viewGroup, false); itemView = inflater.inflate(R.layout.bottom_sheet_item_description_long, viewGroup, false);
return new InfoViewHolder(itemView); viewHolder = new InfoViewHolder(itemView);
} else if (viewType == PROFILE_EDIT_TYPE) { } else if (viewType == PROFILE_EDIT_TYPE) {
View itemView = inflater.inflate(R.layout.profile_edit_list_item, viewGroup, false); itemView = inflater.inflate(R.layout.profile_edit_list_item, viewGroup, false);
return new ProfileViewHolder(itemView); viewHolder = new ProfileViewHolder(itemView);
} else if (viewType == CATEGORY_TYPE) { } else if (viewType == CATEGORY_TYPE) {
View itemView = inflater.inflate(R.layout.simple_category_item, viewGroup, false); itemView = inflater.inflate(R.layout.simple_category_item, viewGroup, false);
return new CategoryViewHolder(itemView); viewHolder = new CategoryViewHolder(itemView);
} else { } else {
throw new IllegalArgumentException("Unsupported view type"); throw new IllegalArgumentException("Unsupported view type");
} }
return viewHolder;
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")

View file

@ -954,7 +954,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
} }
}; };
ll.getViewTreeObserver().addOnGlobalLayoutListener(globalListener); ll.getViewTreeObserver().addOnGlobalLayoutListener(globalListener);
} }
private void updateOptionsButtons() { private void updateOptionsButtons() {

View file

@ -440,7 +440,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
divider.setLayoutParams(p); divider.setLayoutParams(p);
} else { } else {
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp1); LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp1);
p.setMargins(dp56, 0, 0 ,0); AndroidUtils.setMargins(p, dp56, 0, 0, 0);
divider.setLayoutParams(p); divider.setLayoutParams(p);
} }
} }

View file

@ -3,8 +3,8 @@ package net.osmand.plus.settings.bottomsheets;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -51,9 +51,9 @@ public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet {
editText = view.findViewById(R.id.edit_text); editText = view.findViewById(R.id.edit_text);
editText.setText(text); editText.setText(text);
RelativeLayout editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout); ViewGroup editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout);
if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof RelativeLayout.LayoutParams) { if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) editTextLayout.getLayoutParams(); ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) editTextLayout.getLayoutParams();
params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 9), params.rightMargin, params.bottomMargin); params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 9), params.rightMargin, params.bottomMargin);
} }

View file

@ -2,20 +2,11 @@ package net.osmand.plus.widgets;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import androidx.core.view.ViewCompat;
import net.osmand.plus.R;
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
import studio.carbonylgroup.textfieldboxes.TextFieldBoxes; import studio.carbonylgroup.textfieldboxes.TextFieldBoxes;
public class OsmandTextFieldBoxes extends TextFieldBoxes { public class OsmandTextFieldBoxes extends TextFieldBoxes {
private boolean useOsmandKeyboard;
public OsmandTextFieldBoxes(Context context) { public OsmandTextFieldBoxes(Context context) {
super(context); super(context);
} }
@ -28,83 +19,4 @@ public class OsmandTextFieldBoxes extends TextFieldBoxes {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
public void setUseOsmandKeyboard(boolean useOsmandKeyboard) {
this.useOsmandKeyboard = useOsmandKeyboard;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
if (editText != null) {
this.panel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
select();
}
});
this.iconImageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
select();
}
});
}
}
public void select() {
if(!OsmandTextFieldBoxes.this.isActivated()) {
OsmandTextFieldBoxes.this.activate(true);
}
OsmandTextFieldBoxes.this.setHasFocus(true);
if (!useOsmandKeyboard) {
OsmandTextFieldBoxes.this.inputMethodManager.showSoftInput(OsmandTextFieldBoxes.this.editText, InputMethodManager.SHOW_IMPLICIT);
}
performClick();
}
@Override
public void activate(boolean animated) {
super.activate(animated);
}
@Override
public void deactivate() {
if(this.editText.getText().toString().isEmpty()) {
ViewCompat.animate(this.floatingLabel).alpha(1.0F).scaleX(1.0F).scaleY(1.0F).translationY(0.0F).setDuration((long)this.ANIMATION_DURATION);
this.editTextLayout.setVisibility(View.INVISIBLE);
if(this.editText.hasFocus()) {
if (!useOsmandKeyboard) {
this.inputMethodManager.hideSoftInputFromWindow(this.editText.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);
}
this.editText.clearFocus();
}
}
this.activated = false;
}
public ExtendedEditText getEditText() {
return editText;
}
@Override
protected void makeCursorBlink() {
CharSequence hintCache = this.editText.getHint();
this.editText.setHint(" ");
this.editText.setHint(hintCache);
}
@Override
public void setError(String errorText, boolean giveFocus) {
super.setError(errorText, giveFocus);
this.findViewById(R.id.text_field_boxes_bottom).setVisibility(View.VISIBLE);
}
@Override
public void removeError() {
super.removeError();
this.findViewById(R.id.text_field_boxes_bottom).setVisibility(View.GONE);
}
} }