Merge pull request #9403 from osmandapp/Material_migration

Material theme
This commit is contained in:
Vitaliy 2020-08-11 13:27:43 +03:00 committed by GitHub
commit 265dd9064a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 183 additions and 232 deletions

View file

@ -147,7 +147,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/map_transparency_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="@dimen/map_trans_seek_size"
android:layout_height="wrap_content"
android:layout_gravity="center"/>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:osmand="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:id="@+id/move_marker_bottom_sheet"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
@ -17,7 +16,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/content_padding"
osmand:srcCompat="@drawable/ic_action_photo_dark"/>
osmand:srcCompat="@drawable/ic_action_photo_dark" />
<LinearLayout
android:layout_weight="1"
@ -57,7 +56,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/shared_string_apply"/>
android:text="@string/shared_string_apply" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/cancel_button"

View file

@ -58,17 +58,23 @@
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding_small">
<Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/create_button"
style="@style/DialogActionButton"
android:layout_marginRight="@dimen/content_padding_half"
android:text="@string/shared_string_add"
android:layout_marginEnd="@dimen/content_padding_half" />
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/shared_string_add" />
<Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/cancel_button"
style="@style/DialogCancelButton"
android:text="@string/shared_string_cancel"/>
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:text="@string/shared_string_cancel" />
</LinearLayout>

View file

@ -82,7 +82,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/speed_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_small"

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dialog_content_margin"
android:layout_marginTop="@dimen/content_padding"
@ -18,12 +18,12 @@
<LinearLayout
android:id="@+id/layout_animate_gpx"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dialog_content_margin"
android:layout_marginTop="@dimen/map_small_button_margin"
@ -36,7 +36,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/Speedup"
style="@style/Widget.Styled.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dialog_content_margin"
@ -46,7 +45,7 @@
android:layout_marginEnd="@dimen/content_padding" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dialog_content_margin"
android:layout_marginTop="@dimen/map_small_button_margin"

View file

@ -36,7 +36,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/slider"
style="@style/Widget.Styled.Slider"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_width="match_parent"

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
@ -12,7 +12,7 @@
<TextView
android:text="@string/select_max_zoom_preload_area"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:layout_marginLeft="10dp"
@ -23,8 +23,7 @@
<com.google.android.material.slider.Slider
android:id="@+id/ZoomToDownload"
style="@style/Widget.Styled.Slider"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:stepSize="1"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
@ -34,7 +33,7 @@
android:layout_marginStart="@dimen/content_padding" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
@ -70,12 +69,12 @@
android:id="@+id/DownloadDescription"
android:layout_marginTop="@dimen/content_padding_small"
android:textColor="?android:textColorSecondary"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"

View file

@ -18,6 +18,7 @@
android:gravity="start|center_vertical"
android:textSize="@dimen/default_list_text_size"
android:textAllCaps="false"
android:textColor="?attr/textColorAlertDialogListItem"
android:paddingStart="10dp"
android:paddingEnd="10dp" />

View file

@ -90,10 +90,13 @@
android:layout_weight="1"
android:layout_marginStart="24dp">
<AutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/poiTypeEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/wpt_list_item_height"
android:gravity="bottom|start"
android:paddingBottom="@dimen/text_margin_small"
android:completionThreshold="1"
app:drawableRightCompat="@drawable/ic_action_arrow_drop_down"
app:drawableEndCompat="@drawable/ic_action_arrow_drop_down"

View file

@ -152,7 +152,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/transparency_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/list_header_settings_top_margin"
@ -232,7 +231,6 @@
<com.google.android.material.slider.RangeSlider
android:id="@+id/zoom_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"

View file

@ -2,7 +2,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:descendantFocusability="blocksDescendants"
@ -35,7 +35,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/slider"
style="@style/Widget.Styled.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"

View file

