Merge pull request #8608 from osmandapp/FixRTL2

Fix RTL
This commit is contained in:
max-klaus 2020-03-04 16:05:59 +03:00 committed by GitHub
commit 95e6ae72b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 409 additions and 304 deletions

View file

@ -10,90 +10,106 @@
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: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>
</android.support.v7.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"
@ -50,7 +52,7 @@
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Category name"
android:layout_marginStart="@dimen/list_content_padding" />
android:layout_marginStart="@dimen/list_content_padding" />
<ImageView
android:id="@+id/options"
@ -65,7 +67,7 @@
android:src="@drawable/ic_overflow_menu_white"
android:visibility="gone"
tools:visiblity="visible"
android:layout_marginEnd="4dp" />
android:layout_marginEnd="4dp" />
<ImageView
android:id="@+id/explist_indicator"
@ -74,7 +76,7 @@
android:scaleType="center"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginEnd="@dimen/list_content_padding" />
android:layout_marginEnd="@dimen/list_content_padding" />
</LinearLayout>

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" />
<android.support.v7.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" />
<android.support.v7.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">
<android.support.v7.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.support.v7.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" -->
<android.support.v7.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">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/icon_settings"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/shared_string_settings"
android:focusable="false"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible" />
<!-- android:button="@drawable/ic_btn_wocheckbox" -->
<android.support.v7.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,34 +1,36 @@
<?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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/local_index_check_right_margin"
android:layout_marginEnd="@dimen/local_index_check_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:layout_marginEnd="@dimen/local_index_check_right_margin"
android:layout_marginRight="@dimen/local_index_check_right_margin"
android:focusable="false"
android:visibility="gone"/>
android:visibility="gone" />
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:focusable="false"
android:src="@drawable/ic_gpx_track"/>
android:src="@drawable/ic_gpx_track" />
<LinearLayout
android:layout_width="0dp"
@ -43,7 +45,7 @@
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Bangladesh"/>
tools:text="Bangladesh" />
<LinearLayout
@ -55,11 +57,11 @@
android:id="@+id/descriptionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="7dp"
android:layout_marginEnd="7dp"
android:layout_marginRight="7dp"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="12.34 Mb * 10/4/2015"/>
tools:text="12.34 Mb * 10/4/2015" />
</LinearLayout>
@ -67,11 +69,11 @@
<ImageButton
android:id="@+id/options"
android:contentDescription="@string/shared_string_more"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_more"
android:focusable="false"
android:src="@drawable/ic_overflow_menu_white"/>
android:src="@drawable/ic_overflow_menu_white" />
</LinearLayout>

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

@ -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">
<android.support.v7.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">
<android.support.v7.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" />
<android.support.v7.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

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

@ -47,6 +47,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;
@ -60,6 +61,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;
@ -643,12 +645,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

@ -202,7 +202,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());
}
@ -213,7 +212,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));
@ -340,7 +339,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

@ -79,7 +79,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

@ -15,6 +15,7 @@ import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
@ -38,6 +39,7 @@ import net.osmand.data.LatLon;
import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.widgets.TextViewEx;
import java.util.ArrayList;
import java.util.Locale;
import gnu.trove.map.hash.TLongObjectHashMap;
@ -386,11 +388,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

@ -173,8 +173,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);
title.setHint(R.string.shared_string_search);
Drawable searchIcon = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark);
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(title, searchIcon, null, null, null);
searchView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -344,6 +344,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

@ -533,20 +533,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()) {
@ -560,22 +560,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

@ -619,7 +619,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

@ -627,8 +627,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

@ -561,7 +561,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);
@ -574,7 +574,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);
@ -583,7 +583,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);
@ -597,7 +597,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);
@ -628,7 +629,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);
@ -642,7 +643,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);
@ -661,7 +662,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);
@ -826,7 +827,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)));
@ -850,7 +851,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));
@ -914,12 +915,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);
@ -942,7 +943,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);
@ -961,14 +962,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));
@ -1036,7 +1037,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);
@ -1073,7 +1074,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;
@ -1086,7 +1087,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));
@ -1101,7 +1102,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

