[android] refactor: Hardcoded colors replaced with themes.

This commit is contained in:
Alexander Marchuk 2015-12-18 15:08:25 +03:00 committed by Constantin Shalnev
parent 4d31757f36
commit 280b1c9dd2
52 changed files with 667 additions and 300 deletions

View file

@ -170,7 +170,6 @@
<activity
android:name="com.mapswithme.maps.MwmActivity"
android:launchMode="singleTask"
android:theme="@style/MwmTheme.MainActivity"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"/>
<activity

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/routing_start_night"
android:state_enabled="true"/>
<item android:color="@color/routing_start_disabled_night"/>
</selector>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/base_blue_light"
<item android:color="@color/base_accent"
android:state_selected="true"/>
<item android:color="@color/text_dark_subtitle"/>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/base_accent_night"
android:state_selected="true"/>
<item android:color="@color/text_light_subtitle"/>
</selector>

View file

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

View file

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/routing_start_pressed_night">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/routing_start_button_night"/>
<corners android:radius="2dp"/>
</shape>
</item>
</ripple>

View file

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

View file

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

View file

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

View file

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/margin_base_plus"/>
<solid android:color="@color/base_black_hint"/>
<solid android:color="@color/text_dark_subtitle"/>
</shape>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/routing_slot_background_pressed_night"
android:state_pressed="true"/>
<item android:drawable="@drawable/routing_slot_background_normal_night"/>
</selector>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/routing_slot_background_night"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="2dp"/>
<solid android:color="@color/routing_slot_background_pressed_night"/>
</shape>

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp"/>
<solid android:color="@color/routing_blue"/>
<solid android:color="@color/base_accent"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp"/>
<solid android:color="@color/base_accent_night"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/routing_start_disabled_night"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/routing_start_button_pressed_night"
android:state_pressed="true"/>
<item android:drawable="@drawable/routing_start_button_normal_night"
android:state_enabled="true"/>
<item android:drawable="@drawable/routing_start_button_disabled_night"/>
</selector>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/routing_start_night"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/routing_start_pressed_night"/>
<corners android:radius="2dp"/>
</shape>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="4dp"/>
<solid android:color="@color/text_light_hint"/>
</shape>

View file

@ -25,7 +25,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/divider_top"
android:background="@color/base_bg_secondary"
android:background="@color/bg_secondary"
android:listSelector="?attr/clickableBackground"
android:drawSelectorOnTop="true"/>

View file

@ -23,7 +23,7 @@
layout="@layout/item_country_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/base_bg_secondary"/>
android:background="@color/bg_secondary"/>
<View
android:layout_width="match_parent"

View file

@ -1,63 +1,61 @@
<?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:id="@+id/container_search"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
tools:background="#FF004F00">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container_search"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal">
<EditText
android:id="@+id/query"
style="@style/MwmTextAppearance.Toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search"
android:imeOptions="actionSearch|flagNoExtractUi"
android:inputType="text"
android:padding="@dimen/margin_quarter"
android:singleLine="true"
android:textCursorDrawable="@drawable/cursor_drawable"
tools:ignore="UnusedAttribute"/>
android:id="@+id/query"
style="@style/MwmTextAppearance.Toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search"
android:imeOptions="actionSearch|flagNoExtractUi"
android:inputType="text"
android:padding="@dimen/margin_quarter"
android:singleLine="true"
android:textCursorDrawable="@drawable/cursor_drawable"
tools:ignore="UnusedAttribute"/>
<ProgressBar
android:id="@+id/progress"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="@dimen/search_progress_size"
android:layout_height="@dimen/search_progress_size"
android:layout_marginRight="@dimen/margin_half"
android:layout_weight="0"
android:background="@null"
android:minHeight="@dimen/search_progress_size"
android:minWidth="@dimen/search_progress_size"/>
android:id="@+id/progress"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="@dimen/search_progress_size"
android:layout_height="@dimen/search_progress_size"
android:layout_marginRight="@dimen/margin_half"
android:layout_weight="0"
android:background="@null"
android:minHeight="@dimen/search_progress_size"
android:minWidth="@dimen/search_progress_size"/>
<ImageView
android:id="@+id/clear"
android:layout_width="?actionBarSize"
android:layout_height="?actionBarSize"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:scaleType="center"
android:src="@drawable/ic_close_w"/>
android:id="@+id/clear"
android:layout_width="?actionBarSize"
android:layout_height="?actionBarSize"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:scaleType="center"
android:src="@drawable/ic_close_w"/>
<ImageView
android:id="@+id/voice_input"
android:layout_width="?actionBarSize"
android:layout_height="?actionBarSize"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:scaleType="center"
android:src="@drawable/ic_mic_white"
android:visibility="gone"
tools:visibility="visible"/>
android:id="@+id/voice_input"
android:layout_width="?actionBarSize"
android:layout_height="?actionBarSize"
android:layout_gravity="center_vertical"
android:layout_weight="0"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:scaleType="center"
android:src="@drawable/ic_mic_white"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="tabletLayout">false</bool>
</resources>

View file

@ -6,8 +6,7 @@
<!-- direction fragment -->
<dimen name="margin_direction_small">12dp</dimen>
<dimen name="margin_direction_big">80dp</dimen>
<dimen name="margin_direction_left">40dp</dimen>
<dimen name="margin_direction_top">32dp</dimen>
<dimen name="margin_direction_side">40dp</dimen>
<dimen name="margin_direction_mid">36dp</dimen>
<dimen name="margin_direction_around_center">40dp</dimen>
<dimen name="margin_direction_around_center">80dp</dimen>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="tabletLayout">true</bool>
</resources>

View file

@ -4,7 +4,6 @@
<attr name="wheelProgressColor" format="color"/>
<attr name="wheelSecondaryColor" format="color"/>
<attr name="wheelThickness" format="dimension"/>
<attr name="clickableBackground" format="reference"/>
<attr name="centerDrawable" format="reference" />
</declare-styleable>
@ -32,4 +31,5 @@
<!-- 10 inch tablet -->
<bool name="isBigTablet">false</bool>
<bool name="tabletLayout">false</bool>
</resources>

View file