@ -72,7 +72,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/map_transparency_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="@dimen/map_trans_seek_size"
android:layout_height="wrap_content"
android:layout_gravity="center"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:osmand="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:id="@+id/move_marker_bottom_sheet"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
@ -17,7 +16,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/content_padding"
osmand:srcCompat="@drawable/ic_action_photo_dark"/>
osmand:srcCompat="@drawable/ic_action_photo_dark" />
<LinearLayout
android:layout_width="match_parent"
@ -57,19 +56,25 @@
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding_small">
<Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/apply_button"
style="@style/DialogActionButton"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/content_padding_half"
android:text="@string/shared_string_apply"
android:layout_marginEnd="@dimen/content_padding_half" />
<Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/cancel_button"
style="@style/DialogCancelButton"
android:text="@string/shared_string_cancel"/>
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/content_padding"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding"
android:text="@string/shared_string_cancel" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -37,7 +37,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/slider"
style="@style/Widget.Styled.Slider"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_width="match_parent"

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -17,11 +16,14 @@
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding">
<AutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/tagEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/wpt_list_item_height"
android:hint="@string/hint_tag"
android:gravity="bottom"
android:paddingBottom="@dimen/text_margin_small"
tools:text="Tag text"/>
</com.google.android.material.textfield.TextInputLayout>
@ -31,11 +33,15 @@
android:layout_height="wrap_content"
android:layout_weight="1">
<AutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/valueEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_value"/>
android:minHeight="@dimen/wpt_list_item_height"
android:gravity="bottom"
android:paddingBottom="@dimen/text_margin_small"
android:hint="@string/hint_value"
tools:text="Value text"/>
</com.google.android.material.textfield.TextInputLayout>

View file

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:theme="?attr/new_app_theme">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -17,12 +15,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:minHeight="56dp"
android:minHeight="@dimen/wpt_list_item_height"
android:orientation="horizontal">
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
@ -84,10 +82,13 @@
android:layout_weight="1"
android:layout_marginStart="@dimen/content_padding">
<AutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/poiTypeEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/wpt_list_item_height"
android:gravity="bottom"
android:paddingBottom="@dimen/text_margin_small"
android:completionThreshold="1"
osmand:drawableTint="@color/osmand_orange"
osmand:drawableRightCompat="@drawable/ic_action_arrow_drop_down"
@ -95,17 +96,15 @@
android:hint="@string/poi_dialog_poi_type"
android:imeOptions="actionSend"
android:inputType="text"
android:layout_marginLeft="-4dp"
tools:text="@string/lorem_ipsum"
android:layout_marginStart="-4dp" />
tools:text="@string/lorem_ipsum" />
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/onlineDocumentationButton"
android:contentDescription="@string/shared_string_help"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/dashboard_parking_icon_size"
android:layout_height="@dimen/dashboard_parking_icon_size"
android:layout_gravity="bottom"
android:background="@null"
osmand:srcCompat="@drawable/ic_action_help"/>

View file

@ -120,7 +120,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/angle_slider"
style="@style/Widget.Styled.Slider"
android:valueTo="90"
android:stepSize="5"
android:layout_width="match_parent"

View file

@ -105,7 +105,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activity_background_color"
android:theme="?attr/search_tabbar_layout_theme"
style="?attr/search_tabbar_layout_theme"
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabMode="fixed"/>

View file

@ -6,7 +6,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/slider"
style="@style/Widget.Styled.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

View file

@ -96,7 +96,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/split_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"

View file

@ -95,7 +95,6 @@
<com.google.android.material.slider.Slider
android:id="@+id/width_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"

View file

@ -73,7 +73,6 @@
<com.google.android.material.slider.RangeSlider
android:id="@+id/zoom_slider"
style="@style/Widget.Styled.Slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"

View file