@ -134,7 +134,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);
@ -151,7 +151,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));
@ -163,7 +163,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);
@ -199,7 +199,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) {
@ -217,7 +217,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);
@ -247,7 +247,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

@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
@ -64,7 +65,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));
@ -74,7 +75,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

@ -23,7 +23,6 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.LockableViewPager;

View file

@ -9,7 +9,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.UiUtilities;

View file

@ -231,27 +231,30 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View view;
RecyclerView.ViewHolder viewHolder;
if (viewType == MARKER_TYPE) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_new, viewGroup, false);
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_new, viewGroup, false);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onItemClick(view);
}
});
return new MapMarkerItemViewHolder(view);
viewHolder = new MapMarkerItemViewHolder(view);
} else if (viewType == HEADER_TYPE) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_header, viewGroup, false);
return new MapMarkerHeaderViewHolder(view);
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_header, viewGroup, false);
viewHolder = new MapMarkerHeaderViewHolder(view);
} else if (viewType == SHOW_HIDE_HISTORY_TYPE) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_show_hide_history, viewGroup, false);
return new MapMarkersShowHideHistoryViewHolder(view);
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_show_hide_history, viewGroup, false);
viewHolder = new MapMarkersShowHideHistoryViewHolder(view);
} else if (viewType == CATEGORIES_TYPE) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_subheader, viewGroup, false);
return new MapMarkerCategoriesViewHolder(view);
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_subheader, viewGroup, false);
viewHolder = new MapMarkerCategoriesViewHolder(view);
} else {
throw new IllegalArgumentException("Unsupported view type");
}
return viewHolder;
}
@Override

View file

@ -7,7 +7,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.MapMarkersHelper.MapMarker;
@ -93,21 +92,24 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View view;
RecyclerView.ViewHolder viewHolder;
if (viewType == MARKER_TYPE) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_new, viewGroup, false);
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_new, viewGroup, false);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onItemClick(view);
}
});
return new MapMarkerItemViewHolder(view);
viewHolder = new MapMarkerItemViewHolder(view);
} else if (viewType == HEADER_TYPE) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_header, viewGroup, false);
return new MapMarkerHeaderViewHolder(view);
view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_header, viewGroup, false);
viewHolder = new MapMarkerHeaderViewHolder(view);
} else {
throw new IllegalArgumentException("Unsupported view type");
}
return viewHolder;
}
@Override

View file

@ -97,7 +97,6 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

View file

@ -422,28 +422,36 @@ public class RearrangePoiFiltersFragment extends DialogFragment {
LayoutInflater inflater = UiUtilities.getInflater(ctx, nightMode);
ItemType type = viewTypeId < ItemType.values().length ? ItemType.values()[viewTypeId] : SPACE;
View itemView;
RecyclerView.ViewHolder viewHolder;
switch (type) {
case POI:
itemView = inflater.inflate(R.layout.order_poi_list_item, parent, false);
return new PoiViewHolder(itemView);
viewHolder = new PoiViewHolder(itemView);
break;
case SPACE:
itemView = new View(ctx);
return new SpaceViewHolder(itemView);
viewHolder = new SpaceViewHolder(itemView);
break;
case BUTTON:
itemView = inflater.inflate(R.layout.preference_button, parent, false);
return new ButtonViewHolder(itemView);
viewHolder = new ButtonViewHolder(itemView);
break;
case HEADER:
itemView = inflater.inflate(R.layout.preference_category_with_descr, parent, false);
return new HeaderViewHolder(itemView);
viewHolder = new HeaderViewHolder(itemView);
break;
case DIVIDER:
itemView = inflater.inflate(R.layout.divider, parent, false);
return new DividerViewHolder(itemView);
viewHolder = new DividerViewHolder(itemView);
break;
case DESCRIPTION:
itemView = inflater.inflate(R.layout.bottom_sheet_item_description_long, parent, false);
return new DescriptionViewHolder(itemView);
viewHolder = new DescriptionViewHolder(itemView);
break;
default:
throw new IllegalArgumentException("Unsupported view type");
}
return viewHolder;
}
@SuppressLint("ClickableViewAccessibility")

View file

@ -330,18 +330,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

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

View file

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