@ -1,82 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- general text colors -->
<color name="text_darkest">#000000</color>
<!-- Text colors -->
<color name="text_dark">#DE000000</color>
<color name="text_dark_subtitle">#8A000000</color>
<color name="text_dark_hint">#42000000</color>
<color name="text_light">#DEFFFFFF</color>
<color name="text_light_subtitle">#8AFFFFFF</color>
<color name="text_light_hint">#42FFFFFF</color>
<color name="text_dark_hint">#61000000</color>
<color name="text_light">#FFFFFFFF</color>
<color name="text_light_subtitle">#B3FFFFFF</color>
<color name="text_light_hint">#4CFFFFFF</color>
<color name="text_green">#DE1F9952</color>
<color name="text_green_subtitle">#8A1F9952</color>
<color name="text_green_hint">#421F9952</color>
<color name="text_accent">#FF209852</color>
<color name="text_pp_accent">@color/base_accent</color>
<color name="text_pp_accent_night">#FF0288D1</color>
<!-- base colors -->
<!-- green tints -->
<color name="base_green">#209852</color>
<color name="base_green_darker">#188044</color>
<color name="base_green_darkest">#146636</color>
<color name="base_green_light">#24B460</color>
<color name="base_green_lightest">#28CC6C</color>
<!-- black tints -->
<color name="base_black">#DE000000</color>
<color name="base_black_hint">#8A000000</color>
<color name="base_black_divider">#1E000000</color>
<!-- other colors -->
<color name="base_blue_light">#1E96F0</color>
<color name="base_blue">#0569AF</color>
<color name="base_red">#F54137</color>
<color name="base_yellow">#FFCD00</color>
<color name="base_bg_secondary">#F5F5F5</color>
<color name="base_green">#FF209852</color>
<color name="base_green_darker">#FF188044</color>
<!-- TODO change all colors below, remove old ones-->
<color name="semitransparent_white">#99FFFFFF</color>
<color name="semitransparent_black">#60000000</color>
<color name="semitransparent_black_dark">#BB000000</color>
<color name="base_accent">#FF1E96F0</color>
<color name="base_accent_night">#FFFFE68C</color>
<color name="base_red">#FFF54137</color>
<color name="divider_standard">@color/base_black_divider</color>
<!-- TODO end of unfinished colors-->
<color name="divider">#1E000000</color>
<color name="divider_night">#1EFFFFFF</color>
<!-- place page -->
<color name="text_place_page">@color/text_dark</color>
<color name="text_place_page_subtitle">@color/text_dark_subtitle</color>
<color name="text_place_page_buttons">@color/text_dark_subtitle</color>
<color name="bg_place_page_buttons">@color/base_bg_secondary</color>
<!-- Backgrounds -->
<color name="bg_window">#FFFFFFFF</color>
<color name="bg_window_night">#FF161616</color>
<color name="bg_secondary">#FFF5F5F5</color>
<color name="bg_secondary_night">#FF262626</color>
<color name="bg_panel">#FFF4F4F4</color>
<color name="bg_panel_night">#FF2D3237</color>
<color name="bg_side_panel">#FFFFFFFF</color>
<color name="bg_side_panel_night">@color/bg_panel_night</color>
<color name="menu_background_open">#FFFFFFFF</color>
<color name="menu_background_closed">#CCFFFFFF</color>
<color name="bg_dialog_translucent">#BB000000</color>
<color name="bg_text_translucent">#99FFFFFF</color>
<!-- TODO change all colors below, remove old ones-->
<color name="bg_menu_open">#FFFFFFFF</color>
<color name="bg_menu_open_night">#FF2D3237</color>
<color name="bg_menu_closed">#CCFFFFFF</color>
<color name="bg_menu_closed_night">#CC2D3237</color>
<color name="bg_status_bar">@color/base_green_darker</color>
<color name="bg_status_bar_night">#FF181C21</color>
<color name="text_place_page_blue">#0288D1</color>
<color name="bg_top_panels">#f4ffffff</color>
<color name="bg_azimut_arrow">#1D414651</color>
<color name="fg_azimut_arrow">@android:color/white</color>
<color name="fg_azimut_arrow">#FFFFFFFF</color>
<!-- downloader -->
<color name="downloader_green">#179E4D</color>
<color name="downloader_blue">#0585ff</color>
<color name="downloader_gray">#999999</color>
<color name="downloader_gray_bg">#efeff4</color>
<color name="downloader_progress_bg">#f0f0f0</color>
<!-- Downloader -->
<color name="downloader_accent">#FF179E4D</color>
<color name="downloader_accent_night">@color/base_accent_night</color>
<color name="downloader_progress_primary">@color/base_accent</color>
<color name="downloader_progress_secondary">#FFF0F0F0</color>
<color name="downloader_gray">#FF999999</color>
<color name="downloader_country_downloaded">#FF000000</color>
<color name="downloader_country_downloaded_night">#FF000000</color>
<color name="downloader_spacer">#FFEFEFF4</color>
<color name="downloader_spacer_night">@color/divider_night</color>
<!-- routing-->
<color name="routing_blue">#FF2096F3</color>
<!-- Routing-->
<color name="routing_accent">@color/base_accent</color>
<color name="routing_accent_night">@color/base_accent_night</color>
<color name="routing_progress">#FF757575</color>
<color name="routing_slot_background">@android:color/white</color>
<color name="routing_slot_background">#FFFFFFFF</color>
<color name="routing_slot_background_night">#FF191E23</color>
<color name="routing_slot_background_pressed">#FFF0F0F0</color>
<color name="routing_slot_background_pressed_night">#FF111411</color>
<color name="routing_slot_shadow">#3D000000</color>
<color name="routing_start">@color/base_blue_light</color>
<color name="routing_start">@color/base_accent</color>
<color name="routing_start_night">@color/base_accent_night</color>
<color name="routing_start_pressed">#FF1C85D6</color>
<color name="routing_start_pressed_night">#FFCCB870</color>
<color name="routing_start_disabled">#FFEFEFEF</color>
<color name="routing_start_text">@android:color/white</color>
<color name="routing_start_disabled_night">#FF505050</color>
<color name="routing_start_text">#FFFFFFFF</color>
<color name="routing_start_text_night">#FF000000</color>
<color name="routing_start_text_disabled">#42000000</color>
<color name="routing_start_text_disabled_night">#4CFFFFFF</color>
<!-- TODO end of unfinished colors-->
<!-- search -->
<color name="bs_divider_color">@color/divider</color>
<color name="bs_dark_divider_color">@color/divider_night</color>
<!-- Search -->
<color name="search_star_dimmed">#1F000000</color>
<!-- What's new -->