@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Dialog_Fullscreen" parent="android:Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/color_transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<!-- Dashboard styles -->
<style name="DashboardSubHeader">
<item name="android:layout_width">0dp</item>
@ -36,18 +28,6 @@
<item name="android:background">?attr/dashboard_button</item>
</style>
<style name="DashboardSearchButton">
<item name="android:paddingTop">@dimen/dashSearchPaddingTop</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_weight">1</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textSize">@dimen/default_sub_text_size</item>
<item name="android:gravity">bottom|center_horizontal</item>
<item name="android:paddingBottom">@dimen/dashSearchPaddingBot</item>
<item name="android:background">?attr/dashboard_button</item>
</style>
<style name="DialogActionButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
@ -60,18 +40,6 @@
<item name="android:background">?attr/btn_round</item>
</style>
<style name="DialogCancelButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minHeight">@dimen/dialog_button_height</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:textColor">?attr/contextMenuButtonColor</item>
<item name="android:background">?attr/selectableItemBackground</item>
</style>
<style name="FirstSplashScreenCustom" parent="OsmandLightTheme.NoActionbar">
<item name="android:windowBackground">@drawable/first_splash_screen_free</item>
</style>
@ -88,43 +56,14 @@
<item name="android:windowBackground">@drawable/first_splash_screen_free_dev</item>
</style>
<style name="OsmandTextFieldBoxes" parent="OsmandDarkTheme">
<item name="android:textColorTertiary">@color/white_50_transparent</item>
<item name="primaryColor">@color/white_50_transparent</item>
<item name="errorColor">@color/coordinate_input_error_color</item>
</style>
<style name="OsmandLightThemeWithLightStatusBar" parent="OsmandLightTheme">
<item name="android:statusBarColor">@color/status_bar_route_light</item>
</style>
<style name="TextAppearance.App.DarkTextInputLayout" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/active_color_primary_dark</item>
</style>
<style name="OsmandMaterialLightTheme" parent="Theme.MaterialComponents.Light">
<item name="colorPrimary">@color/active_color_primary_light</item>
<item name="dashboard_divider">@color/divider_color_light</item>
<item name="divider_color">@color/divider_color</item>
<item name="android:textColorPrimary">@color/text_color_primary_light</item>
<item name="android:textColorSecondary">@color/text_color_secondary_light</item>
</style>
<style name="OsmandMaterialDarkTheme" parent="Theme.MaterialComponents">
<item name="colorPrimary">@color/active_color_primary_dark</item>
<item name="dashboard_divider">@color/divider_color_dark</item>
<item name="divider_color">@color/divider_color_dark</item>
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
</style>
<!-- MaterialComponents Widgets override -->
<style name="Widget.Styled.Slider" parent="Widget.MaterialComponents.Slider">
<item name="android:theme">@style/Theme.MaterialComponents</item>
</style>
<!-- Osmand themes styles -->
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
<style name="OsmandLightTheme" parent="Theme.MaterialComponents.Light">
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
<item name="buttonStyle">@style/Widget.AppCompat.Button.Colored</item>
<item name="bottom_bar_background_color">@color/bottom_bar_background_color_light</item>
<item name="android:textDirection">locale</item>
<item name="android:statusBarColor">@color/status_bar_color_light</item>
@ -188,6 +127,7 @@
<item name="dashboard_general_button_text_color">@color/active_color_primary_light</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item>
<item name="android:textColor">@color/text_color_primary_light</item>
<item name="android:textColorPrimary">@color/text_color_primary_light</item>
<item name="android:textColorSecondary">@color/text_color_secondary_light</item>
<item name="android:textColorTertiary">@color/text_color_tertiary_light</item>
@ -196,7 +136,7 @@
<item name="spinnerListBackground">@color/spinner_list_background_light</item>
<item name="colorButtonNormal">@color/color_white</item>
<item name="colorPrimary">@color/osmand_orange</item>
<item name="colorPrimary">@color/active_color_primary_light</item>
<item name="colorPrimaryDark">@color/osmand_orange_dark</item>
<item name="colorAccent">@color/active_color_primary_light</item>
@ -343,8 +283,9 @@
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
</style>
<style name="OsmandLightTheme.SearchTabbar">
<style name="OsmandLightTheme.SearchTabbar" parent="Widget.MaterialComponents.TabLayout">
<item name="android:textColorPrimary">@color/osmand_orange</item>
<item name="tabTextColor">@color/osmand_orange</item>
<item name="colorAccent">@color/osmand_orange</item>
<item name="android:textColorSecondary">@color/text_color_secondary_light</item>
<item name="android:textColorHint">@color/text_color_secondary_light</item>
@ -371,8 +312,10 @@
<item name="colorAccent">@color/color_white</item>
</style>
<style name="OsmandDarkTheme.SearchTabbar">
<style name="OsmandDarkTheme.SearchTabbar" parent="Widget.MaterialComponents.TabLayout">
<item name="android:textColorPrimary">@color/osmand_orange</item>
<item name="tabIndicatorColor">@color/osmand_orange</item>
<item name="tabTextColor">@color/osmand_orange</item>
<item name="colorAccent">@color/osmand_orange</item>
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
<item name="android:textColorHint">@color/text_color_secondary_dark</item>
@ -420,7 +363,7 @@
<item name="colorControlNormal">?attr/coordinate_input_edit_text_normal</item>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
<style name="OsmandDarkTheme" parent="Theme.MaterialComponents">
<item name="bottom_bar_background_color">@color/bottom_bar_background_color_dark</item>
<item name="android:textDirection">locale</item>
<item name="android:statusBarColor">@color/status_bar_color_dark</item>
@ -478,6 +421,7 @@
<item name="dashboard_general_button_text_color">@color/active_color_primary_dark</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item>
<item name="android:textColor">@color/text_color_primary_dark</item>
<item name="android:textColorPrimary">@color/text_color_primary_dark</item>
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
<item name="android:textColorTertiary">@color/text_color_tertiary_dark</item>
@ -501,6 +445,8 @@
<item name="search_tabbar_layout_theme">@style/OsmandDarkTheme.SearchTabbar</item>
<item name="toolbar_theme">@style/OsmandDarkTheme</item>
<item name="new_app_theme">@style/OsmandDarkTheme</item>
<item name="colorPrimary">@color/active_color_primary_dark</item>
<item name="colorAccent">@color/active_color_primary_dark</item>
<item name="contextMenuButtonColor">@color/osmand_orange</item>

