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:contentInsetStart="4dp">
<ImageView
android:id="@+id/toolbar_back"
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"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:scaleType="center"
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
tools:text="Toolbar"
tools:visibility="visible"/>
android:gravity="center_vertical"
android:orientation="horizontal">
<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:layout_gravity="end"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_action_done"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="start"
android:orientation="horizontal">
<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:layout_gravity="end"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_sort_waypoint_dark"/>
<ImageView
android:id="@+id/toolbar_back"
android:contentDescription="@string/back_to_map"
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_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_flat"
android:contentDescription="@string/drawer"
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_flat_list_dark"
android:visibility="gone"/>
<TextView
android:id="@+id/toolbar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:textColor="@color/abc_primary_text_material_dark"
android:textSize="@dimen/abc_text_size_large_material"
tools:text="Toolbar"
tools:visibility="visible"/>
<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:layout_gravity="end"
android:background="@drawable/dashboard_button_light"
android:scaleType="center"
android:src="@drawable/ic_action_edit_dark"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<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"/>
<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>

View file

@ -19,9 +19,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
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:background="?attr/expandable_list_item_background"
android:paddingStart="@dimen/list_content_padding">
android:background="?attr/expandable_list_item_background">
<CheckBox
android:id="@+id/toggle_item"

View file

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

View file

@ -24,12 +24,12 @@
android:id="@+id/searchEditText"
android:layout_width="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:gravity="center_vertical"
android:lines="1"
tools:text="Search request"
android:layout_marginStart="16dp" />
tools:text="Search request" />
</LinearLayout>
<FrameLayout

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,14 +16,16 @@
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:drawablePadding="16dp"
android:drawablePadding="@dimen/content_padding"
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:textStyle="normal"
tools:drawableLeft="@drawable/ic_action_search_dark"
tools:text="@string/layer_poi"
android:paddingStart="16dp"
tools:drawableStart="@drawable/ic_action_search_dark" />
</LinearLayout>

View file

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

View file

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

View file

@ -13,7 +13,9 @@
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
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
android:id="@+id/icon"

View file

@ -11,6 +11,7 @@
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">Restore all profile settings?</string>
<string name="saving_new_profile">Saving new profile</string>

View file