View file

@ -48,10 +48,9 @@
<!-- direction fragment -->
<dimen name="margin_direction_small">8dp</dimen>
<dimen name="margin_direction_big">20dp</dimen>
<dimen name="margin_direction_left">32dp</dimen>
<dimen name="margin_direction_top">40dp</dimen>
<dimen name="margin_direction_side">32dp</dimen>
<dimen name="margin_direction_mid">24dp</dimen>
<dimen name="margin_direction_around_center">20dp</dimen>
<dimen name="margin_direction_around_center">40dp</dimen>
<dimen name="height_item_oneline">56dp</dimen>
<dimen name="height_item_edit_bookmark">72dp</dimen>

View file

@ -4,9 +4,7 @@
<!-- BASE TEXT SIZES -->
<!-- we use slightly greater font sizes, then in default material styles -->
<dimen name="text_size_display_3">64sp</dimen>
<dimen name="text_size_display_2">48sp</dimen>
<dimen name="text_size_display_1_plus">40sp</dimen>
<dimen name="text_size_display_2">40sp</dimen>
<dimen name="text_size_display_1">36sp</dimen>
<dimen name="text_size_headline">28sp</dimen>
<dimen name="text_size_title">24sp</dimen>

View file

@ -8,85 +8,55 @@
<style name="MwmTextAppearance.Display1">
<item name="android:textSize">@dimen/text_size_display_1</item>
<item name="android:textColor">@color/text_dark</item>
</style>
<style name="MwmTextAppearance.Display1.Plus">
<item name="android:textSize">@dimen/text_size_display_1_plus</item>
</style>
<style name="MwmTextAppearance.Display2">
<item name="android:textSize">@dimen/text_size_display_2</item>
<item name="android:textColor">@color/text_dark</item>
<item name="android:textStyle">bold</item>
</style>
<style name="MwmTextAppearance.Display3">
<item name="android:textSize">@dimen/text_size_display_3</item>
<item name="android:textColor">@color/text_dark</item>
</style>
<style name="MwmTextAppearance.Headline">
<item name="android:textSize">@dimen/text_size_headline</item>
<item name="android:textColor">@color/text_dark</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="MwmTextAppearance.Toolbar">
<item name="android:textSize">@dimen/text_size_toolbar</item>
<item name="android:textColor">@color/text_light</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textColorHint">@color/text_light_hint</item>
</style>
<style name="MwmTextAppearance.Title">
<item name="android:textSize">@dimen/text_size_title</item>
<item name="android:textColor">@color/text_dark</item>
</style>
<style name="MwmTextAppearance.Title.Light">
<item name="android:textSize">@dimen/text_size_title</item>
<item name="android:textColor">@color/text_light</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="MwmTextAppearance.Body1">
<item name="android:textSize">@dimen/text_size_body_1</item>
<item name="android:textColor">@color/text_dark</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="MwmTextAppearance.Body1.Light">
<item name="android:textColor">@color/text_light</item>
<item name="android:textColor">?android:textColorPrimaryInverse</item>
</style>
<style name="MwmTextAppearance.Body2">
<item name="android:textSize">@dimen/text_size_body_2</item>
<item name="android:textColor">@color/text_dark_subtitle</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="MwmTextAppearance.Caption">
<item name="android:textSize">@dimen/text_size_caption</item>
<item name="android:textColor">@color/text_dark_subtitle</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="MwmTextAppearance.Body3">
<item name="android:textSize">@dimen/text_size_body_3</item>
<item name="android:textColor">@color/text_dark_subtitle</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="MwmTextAppearance.Body3.Light">
<item name="android:textColor">@color/text_light</item>
<item name="android:textColor">?android:textColorPrimaryInverse</item>
</style>
<style name="MwmTextAppearance.Body4">
<item name="android:textSize">@dimen/text_size_body_4</item>
<item name="android:textColor">@color/text_dark_subtitle</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="MwmTextAppearance.Body4.Light">
<item name="android:textColor">@color/text_light</item>
</style>
<style name="MwmTextAppearance.IconTitle">
<item name="android:textSize">@dimen/text_size_icon_title</item>
<item name="android:textColor">@color/text_green</item>
<item name="android:textColor">?android:textColorPrimaryInverse</item>
</style>
<style name="MwmTextAppearance.Button">
@ -95,37 +65,33 @@
<item name="android:textAllCaps">true</item>
</style>
<style name="MwmTextAppearance.Toolbar.Button" parent="MwmTextAppearance.Body3.Light">
<item name="android:textAllCaps">true</item>
</style>
<style name="MwmTextAppearance.Hint.InputLayout" parent="TextAppearance.AppCompat">
<item name="android:textColorHint">?attr/colorAccent</item>
</style>
<style name="MwmTextAppearance.Toolbar.Title" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">@dimen/text_size_toolbar</item>
</style>
<style name="MwmTextAppearance.Counter">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minWidth">20dp</item>
<item name="android:minHeight">20dp</item>
<item name="android:paddingLeft">2dp</item>
<item name="android:paddingRight">2dp</item>
<item name="android:gravity">center</item>
<item name="android:background">@drawable/counter</item>
<item name="android:textAppearance">@style/MwmTextAppearance.Body3.Light</item>
<style name="MwmTextAppearance.Toolbar.Title.Button">
<item name="android:textSize">@dimen/text_size_body_3</item>
<item name="android:textAllCaps">true</item>
</style>
<style name="MwmTextAppearance.RoutingNumber">
<item name="android:textSize">@dimen/text_size_routing_number</item>
<item name="android:textColor">@color/text_dark_subtitle</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="MwmTextAppearance.RoutingDirection">
<item name="android:textSize">@dimen/text_size_display_2</item>
<item name="android:textColor">?routingAccent</item>
<item name="android:textStyle">bold</item>
</style>
<style name="MwmTextAppearance.RoutingDetail">
<item name="android:textSize">@dimen/text_size_routing_plan_detail</item>
<item name="android:fontFamily" tools:ignore="NewApi">@string/robotoMedium</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="MwmTextAppearance.RoutingDetail.Secondary">
<item name="android:textColor">?secondary</item>
</style>
</resources>

View file