View file

@ -36,6 +36,7 @@ import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.ListPopupWindow;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
@ -547,6 +548,19 @@ public class UiUtilities {
compoundButton.setBackgroundColor(Color.TRANSPARENT);
}
public static void setupToolbarOverflowIcon(Toolbar toolbar, @DrawableRes int iconId, @ColorRes int colorId) {
Context ctx = toolbar.getContext();
if (ctx != null) {
Drawable icon = ContextCompat.getDrawable(ctx, iconId);
toolbar.setOverflowIcon(icon);
if (icon != null) {
int color = ContextCompat.getColor(ctx, colorId);
DrawableCompat.setTint(icon.mutate(), color);
toolbar.setOverflowIcon(icon);
}
}
}
public static ViewGroup createSliderView(@NonNull Context ctx, boolean nightMode) {
return (ViewGroup) getInflater(ctx, nightMode).inflate(R.layout.slider, null, false);
}
@ -692,14 +706,6 @@ public class UiUtilities {
}
}
public static LayoutInflater getMaterialInflater(Context ctx, boolean nightMode) {
return LayoutInflater.from(getThemedMaterialContext(ctx, nightMode));
}
private static Context getThemedMaterialContext(Context context, boolean nightMode) {
return getThemedContext(context, nightMode, R.style.OsmandMaterialLightTheme, R.style.OsmandMaterialDarkTheme);
}
public static LayoutInflater getInflater(Context ctx, boolean nightMode) {
return LayoutInflater.from(getThemedContext(ctx, nightMode));
}

View file

@ -130,7 +130,6 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
}
protected class PluginsListAdapter extends ArrayAdapter<Object> {
PluginsListAdapter() {
super(PluginsActivity.this, R.layout.plugins_list_item, new ArrayList<>());
addAll(getMyApplication().getAidlApi().getConnectedApps());
@ -193,7 +192,7 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex
AndroidUtils.removeLinkUnderline(pluginDescription);
OsmandApplication app = getMyApplication();
int color = AndroidUtils.getColorFromAttr(app, R.attr.list_background_color);
int color = AndroidUtils.getColorFromAttr(PluginsActivity.this, R.attr.list_background_color);
pluginLogo.setImageDrawable(UiUtilities.tintDrawable(plugin.getLogoResource(), color));
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -600,8 +600,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j);
if (j + 1 >= max && optionsMenuAdapter.length() > max) {
if (split == null) {
Drawable icOverflowMenu = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white);
split = menu.addSubMenu(0, 1, j + 1, R.string.shared_string_more_actions);
split.setIcon(R.drawable.ic_overflow_menu_white);
split.setIcon(icOverflowMenu);
split.getItem();
MenuItemCompat.setShowAsAction(split.getItem(), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}

View file

@ -8,6 +8,7 @@ import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.app.ActionBar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
@ -45,7 +46,8 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
@Override
protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this);
OsmandApplication app = getMyApplication();
app.applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_livie_updates);
@ -69,6 +71,13 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
getLastUpdateDateTask = new GetLastUpdateDateTask(this);
getLastUpdateDateTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
boolean nightMode = !app.getSettings().isLightContent();
int normalTabColor = ContextCompat.getColor(app,
nightMode ? R.color.searchbar_tab_inactive_dark : R.color.searchbar_tab_inactive_light);
int selectedTabColor = ContextCompat.getColor(app,
nightMode ? R.color.text_color_tab_active_dark : R.color.text_color_tab_active_light);
tabLayout.setTabTextColors(normalTabColor, selectedTabColor);
}
@Override

View file