@ -102,6 +102,7 @@
<!-- Osmand themes styles -->
<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="mapBackground">@color/map_background_color_light</item>
<item name="chart_marker_background">@drawable/chart_marker_background_light</item>
@ -378,6 +379,7 @@
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
<item name="android:textDirection">locale</item>
<item name="android:statusBarColor">@color/status_bar_color_dark</item>
<item name="mapBackground">@color/map_background_color_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.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
@ -61,6 +62,7 @@ import net.osmand.util.Algorithms;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
@ -651,12 +653,49 @@ public class AndroidUtils {
return baseString;
}
}
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) {
Locale currentLocale = ctx.getResources().getConfiguration().locale;
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) {
if (dir.canRead()) {
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.setTag(layoutId);
}
UiUtilities.setupLayoutDirection(convertView);
if (item.getMinHeight() > 0) {
convertView.setMinimumHeight(item.getMinHeight());
}
@ -214,7 +213,7 @@ public class ContextMenuAdapter {
TextView title = convertView.findViewById(R.id.title);
title.setText(item.getTitle());
if (layoutId == R.layout.main_menu_drawer_btn_switch_profile) {
ImageView icon = convertView.findViewById(R.id.icon);
icon.setImageDrawable(mIconsCache.getIcon(item.getIcon(), colorResId));
@ -341,7 +340,6 @@ public class ContextMenuAdapter {
drawable.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
tv.setCompoundDrawablesRelative(drawable, null, null, null);
UiUtilities.setupLayoutDirection(tv);
} else {
tv.setCompoundDrawables(drawable, null, null, null);
}

View file

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

View file

@ -386,11 +386,6 @@ public class UiUtilities {
int rotation = layoutDirection == View.LAYOUT_DIRECTION_LTR ? 0 : 180;
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) {
int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);

View file

@ -174,7 +174,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
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);
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);
searchView.setOnClickListener(new View.OnClickListener() {
@Override

View file

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

View file

@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.R;
import net.osmand.plus.download.DownloadActivity;
@ -26,20 +27,20 @@ public class DownloadGroupViewHolder {
}
private Drawable getIconForGroup(DownloadResourceGroup group) {
Drawable iconLeft;
Drawable iconStart;
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|| 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) {
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
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 {
DownloadResourceGroup ggr = group
.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) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
@ -53,21 +54,21 @@ public class DownloadGroupViewHolder {
}
if (item != null) {
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 {
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) {
Drawable iconLeft = getIconForGroup(group);
textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
String name = group.getName(ctx);
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) {
Drawable iconLeft;
Drawable iconStart;
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|| 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) {
iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
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 {
DownloadResourceGroup ggr = group
.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) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
@ -561,22 +561,22 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
}
if (item != null) {
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 {
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) {
Drawable iconLeft = getIconForGroup(group);
textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
String name = group.getName(ctx);
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.setContentWidth(AndroidUtils.dpToPx(activity, 200f));
popup.setModal(true);
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
popup.setDropDownGravity(Gravity.END | Gravity.TOP);
popup.setVerticalOffset(AndroidUtils.dpToPx(activity, -48f));
popup.setHorizontalOffset(AndroidUtils.dpToPx(activity, -6f));
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);
directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor));
directionsButton.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
directionsButton.setCompoundDrawablePadding(dpToPx(8));
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(directionsButton, null, null, drawable, null);
int contentPaddingHalf = (int) getResources().getDimension(R.dimen.content_padding_half);
directionsButton.setCompoundDrawablePadding(contentPaddingHalf);
directionsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

View file

@ -562,7 +562,7 @@ public class MenuBuilder {
ImageView iconView = new ImageView(view.getContext());
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;
iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -575,7 +575,7 @@ public class MenuBuilder {
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f;
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
AndroidUtils.setMargins(llTextViewParams, 0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams);
ll.addView(llText);
@ -584,7 +584,7 @@ public class MenuBuilder {
if (!Algorithms.isEmpty(textPrefix)) {
textPrefixView = new TextViewEx(view.getContext());
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.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textPrefixView.setTextSize(12);
@ -598,7 +598,8 @@ public class MenuBuilder {
// Primary text
TextViewEx textView = new TextViewEx(view.getContext());
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.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textView.setTextSize(16);
@ -629,7 +630,7 @@ public class MenuBuilder {
if (!TextUtils.isEmpty(secondaryText)) {
TextViewEx textViewSecondary = new TextViewEx(view.getContext());
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.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textViewSecondary.setTextSize(14);
@ -643,7 +644,7 @@ public class MenuBuilder {
TextViewEx buttonTextView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams buttonTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
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.setTypeface(FontCache.getRobotoMedium(view.getContext()));
buttonTextView.setAllCaps(true);
@ -662,7 +663,7 @@ public class MenuBuilder {
ll.addView(llIconCollapse);
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;
iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -827,7 +828,7 @@ public class MenuBuilder {
Button buttonView = new Button(view.getContext());
LinearLayout.LayoutParams llBtnParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
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.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)));
@ -851,7 +852,7 @@ public class MenuBuilder {
LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f));
llHorLineParams.gravity = Gravity.BOTTOM;
if (!matchWidthDivider) {
llHorLineParams.setMargins(dpToPx(64f), 0, 0, 0);
AndroidUtils.setMargins(llHorLineParams, dpToPx(64f), 0, 0, 0);
}
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));
@ -915,12 +916,12 @@ public class MenuBuilder {
baseView.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llBaseViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
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));
TextViewEx transportRect = new TextViewEx(view.getContext());
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.setGravity(Gravity.CENTER);
transportRect.setAllCaps(true);
@ -943,7 +944,7 @@ public class MenuBuilder {
LinearLayout infoView = new LinearLayout(view.getContext());
infoView.setOrientation(LinearLayout.VERTICAL);
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);
baseView.addView(infoView);
@ -962,14 +963,14 @@ public class MenuBuilder {
LinearLayout typeView = new LinearLayout(view.getContext());
typeView.setOrientation(LinearLayout.HORIZONTAL);
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.setLayoutParams(typeViewParams);
infoView.addView(typeView);
ImageView typeImageView = new ImageView(view.getContext());
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);
int drawableResId = route.type == null ? R.drawable.ic_action_polygom_dark : route.type.getResourceId();
typeImageView.setImageDrawable(getRowIcon(drawableResId));
@ -1037,7 +1038,7 @@ public class MenuBuilder {
final TextViewEx textView = new TextViewEx(context);
textView.setVisibility(collapsed ? View.GONE : View.VISIBLE);
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.setTypeface(FontCache.getRobotoRegular(context));
textView.setTextSize(16);
@ -1074,7 +1075,7 @@ public class MenuBuilder {
view.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
if (needMargin) {
llParams.setMargins(dpToPx(64f), 0, dpToPx(12f), 0);
AndroidUtils.setMargins(llParams, dpToPx(64f), 0, dpToPx(12f), 0);
}
view.setLayoutParams(llParams);
return view;
@ -1087,7 +1088,7 @@ public class MenuBuilder {
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));
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.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoRegular(context));
@ -1102,7 +1103,7 @@ public class MenuBuilder {
button.setBackgroundResource(bg);
button.setTextSize(14);
int paddingSides = dpToPx(10f);
button.setPadding(paddingSides, paddingSides, paddingSides, paddingSides);
AndroidUtils.setPadding(button, paddingSides, paddingSides, paddingSides, paddingSides);
if (!selected) {
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,

View file

@ -135,7 +135,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ImageView iconView = new ImageView(view.getContext());
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;
iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -152,7 +152,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (!Algorithms.isEmpty(textPrefix)) {
textPrefixView = new TextView(view.getContext());
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.setTextSize(12);
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());
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));
textView.setLayoutParams(llTextParams);
textView.setTextSize(16);
@ -200,7 +200,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f;
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
AndroidUtils.setMargins(llTextViewParams, 0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams);
if (textPrefixView != null) {
@ -218,7 +218,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.addView(llIconCollapse);
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;
iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -248,7 +248,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (isWiki) {
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));
llWikiButtonParams.setMargins(dpToPx(16f), 0, 0, dpToPx(16f));
AndroidUtils.setMargins(llWikiButtonParams, dpToPx(16f), 0, 0, dpToPx(16f));
button.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoMedium(app));
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.core.content.ContextCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
@ -65,7 +66,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
private void buildIcon(LinearLayout ll, int gpxSmallIconMargin, int iconId) {
ImageView icon = new ImageView(ll.getContext());
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;
icon.setLayoutParams(llIconParams);
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) {
TextView textView = new TextView(ll.getContext());
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.setTextSize(TypedValue.COMPLEX_UNIT_PX, gpxTextSize);
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);
nameEditText.setText(displayedName);
nameEditText.setTextColor(ContextCompat.getColor(getContext(), textPrimaryColor));
if (textBox instanceof OsmandTextFieldBoxes) {
((OsmandTextFieldBoxes) textBox).activate(true);
}
mainView.findViewById(R.id.save_button).setOnClickListener(new View.OnClickListener() {
@Override

View file

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

View file

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

View file

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

View file

@ -440,7 +440,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
divider.setLayoutParams(p);
} else {
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);
}
}

View file

@ -3,8 +3,8 @@ package net.osmand.plus.settings.bottomsheets;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -51,9 +51,9 @@ public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet {
editText = view.findViewById(R.id.edit_text);
editText.setText(text);
RelativeLayout editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout);
if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) editTextLayout.getLayoutParams();
ViewGroup editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout);
if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) editTextLayout.getLayoutParams();
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.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;
public class OsmandTextFieldBoxes extends TextFieldBoxes {
private boolean useOsmandKeyboard;
public OsmandTextFieldBoxes(Context context) {
super(context);
}
@ -28,83 +19,4 @@ public class OsmandTextFieldBoxes extends TextFieldBoxes {
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);
}
}