@ -38,20 +38,20 @@
</style>
<style name="MwmWidget.Floating.Panel">
<item name="android:background">@color/bg_top_panels</item>
<item name="android:background">?panel</item>
</style>
<style name="MwmWidget.PlacePage.EditText" parent="Widget.AppCompat.EditText">
<item name="android:imeOptions">actionDone</item>
<item name="android:textColor">@color/text_place_page</item>
<item name="android:textColorHint">@color/text_dark_hint</item>
<item name="android:textColor">?ppText</item>
<item name="android:textColorHint">?secondary</item>
<item name="android:textCursorDrawable">@null</item>
<item name="android:textSize">@dimen/text_size_body_1</item>
<item name="android:fontFamily" tools:ignore="NewApi">@string/robotoRegular</item>
</style>
<style name="MwmWidget.ToolbarStyle" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:background">?attr/colorPrimary</item>
<item name="android:background">?colorPrimary</item>
<item name="android:elevation" tools:ignore="NewApi">@dimen/appbar_elevation</item>
<item name="android:displayOptions">homeAsUp|showTitle</item>
<item name="contentInsetStart">72dp</item>
@ -69,7 +69,7 @@
<style name="MwmWidget.ListView" parent="Widget.AppCompat.ListView">
<item name="android:fadingEdge">none</item>
<item name="android:divider">@color/base_black_divider</item>
<item name="android:divider">@color/divider</item>
<item name="android:background">@null</item>
<item name="android:dividerHeight">1px</item>
<item name="android:animationCache">false</item>
@ -121,32 +121,15 @@
<item name="android:singleLine">true</item>
</style>
<style name="MwmWidget.TextView.PlanDetail.Number.Secondary">
<item name="android:textAppearance">@style/MwmTextAppearance.RoutingDetail.Secondary</item>
</style>
<style name="MwmWidget.TextView.PlanDetail.Status">
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_centerVertical">true</item>
</style>
<style name="MwmWidget.TextView.BottomMenu">
<item name="android:maxLines">2</item>
<item name="android:textColor">@color/color_menu_text</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:maxWidth">200dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_marginRight">@dimen/margin_half</item>
<item name="android:gravity">right</item>
<item name="android:textAllCaps">true</item>
</style>
<style name="MwmWidget.TextView.OutOfDateMapsMarker">
<item name="android:layout_width">26dp</item>
<item name="android:layout_height">26dp</item>
<item name="android:background">@drawable/bg_circle_outdated_maps_marker</item>
<item name="android:gravity">center</item>
<item name="android:textAppearance">@style/MwmTextAppearance.Body3</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="MwmWidget.FrameLayout.Elevation">
<item name="android:foreground">@drawable/shadow_top</item>
</style>
@ -155,4 +138,16 @@
<item name="android:progressDrawable">@drawable/rating_bar</item>
<item name="android:indeterminateDrawable">@drawable/rating_bar</item>
</style>
<style name="MwmWidget.Counter">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minWidth">20dp</item>
<item name="android:minHeight">20dp</item>
<item name="android:paddingLeft">2dp</item>
<item name="android:paddingRight">2dp</item>
<item name="android:gravity">center</item>
<item name="android:background">@drawable/counter</item>
<item name="android:textAppearance">@style/MwmTextAppearance.Body3.Light</item>
</style>
</resources>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ThemeAttrs">
<attr name="fullscreenDialogTheme" format="reference"/>
<attr name="clickableBackground" format="reference"/>
<attr name="statusBar" format="color"/>
<attr name="secondary" format="color"/>
<attr name="panel" format="color"/>
<attr name="sidePanel" format="color"/>
<attr name="iconTint" format="color"/>
<attr name="zoomPlus" format="reference"/>
<attr name="zoomMinus" format="reference"/>
<attr name="ppBackground" format="color"/>
<attr name="ppPreviewHead" format="reference"/>
<attr name="ppText" format="color"/>
<attr name="ppTextAccent" format="color"/>
<attr name="ppButtonBackground" format="color"/>
<attr name="routingAccent" format="color"/>
<attr name="routingSlot" format="reference"/>
<attr name="routingSlotPressed" format="reference"/>
<attr name="routingSlotMarker" format="reference"/>
<attr name="routingStartButton" format="reference"/>
<attr name="routingStartButtonText" format="color"/>
<attr name="routingStartButtonTextDisabled" format="color"/>
<attr name="menuBackgroundClosed" format="color"/>
<attr name="menuBackgroundOpen" format="color"/>
</declare-styleable>
<declare-styleable name="CountryDownloaderAttrs">
<attr name="countrySeparator" format="color"/>
<attr name="countryDownloaded" format="color"/>
<attr name="countryOutdated" format="color"/>
<attr name="countryNotDownloaded" format="color"/>
<attr name="countryFailed" format="color"/>
</declare-styleable>
</resources>

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Default theme -->
<style name="MwmTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:listViewStyle">@style/MwmWidget.ListView</item>
<item name="android:textViewStyle">@style/MwmWidget.TextView</item>
<item name="android:textColorPrimary">@color/text_dark</item>
<item name="android:textColorPrimaryInverse">@color/text_light</item>
<item name="android:textColorSecondary">@color/text_dark_subtitle</item>
<item name="android:windowBackground">@color/bg_window</item>
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">@color/base_green_darker</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoRegular</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="clickableBackground">?attr/selectableItemBackground</item>
<item name="alertDialogTheme">@style/MwmTheme.DialogFragment</item>
<item name="fullscreenDialogTheme">@style/MwmTheme.DialogFragment.Fullscreen</item>
<item name="statusBar">@color/bg_status_bar</item>
<item name="colorPrimary">@color/base_green</item>
<item name="colorControlNormal">?secondary</item>
<item name="colorAccent">@color/base_accent</item>
<item name="panel">@color/bg_panel</item>
<item name="sidePanel">@color/bg_side_panel</item>
<!-- item name="iconTint">@android:color/transparent</item -->
<item name="iconTint">#8A000000</item>
<item name="secondary">@color/text_dark_hint</item>
<item name="dividerHorizontal">@color/divider</item>
<item name="ppBackground">@color/bg_window</item>
<item name="ppPreviewHead">@drawable/bg_place_page_back</item>
<item name="ppText">@color/text_dark</item>
<item name="ppTextAccent">@color/text_pp_accent</item>
<item name="ppButtonBackground">@color/bg_secondary</item>
<item name="routingAccent">@color/routing_accent</item>
<item name="routingSlot">@drawable/routing_slot_background</item>
<item name="routingSlotPressed">@drawable/routing_slot_background_pressed</item>
<item name="routingSlotMarker">@drawable/routing_slot_marker</item>
<item name="routingStartButton">@drawable/routing_start_button</item>
<item name="routingStartButtonText">@color/routing_start_text</item>
<item name="routingStartButtonTextDisabled">@color/routing_start_text_disabled</item>
<item name="menuBackgroundClosed">@color/bg_menu_closed</item>
<item name="menuBackgroundOpen">@color/bg_menu_open</item>
</style>
<!-- Night theme -->
<style name="MwmTheme.Night.Base" parent="Theme.AppCompat.NoActionBar">
<item name="android:listViewStyle">@style/MwmWidget.ListView</item>
<item name="android:textViewStyle">@style/MwmWidget.TextView</item>
<item name="android:textColorPrimary">@color/text_light</item>
<item name="android:textColorPrimaryInverse">@color/text_dark</item>
<item name="android:textColorSecondary">@color/text_light_subtitle</item>
<item name="android:windowBackground">@color/bg_window_night</item>
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">@color/bg_panel_night</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoRegular</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="clickableBackground">?attr/selectableItemBackground</item>
<item name="alertDialogTheme">@style/MwmTheme.Night.DialogFragment</item>
<item name="fullscreenDialogTheme">@style/MwmTheme.DialogFragment.Fullscreen</item>
<item name="statusBar">@color/bg_status_bar_night</item>
<item name="colorPrimary">@color/bg_panel_night</item>
<item name="colorControlNormal">?secondary</item>
<item name="colorAccent">@color/base_accent_night</item>
<item name="panel">@color/bg_panel_night</item>
<item name="sidePanel">@color/bg_side_panel_night</item>
<!-- item name="iconTint">@android:color/white</item -->
<item name="iconTint">#4C000000</item>
<item name="secondary">@color/text_light_hint</item>
<item name="dividerHorizontal">@color/divider_night</item>
<item name="ppBackground">@color/bg_window_night</item>
<item name="ppPreviewHead">@drawable/bg_place_page_back</item>
<item name="ppText">@color/text_light</item>
<item name="ppTextAccent">@color/text_pp_accent_night</item>
<item name="ppButtonBackground">@color/bg_secondary_night</item>
<item name="routingAccent">@color/routing_accent_night</item>
<item name="routingSlot">@drawable/routing_slot_background_night</item>
<item name="routingSlotPressed">@drawable/routing_slot_background_pressed_night</item>
<item name="routingSlotMarker">@drawable/routing_slot_marker_night</item>
<item name="routingStartButton">@drawable/routing_start_button_night</item>
<item name="routingStartButtonText">@color/routing_start_text_night</item>
<item name="routingStartButtonTextDisabled">@color/routing_start_text_disabled_night</item>
<item name="menuBackgroundClosed">@color/bg_menu_closed_night</item>
<item name="menuBackgroundOpen">@color/bg_menu_open_night</item>
</style>
</resources>