@ -3,11 +3,9 @@ package net.osmand.plus.liveupdates;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@ -21,8 +19,6 @@ import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
@ -205,9 +201,9 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
};
monthReportsSpinner.setOnItemSelectedListener(onItemSelectedListener);
inactiveColor = getColorFromAttr(R.attr.plugin_details_install_header_bg);
textColorPrimary = getColorFromAttr(android.R.attr.textColorPrimary);
textColorSecondary = getColorFromAttr(android.R.attr.textColorSecondary);
inactiveColor = AndroidUtils.getColorFromAttr(container.getContext(), R.attr.plugin_details_install_header_bg);
textColorPrimary = AndroidUtils.getColorFromAttr(container.getContext(), android.R.attr.textColorPrimary);
textColorSecondary = AndroidUtils.getColorFromAttr(container.getContext(), android.R.attr.textColorSecondary);
return view;
}
@ -427,12 +423,4 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
donationsTotalTextView.setTextColor(textColorPrimary);
recipientsTextView.setTextColor(textColorPrimary);
}
@ColorInt
private int getColorFromAttr(@AttrRes int colorAttribute) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = getActivity().getTheme();
theme.resolveAttribute(colorAttribute, typedValue, true);
return typedValue.data;
}
}

View file

@ -101,7 +101,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
app = requireMyApplication();
nightMode = app.getDaynightHelper().isNightModeForMapControls();
view = UiUtilities.getMaterialInflater(getContext(), nightMode)
view = UiUtilities.getInflater(getContext(), nightMode)
.inflate(R.layout.point_editor_fragment_new, container, false);
AndroidUtils.addStatusBarPadding21v(getActivity(), view);

View file