View file

@ -1,71 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="MwmTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/base_green</item>
<item name="colorPrimaryDark">@color/base_green_darker</item>
<item name="clickableBackground">?attr/selectableItemBackground</item>
<item name="colorControlNormal">@color/text_dark_hint</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:listViewStyle">@style/MwmWidget.ListView</item>
<item name="android:textViewStyle">@style/MwmWidget.TextView</item>
<item name="alertDialogTheme">@style/MwmMain.DialogFragment</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoRegular</item>
<item name="dividerHorizontal">@color/divider_standard</item>
</style>
<style name="MwmTheme" parent="MwmTheme.Base"/>
<style name="MwmTheme.Night" parent="MwmTheme.Night.Base"/>
<style name="MwmTheme.MainActivity">
<item name="android:colorPrimaryDark" tools:ignore="NewApi">@android:color/black</item>
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">@android:color/black</item>
<item name="android:windowBackground">@null</item>
</style>
<style name="MwmTheme.Light">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@style/TextAppearance.AppCompat.Title</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="android:buttonBarStyle">@style/Theme.AppCompat.Dialog</item>
<item name="listPreferredItemPaddingLeft">16dip</item>
<item name="listPreferredItemPaddingRight">16dip</item>
<style name="MwmTheme.Night.MainActivity">
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">@android:color/black</item>
<item name="android:windowBackground">@null</item>
</style>
<style name="MwmMain.DialogFragment" parent="android:Theme.Holo.Light.Dialog.NoActionBar">
<item name="colorPrimary">@color/base_green</item>
<item name="colorPrimaryDark">@color/base_green_darker</item>
<style name="MwmTheme.Settings">
</style>
<style name="MwmTheme.Night.Settings">
<item name="colorAccent">?android:textColorPrimary</item>
<item name="colorSwitchThumbNormal">?android:colorControlNormal</item>
</style>
<style name="MwmTheme.Downloader">
<item name="colorAccent">@color/downloader_accent</item>
<item name="countrySeparator">@color/downloader_spacer</item>
<item name="countryDownloaded">?android:textColorPrimary</item>
<item name="countryOutdated">?android:textColorSecondary</item>
<item name="countryNotDownloaded">?secondary</item>
<item name="countryFailed">@color/base_red</item>
</style>
<style name="MwmTheme.Night.Downloader">
<item name="colorAccent">@color/downloader_accent_night</item>
<item name="countrySeparator">@color/downloader_spacer_night</item>
<item name="countryDownloaded">?android:textColorPrimary</item>
<item name="countryOutdated">?android:textColorSecondary</item>
<item name="countryNotDownloaded">?secondary</item>
<item name="countryFailed">@color/base_red</item>
</style>
<style name="MwmTheme.DialogFragment" parent="android:Theme.Holo.Light.Dialog.NoActionBar">
<item name="android:windowIsFloating">true</item>
<item name="clickableBackground">?attr/selectableItemBackground</item>
<item name="colorControlNormal">@color/text_dark_hint</item>
<item name="colorControlNormal">?secondary</item>
<item name="android:listViewStyle">@style/MwmWidget.ListView</item>
<item name="android:textViewStyle">@style/MwmWidget.TextView</item>
<item name="android:windowTitleStyle">@style/MwmMain.DialogFragment.TitleStyle</item>
<item name="android:windowTitleStyle">@style/MwmTheme.DialogFragment.TitleStyle</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoRegular</item>
</style>
<style name="MwmMain.DialogFragment.TitleStyle" parent="Base.DialogWindowTitle.AppCompat">
<style name="MwmTheme.Night.DialogFragment" parent="android:Theme.Holo.Dialog.NoActionBar">
<item name="android:windowIsFloating">true</item>
<item name="clickableBackground">?attr/selectableItemBackground</item>
<item name="colorControlNormal">?secondary</item>
<item name="android:listViewStyle">@style/MwmWidget.ListView</item>
<item name="android:textViewStyle">@style/MwmWidget.TextView</item>
<item name="android:windowTitleStyle">@style/MwmTheme.DialogFragment.TitleStyle</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoRegular</item>
</style>
<style name="MwmTheme.DialogFragment.TitleStyle" parent="Base.DialogWindowTitle.AppCompat">
<item name="android:textAppearance">@style/MwmTextAppearance.Title</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoMedium</item>
</style>
<style name="MwmMain.DialogFragment.Fullscreen" parent="Theme.AppCompat">
<style name="MwmTheme.DialogFragment.Fullscreen" parent="Theme.AppCompat">
<item name="colorPrimary">@color/base_green</item>
<item name="colorPrimaryDark">@color/base_green_darker</item>
<item name="clickableBackground">?attr/selectableItemBackground</item>
<item name="colorControlNormal">@color/text_dark_hint</item>
<item name="clickableBackground">?selectableItemBackground</item>
<item name="colorControlNormal">?secondary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:textColorHint">@color/text_dark_hint</item>
<item name="android:textColorHint">?secondary</item>
<item name="android:textViewStyle">@style/MwmWidget.TextView</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@string/robotoRegular</item>
</style>
<style name="MwmMain.DialogFragment.Fullscreen.SemiTransparent">
<item name="android:windowBackground">@color/semitransparent_black</item>
<style name="MwmTheme.DialogFragment.Fullscreen.Night">
<item name="colorPrimary">@color/base_green</item>
<item name="colorPrimaryDark">@color/base_green_darker</item>
<item name="android:textColorHint">?secondary</item>
</style>
<style name="MwmTheme.DialogFragment.Fullscreen.Translucent">
<item name="android:colorPrimaryDark" tools:targetApi="lollipop">@android:color/black</item>
<item name="android:windowBackground">@color/bg_dialog_translucent</item>
</style>
</resources>

View file

@ -6,6 +6,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
@ -18,6 +19,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;
@ -65,6 +67,7 @@ import com.mapswithme.util.BottomSheetHelper;
import com.mapswithme.util.Config;
import com.mapswithme.util.InputUtils;
import com.mapswithme.util.LocationUtils;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.Utils;
import com.mapswithme.util.Yota;
@ -291,6 +294,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
super.onCreate(savedInstanceState);
mIsFragmentContainer = getResources().getBoolean(R.bool.tabletLayout);
if (!mIsFragmentContainer && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP))
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
setContentView(R.layout.activity_map);
initViews();
@ -302,7 +310,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
mLocationPredictor = new LocationPredictor(new Handler(), this);
processIntent(getIntent());
SharingHelper.prepare();
RoutingController.get().attach(this);
}
private void initViews()
@ -312,15 +319,14 @@ public class MwmActivity extends BaseMwmFragmentActivity
initPlacePage();
initNavigationButtons();
if (findViewById(R.id.fragment_container) != null)
mIsFragmentContainer = true;
else
if (!mIsFragmentContainer)
{
mRoutingPlanInplaceController = new RoutingPlanInplaceController(this);
removeCurrentFragment(false);
}
mNavigationController = new NavigationController(this);
RoutingController.get().attach(this);
initMenu();
}

View file

@ -12,8 +12,8 @@ import com.mapswithme.util.UiUtils;
public abstract class WebContainerDelegate implements OnBackPressListener
{
private WebView mWebView;
private View mProgress;
private final WebView mWebView;
private final View mProgress;
@SuppressLint("SetJavaScriptEnabled")
private void initWebView(String url)

View file

@ -1,9 +1,42 @@
package com.mapswithme.maps.base;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v4.app.DialogFragment;
import com.mapswithme.maps.R;
import com.mapswithme.util.ThemeUtils;
public class BaseMwmDialogFragment extends DialogFragment
{
protected final @StyleRes int getFullscreenTheme()
{
return (ThemeUtils.isNightTheme() ? R.style.MwmTheme_DialogFragment_Fullscreen_Night
: R.style.MwmTheme_DialogFragment_Fullscreen);
}
protected int getStyle()
{
return STYLE_NORMAL;
}
protected @StyleRes int getCustomTheme()
{
return 0;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
int style = getStyle();
int theme = getCustomTheme();
if (style != STYLE_NORMAL || theme != 0)
setStyle(style, theme);
}
@Override
public void onResume()
{

View file

@ -3,7 +3,6 @@ package com.mapswithme.maps.bookmarks;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@ -36,10 +35,9 @@ public class ChooseBookmarkCategoryFragment extends BaseMwmDialogFragment implem
private Listener mListener;
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
protected int getStyle()
{
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_FRAME, R.style.MwmMain_DialogFragment);
return STYLE_NO_FRAME;
}
@Nullable

View file

@ -12,15 +12,15 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
public class SlotFrame extends LinearLayout
{
private static final int COLOR_TEXT = MwmApplication.get().getResources().getColor(R.color.text_dark);
private static final int COLOR_HINT = MwmApplication.get().getResources().getColor(R.color.text_dark_hint);
private static final int ANIM_SWAP = MwmApplication.get().getResources().getInteger(R.integer.anim_slots_swap);
private OnSlotClickListener mClickListener;
@ -32,6 +32,9 @@ public class SlotFrame extends LinearLayout
private final PointF mDragStartPoint = new PointF();
private boolean mSwapProgress;
private int mTextColor;
private int mHintColor;
public interface OnSlotClickListener
{
void OnSlotClick(int slotId);
@ -95,7 +98,7 @@ public class SlotFrame extends LinearLayout
else
mText.setText(R.string.p2p_to);
mText.setTextColor(COLOR_HINT);
mText.setTextColor(mHintColor);
return;
}
@ -104,7 +107,7 @@ public class SlotFrame extends LinearLayout
else
mText.setText(mMapObject.getName());
mText.setTextColor(COLOR_TEXT);
mText.setTextColor(mTextColor);
}
void setMapObject(MapObject mapObject)
@ -160,9 +163,8 @@ public class SlotFrame extends LinearLayout
mShadowedFrame.setLayoutParams(lp);
mShadow.setAlpha(dragging ? 0.6f : 1.0f);
mShadowedFrame.setBackgroundResource(dragging ? R.drawable.routing_slot_background_pressed
: R.drawable.routing_slot_background);
mShadowedFrame.setBackgroundResource(ThemeUtils.getResource(getContext(), dragging ? R.attr.routingSlotPressed
: R.attr.routingSlot));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mFrame.setElevation(dragging ? 1.0f : 0.0f);
}
@ -217,7 +219,10 @@ public class SlotFrame extends LinearLayout
{
super.onFinishInflate();
setBackgroundColor(getContext().getResources().getColor(R.color.base_green));
mTextColor = ThemeUtils.getColor(getContext(), android.R.attr.textColorPrimary);
mHintColor = ThemeUtils.getColor(getContext(), R.attr.secondary);
setBackgroundColor(ThemeUtils.getColor(getContext(), R.attr.colorPrimary));
setBaselineAligned(false);
setClipChildren(false);
setClipToPadding(false);

View file

@ -2,16 +2,16 @@ package com.mapswithme.maps.search;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.util.UiUtils;
import com.mapswithme.util.statistics.Statistics;
class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolder>
@ -63,8 +63,7 @@ class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolde
@Override
public void onBindViewHolder(ViewHolder holder, int position)
{
UiUtils.setTextAndShow(holder.mName, mResources.getString(mCategoryResIds[position]));
holder.mImageLeft.setImageResource(mIconResIds[position]);
holder.setTextAndIcon(mCategoryResIds[position], mIconResIds[position]);
}
@Override
@ -80,15 +79,13 @@ class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolde
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
{
public TextView mName;
public ImageView mImageLeft;
private final TextView mTitle;
public ViewHolder(View v)
{
super(v);
v.setOnClickListener(this);
mName = (TextView) v.findViewById(R.id.tv__search_category);
mImageLeft = (ImageView) v.findViewById(R.id.iv__search_category);
mTitle = (TextView) v;
}
@Override
@ -99,5 +96,11 @@ class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolde
if (mListener != null)
mListener.onCategorySelected(getSuggestionFromCategory(mCategoryResIds[position]));
}
void setTextAndIcon(@StringRes int textResId, @DrawableRes int iconResId)
{
mTitle.setText(textResId);
mTitle.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
}
}
}