@ -142,7 +142,8 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
sqliteDB = savedInstanceState.getBoolean(SQLITE_DB_KEY);
fromTemplate = savedInstanceState.getBoolean(FROM_TEMPLATE_KEY);
}
View root = UiUtilities.getMaterialInflater(requireContext(), nightMode).inflate(R.layout.fragment_edit_map_source, container, false);
View root = UiUtilities.getInflater(requireContext(), nightMode)
.inflate(R.layout.fragment_edit_map_source, container, false);
Toolbar toolbar = root.findViewById(R.id.toolbar);
toolbar.setBackgroundColor(ContextCompat.getColor(app, nightMode ? R.color.app_bar_color_dark : R.color.app_bar_color_light));
toolbar.setTitleTextColor(ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light));
@ -491,7 +492,7 @@ public class EditMapSourceDialogFragment extends BaseOsmAndDialogFragment
}
private void addConfigurationItems(ConfigurationItem... items) {
LayoutInflater inflater = UiUtilities.getMaterialInflater(app, nightMode);
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
for (ConfigurationItem item : items) {
View view = inflater.inflate(R.layout.list_item_ui_customization, null);
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(app.getUIUtilities().getIcon(item.iconRes, nightMode));

View file

@ -51,7 +51,7 @@ public class ExpireTimeBottomSheet extends MenuBottomSheetDialogFragment {
if (savedInstanceState != null) {
expireValue = savedInstanceState.getInt(EXPIRE_VALUE_KEY, EXPIRE_TIME_NEVER);
}
LayoutInflater inflater = UiUtilities.getMaterialInflater(getContext(), nightMode);
LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode);
TitleItem titleItem = new TitleItem(getString(R.string.expire_time));
items.add(titleItem);
final View inputValueLayout = inflater.inflate(R.layout.edit_text_with_descr, null);

View file

@ -6,7 +6,6 @@ import android.content.DialogInterface;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.StyleSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
@ -81,7 +80,7 @@ public class InputZoomLevelsBottomSheet extends MenuBottomSheetDialogFragment {
sliderDescrRes = savedInstanceState.getInt(SLIDER_DESCR_RES_KEY);
newMapSource = savedInstanceState.getBoolean(NEW_MAP_SOURCE);
}
LayoutInflater inflater = UiUtilities.getMaterialInflater(app, nightMode);
LayoutInflater inflater = UiUtilities.getInflater(app, nightMode);
TitleItem titleItem = new TitleItem(getString(R.string.shared_string_zoom_levels));
items.add(titleItem);
final View sliderView = inflater.inflate(R.layout.zoom_levels_with_descr, null);

View file

@ -988,7 +988,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
categoryName = getString(R.string.shared_string_waypoints);
}
SpannableStringBuilder text = new SpannableStringBuilder(categoryName).append(" (").append(String.valueOf(getChildrenCount(groupPosition))).append(")");
text.setSpan(new ForegroundColorSpan(AndroidUtils.getColorFromAttr(app, R.attr.wikivoyage_primary_text_color)),
text.setSpan(new ForegroundColorSpan(AndroidUtils.getColorFromAttr(mainView.getContext(), R.attr.wikivoyage_primary_text_color)),
0, categoryName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
text.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.wikivoyage_secondary_text)),
categoryName.length() + 1, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

View file

@ -7,7 +7,6 @@ import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnFocusChangeListener;
@ -23,7 +22,8 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import net.osmand.AndroidUtils;
import com.google.android.material.textfield.MaterialAutoCompleteTextView;
import net.osmand.PlatformUtil;
import net.osmand.osm.AbstractPoiType;
import net.osmand.osm.MapPoiTypes;
@ -215,9 +215,7 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
public void addTagView(String tg, String vl) {
View convertView = LayoutInflater.from(linearLayout.getContext())
.inflate(R.layout.poi_tag_list_item, null, false);
final AutoCompleteTextView tagEditText =
(AutoCompleteTextView) convertView.findViewById(R.id.tagEditText);
AndroidUtils.setTextHorizontalGravity(tagEditText, Gravity.START);
final MaterialAutoCompleteTextView tagEditText = convertView.findViewById(R.id.tagEditText);
ImageButton deleteItemImageButton =
(ImageButton) convertView.findViewById(R.id.deleteItemImageButton);
deleteItemImageButton.setImageDrawable(deleteDrawable);
@ -229,10 +227,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
editPoiData.removeTag(tagEditText.getText().toString());
}
});
final AutoCompleteTextView valueEditText =
(AutoCompleteTextView) convertView.findViewById(R.id.valueEditText);
AndroidUtils.setTextHorizontalGravity(valueEditText, Gravity.START);
valueEditText.setFilters(new InputFilter[] {
final MaterialAutoCompleteTextView valueEditText = convertView.findViewById(R.id.valueEditText);
valueEditText.setFilters(new InputFilter[]{
new InputFilter.LengthFilter(AMENITY_TEXT_LENGTH)
});
tagEditText.setText(tg);

View file

@ -64,7 +64,7 @@ public class VehicleParametersBottomSheet extends BasePreferenceBottomSheet {
@SuppressLint("ClickableViewAccessibility")
private BaseBottomSheetItem createBottomSheetItem(OsmandApplication app) {
final SizePreference preference = (SizePreference) getPreference();
View mainView = UiUtilities.getMaterialInflater(getContext(), nightMode)
View mainView = UiUtilities.getInflater(getContext(), nightMode)
.inflate(R.layout.bottom_sheet_item_edit_with_recyclerview, null);
TextView title = mainView.findViewById(R.id.title);
title.setText(preference.getTitle().toString());

View file

@ -933,7 +933,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
public void setupPrefRoundedBg(PreferenceViewHolder holder) {
View selectableView = holder.itemView.findViewById(R.id.selectable_list_item);
if (selectableView != null) {
int color = AndroidUtils.getColorFromAttr(app, R.attr.activity_background_color);
int color = AndroidUtils.getColorFromAttr(holder.itemView.getContext(), R.attr.activity_background_color);
int selectedColor = UiUtilities.getColorWithAlpha(getActiveProfileColor(), 0.3f);
Drawable bgDrawable = getPaintedIcon(R.drawable.rectangle_rounded, color);

View file

@ -79,7 +79,7 @@ public class CustomColorBottomSheet extends MenuBottomSheetDialogFragment implem
}
private View createPickerView() {
LayoutInflater themedInflater = UiUtilities.getMaterialInflater(getActivity(), nightMode);
LayoutInflater themedInflater = UiUtilities.getInflater(getActivity(), nightMode);
View colorView = themedInflater.inflate(R.layout.custom_color_picker, null);
colorPicker = colorView.findViewById(R.id.color_picker_view);
newColorPanel = colorView.findViewById(R.id.color_panel_new);

View file

@ -30,6 +30,7 @@ import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.TrackActivity;
@ -442,8 +443,9 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
@Override
protected void setupToolbar(Toolbar toolbar) {
super.setupToolbar(toolbar);
toolbar.setOverflowIcon(getIcon(R.drawable.ic_overflow_menu_white, R.color.icon_color_default_light));
UiUtilities.setupToolbarOverflowIcon(
toolbar, R.drawable.ic_overflow_menu_white, R.color.icon_color_default_light);
Menu menu = toolbar.getMenu();
MenuItem.OnMenuItemClickListener itemClickListener = new MenuItem.OnMenuItemClickListener() {
@Override