View file

@ -1,6 +1,7 @@
package com.mapswithme.maps.search;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableStringBuilder;
@ -12,8 +13,10 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.BaseViewHolder>
@ -24,6 +27,7 @@ class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.BaseViewHolder>
private final SearchFragment mSearchFragment;
private SearchResult[] mResults;
private Drawable mClosedMarkerBackground;
protected static abstract class BaseViewHolder extends RecyclerView.ViewHolder
{
@ -170,6 +174,8 @@ class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.BaseViewHolder>
mDescription = (TextView) view.findViewById(R.id.description);
mRegion = (TextView) view.findViewById(R.id.region);
mDistance = (TextView) view.findViewById(R.id.distance);
mClosedMarker.setBackgroundDrawable(mClosedMarkerBackground);
}
@Override
@ -199,6 +205,8 @@ class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.BaseViewHolder>
public SearchAdapter(SearchFragment fragment)
{
mSearchFragment = fragment;
mClosedMarkerBackground = fragment.getResources().getDrawable(ThemeUtils.isNightTheme() ? R.drawable.search_closed_marker_night
: R.drawable.search_closed_marker);
}
@Override

View file

@ -5,10 +5,12 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.widget.SearchToolbarController;
import com.mapswithme.util.Graphics;
class SearchHistoryAdapter extends RecyclerView.Adapter<SearchHistoryAdapter.ViewHolder>
{
@ -86,6 +88,7 @@ class SearchHistoryAdapter extends RecyclerView.Adapter<SearchHistoryAdapter.Vie
throw new IllegalArgumentException("Unsupported ViewHolder type given");
}
Graphics.tintDrawable(res.mText);
return res;
}

View file

@ -1,6 +1,7 @@
package com.mapswithme.maps.search;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
@ -10,13 +11,15 @@ import android.support.v4.view.ViewPager;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.widget.TextView;
import com.mapswithme.maps.R;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.UiUtils;
import java.util.ArrayList;
import java.util.List;
import com.mapswithme.maps.R;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.ThemeUtils;
import com.mapswithme.util.UiUtils;
class TabAdapter extends FragmentPagerAdapter
{
enum Tab
@ -146,6 +149,12 @@ class TabAdapter extends FragmentPagerAdapter
attachTo(tabs);
}
private static ColorStateList getTabTextColor(Context context)
{
return context.getResources().getColorStateList(ThemeUtils.isNightTheme() ? R.color.tab_text_night
: R.color.tab_text);
}
private void attachTo(TabLayout tabs)
{
final Context context = tabs.getContext();
@ -160,7 +169,10 @@ class TabAdapter extends FragmentPagerAdapter
tabView.setText(tab.getTitleRes());
tabView.setCompoundDrawablePadding(padding);
tabView.setCompoundDrawablesWithIntrinsicBounds(landscape ? tab.getIconRes() : 0, landscape ? 0 : tab.getIconRes(), 0, 0);
Graphics.tintTextView(tabView, context.getResources().getColorStateList(R.color.text_highlight));
ColorStateList colors = getTabTextColor(context);
tabView.setTextColor(colors);
Graphics.tintDrawable(tabView, colors);
tabs.addTab(tabs.newTab().setCustomView(tabView), true);
}

View file

@ -1,9 +1,9 @@
package com.mapswithme.maps.widget;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
@ -52,11 +52,10 @@ public class WheelProgressView extends View
private void init(AttributeSet attrs)
{
final Resources resources = getResources();
final TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.WheelProgressView, 0, 0);
mStrokeWidth = typedArray.getDimensionPixelSize(R.styleable.WheelProgressView_wheelThickness, DEFAULT_THICKNESS);
final int progressColor = typedArray.getColor(R.styleable.WheelProgressView_wheelProgressColor, resources.getColor(R.color.downloader_progress_bg));
final int secondaryColor = typedArray.getColor(R.styleable.WheelProgressView_wheelSecondaryColor, resources.getColor(R.color.text_green));
final int progressColor = typedArray.getColor(R.styleable.WheelProgressView_wheelProgressColor, Color.WHITE);
final int secondaryColor = typedArray.getColor(R.styleable.WheelProgressView_wheelSecondaryColor, Color.GRAY);
mCenterDrawable = typedArray.getDrawable(R.styleable.WheelProgressView_centerDrawable);
typedArray.recycle();

View file

@ -2,7 +2,6 @@ package com.mapswithme.maps.widget.placepage;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
@ -38,10 +37,9 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
public EditBookmarkFragment() {}
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
protected int getCustomTheme()
{
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.MwmMain_DialogFragment_Fullscreen);
return getFullscreenTheme();
}
@Nullable

View file

@ -2,7 +2,6 @@ package com.mapswithme.maps.widget.placepage;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.view.LayoutInflater;
@ -11,14 +10,15 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
import java.lang.ref.WeakReference;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmDialogFragment;
import com.mapswithme.maps.bookmarks.data.Bookmark;
import com.mapswithme.util.StringUtils;
import com.mapswithme.util.UiUtils;
import java.lang.ref.WeakReference;
public class EditDescriptionFragment extends BaseMwmDialogFragment
{
public static final String EXTRA_BOOKMARK = "bookmark";
@ -36,10 +36,9 @@ public class EditDescriptionFragment extends BaseMwmDialogFragment
public EditDescriptionFragment() {}
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
protected int getCustomTheme()
{
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.MwmMain_DialogFragment_Fullscreen);
return getFullscreenTheme();
}
@Nullable

View file

@ -25,6 +25,7 @@ public final class Config
private static final String KEY_MISC_DISCLAIMER_ACCEPTED = "IsDisclaimerApproved";
private static final String KEY_MISC_KITKAT_MIGRATED = "KitKatMigrationCompleted";
private static final String KEY_MISC_NEWS_LAST_VERSION = "WhatsNewShownVersion";
private static final String KEY_MISC_UI_THEME = "UiTheme";
private Config() {}
@ -260,6 +261,16 @@ public final class Config
setInt(KEY_MISC_NEWS_LAST_VERSION, BuildConfig.VERSION_CODE);
}
public static String getUiTheme()
{
return getString(KEY_MISC_UI_THEME, ThemeUtils.THEME_DEFAULT);
}
public static void setUiTheme(String theme)
{
setString(KEY_MISC_UI_THEME, theme);
}
private static native boolean nativeGetBoolean(String name, boolean defaultValue);
private static native void nativeSetBoolean(String name, boolean value);
private static native int nativeGetInt(String name, int defaultValue);

View file

@ -1,16 +1,22 @@
package com.mapswithme.util;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.widget.TextView;
import com.mapswithme.maps.R;
public final class Graphics
{
public static Drawable drawCircle(int color, int sizeResId, Resources res)
@ -29,10 +35,17 @@ public final class Graphics
return new BitmapDrawable(res, bmp);
}
public static void tintTextView(TextView view, ColorStateList tintColors)
public static void tintDrawable(TextView view)
{
view.setTextColor(tintColors);
final Drawable[] dlist = view.getCompoundDrawables();
for (int i = 0; i < dlist.length; i++)
dlist[i] = tintDrawable(dlist[i], ThemeUtils.getColor(view.getContext(), R.attr.iconTint));
view.setCompoundDrawablesWithIntrinsicBounds(dlist[0], dlist[1], dlist[2], dlist[3]);
}
public static void tintDrawable(TextView view, ColorStateList tintColors)
{
final Drawable[] dlist = view.getCompoundDrawables();
for (int i = 0; i < dlist.length; i++)
dlist[i] = tintDrawable(dlist[i], tintColors);
@ -40,6 +53,27 @@ public final class Graphics
view.setCompoundDrawablesWithIntrinsicBounds(dlist[0], dlist[1], dlist[2], dlist[3]);
}
public static Drawable tintDrawable(Context context, @DrawableRes int resId)
{
Drawable d = context.getResources().getDrawable(resId);
return tintDrawable(d, ThemeUtils.getColor(context, R.attr.iconTint));
}
public static Drawable tintDrawable(Drawable src, @ColorInt int color)
{
if (src == null)
return null;
if (color == Color.TRANSPARENT)
return src;
final Rect tmp = src.getBounds();
final Drawable res = DrawableCompat.wrap(src);
DrawableCompat.setTint(res.mutate(), color);
res.setBounds(tmp);
return res;
}
public static Drawable tintDrawable(Drawable src, ColorStateList tintColors)
{
if (src == null)

View file

@ -0,0 +1,47 @@
package com.mapswithme.util;
import android.content.Context;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.StyleRes;
import android.support.v7.internal.view.ContextThemeWrapper;
import android.util.TypedValue;
import android.view.LayoutInflater;
import com.mapswithme.maps.MwmApplication;
import com.mapswithme.maps.R;
public class ThemeUtils
{
public static final String THEME_DEFAULT = MwmApplication.get().getString(R.string.theme_default);
public static final String THEME_NIGHT = MwmApplication.get().getString(R.string.theme_night);
private static final TypedValue VALUE_BUFFER = new TypedValue();
public static @ColorInt int getColor(Context context, @AttrRes int attr)
{
if (!context.getTheme().resolveAttribute(attr, VALUE_BUFFER, true))
throw new IllegalArgumentException("Failed to resolve color theme attribute");
return VALUE_BUFFER.data;
}
public static int getResource(Context context, @AttrRes int attr)
{
if (!context.getTheme().resolveAttribute(attr, VALUE_BUFFER, true))
throw new IllegalArgumentException("Failed to resolve drawable theme attribute");
return VALUE_BUFFER.resourceId;
}
public static LayoutInflater themedInflater(LayoutInflater src, @StyleRes int theme)
{
Context wrapper = new ContextThemeWrapper(src.getContext(), theme);
return src.cloneInContext(wrapper);
}
public static boolean isNightTheme()
{
return THEME_NIGHT.equals(Config.getUiTheme());
}
}

View file

@ -84,7 +84,7 @@ public final class MytargetHelper
}
@WorkerThread
private boolean getShowcaseSetting()
private static boolean getShowcaseSetting()
{
final long lastCheckMillis = MwmApplication.prefs().getLong(PREF_CHECK_MILLIS, 0);
final long currentMillis = System.currentTimeMillis();