[android] replace custom map buttons by FloatingActionButton

Signed-off-by: Arnaud Vergnet <arnaud.vergnet@mailo.com>
This commit is contained in:
Arnaud Vergnet 2022-07-10 19:17:14 +02:00 committed by Roman Tsisyk
parent 33974e8044
commit 282425e1ac
40 changed files with 185 additions and 249 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

View file

@ -1,7 +0,0 @@
<vector android:height="24dp" android:viewportHeight="50.8"
android:viewportWidth="50.8" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.6" android:fillColor="#ffffff"
android:pathData="M25.4,25.4m-18.885,0a18.885,18.885 0,1 1,37.77 0a18.885,18.885 0,1 1,-37.77 0"
android:strokeColor="#dbdbdb" android:strokeLineCap="round"
android:strokeLineJoin="bevel" android:strokeWidth="0.5"/>
</vector>

View file

@ -1,7 +0,0 @@
<vector android:height="24dp" android:viewportHeight="50.8"
android:viewportWidth="50.8" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.6" android:fillColor="#3b4045"
android:pathData="M25.4,25.4m-18.885,0a18.885,18.885 0,1 1,37.77 0a18.885,18.885 0,1 1,-37.77 0"
android:strokeColor="#3b4045" android:strokeLineCap="round"
android:strokeLineJoin="bevel" android:strokeWidth="0.5"/>
</vector>

View file

@ -1,7 +0,0 @@
<vector android:height="24dp" android:viewportHeight="50.8"
android:viewportWidth="50.8" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.32156864" android:fillColor="#ffffff"
android:pathData="M25.4,25.4m-18.885,0a18.885,18.885 0,1 1,37.77 0a18.885,18.885 0,1 1,-37.77 0"
android:strokeColor="#dbdbdb" android:strokeLineCap="round"
android:strokeLineJoin="bevel" android:strokeWidth="0.5"/>
</vector>

View file

@ -1,7 +0,0 @@
<vector android:height="24dp" android:viewportHeight="50.8"
android:viewportWidth="50.8" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.3" android:fillColor="#3b4045"
android:pathData="M25.4,25.4m-18.885,0a18.885,18.885 0,1 1,37.77 0a18.885,18.885 0,1 1,-37.77 0"
android:strokeColor="#3b4045" android:strokeLineCap="round"
android:strokeLineJoin="bevel" android:strokeWidth="0.5"/>
</vector>

View file

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

View file

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

View file

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

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="UnusedAttribute">
<item android:drawable="@drawable/bg_circle_pressed_night"
android:state_pressed="true"/>
<item android:drawable="@drawable/bg_circle_night"/>
</selector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,7.27l4.28,10.43 -3.47,-1.53 -0.81,-0.36 -0.81,0.36 -3.47,1.53L12,7.27M12,2L4.5,20.29l0.71,0.71L12,18l6.79,3 0.71,-0.71L12,2z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2L4.5,20.29l0.71,0.71L12,18l6.79,3 0.71,-0.71z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM20.94,11c-0.46,-4.17 -3.77,-7.48 -7.94,-7.94L13,1h-2v2.06C6.83,3.52 3.52,6.83 3.06,11L1,11v2h2.06c0.46,4.17 3.77,7.48 7.94,7.94L11,23h2v-2.06c4.17,-0.46 7.48,-3.77 7.94,-7.94L23,13v-2h-2.06zM12,19c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View file

@ -5,70 +5,73 @@
android:id="@+id/search_button_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="?navButtonsTheme"
android:padding="@dimen/nav_frame_padding"
android:clipChildren="false"
android:clipToPadding="false"
android:layoutDirection="ltr"
android:padding="@dimen/nav_frame_padding"
android:theme="?navButtonsTheme"
tools:background="@color/bg_primary">
<ImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btn_bookmarks"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_width="@dimen/margin_quadruple"
android:layout_height="@dimen/margin_quadruple"
style="@style/MwmWidget.MapButton"
android:layout_alignParentStart="true"
android:background="?nav_background"
android:src="@drawable/ic_menu_bookmarks"
android:tint="@null"/>
android:layout_marginBottom="@dimen/margin_half"
android:contentDescription="@string/bookmarks"
android:src="@drawable/ic_bookmarks" />
<LinearLayout
android:id="@+id/search_frame"
android:layout_width="286dp"
android:layout_height="56dp"
android:layout_alignParentStart="true"
android:layout_below="@id/btn_bookmarks"
android:layout_alignParentStart="true"
android:layout_marginTop="-4dp"
android:background="?searchLayoutBackground"
android:elevation="6dp"
android:orientation="horizontal"
android:padding="@dimen/margin_quarter"
android:visibility="invisible"
tools:visibility="visible">
<ImageView
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_fuel"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_marginStart="60dp"
android:src="@drawable/ic_routing_fuel_on"/>
<ImageView
style="@style/MwmWidget.MapButton.Search"
android:layout_gravity="center_vertical"
android:layout_marginStart="50dp"
android:contentDescription="@string/fuel"
android:src="@drawable/ic_routing_fuel_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_parking"
style="@style/MwmWidget.SearchNavigationButton"
android:src="@drawable/ic_routing_parking_on"/>
<ImageView
style="@style/MwmWidget.MapButton.Search"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:contentDescription="@string/parkings"
android:src="@drawable/ic_routing_parking_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_eat"
style="@style/MwmWidget.SearchNavigationButton"
android:src="@drawable/ic_routing_eat_on"/>
<ImageView
style="@style/MwmWidget.MapButton.Search"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:contentDescription="@string/eat"
android:src="@drawable/ic_routing_eat_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_food"
style="@style/MwmWidget.SearchNavigationButton"
android:src="@drawable/ic_routing_food_on"/>
<ImageView
style="@style/MwmWidget.MapButton.Search"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:contentDescription="@string/shopping"
android:src="@drawable/ic_routing_food_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_atm"
style="@style/MwmWidget.SearchNavigationButton"
android:src="@drawable/ic_routing_atm_on"/>
style="@style/MwmWidget.MapButton.Search"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/margin_half"
android:contentDescription="@string/atm"
android:src="@drawable/ic_routing_atm_on" />
</LinearLayout>
<ImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btn_search"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_width="@dimen/margin_quadruple"
android:layout_height="@dimen/margin_quadruple"
style="@style/MwmWidget.MapButton"
android:layout_below="@id/btn_bookmarks"
android:layout_alignParentStart="true"
android:background="?nav_background"
android:src="@drawable/ic_menu_search"
android:tint="@null"/>
android:contentDescription="@string/search"
android:src="@drawable/ic_search" />
</RelativeLayout>

View file

@ -18,6 +18,8 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/menu_line_height"
android:layout_marginBottom="@dimen/menu_line_height"
android:clipChildren="false"
android:clipToPadding="false"
android:layoutDirection="ltr"
android:padding="@dimen/nav_frame_padding"
android:theme="?navButtonsTheme">
@ -25,42 +27,29 @@
layout="@layout/layout_nav_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_base"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/zoom_buttons_container"
<include
layout="@layout/map_navigation_buttons_zoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/margin_half"
app:layout_constraintBottom_toTopOf="@+id/layers_button"
app:layout_constraintEnd_toEndOf="parent">
<ImageButton
android:id="@+id/nav_zoom_in"
style="@style/MwmWidget.MapButton"
android:src="@drawable/ic_plus"
app:layout_constraintBottom_toTopOf="@+id/nav_zoom_out"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/nav_zoom_out"
style="@style/MwmWidget.MapButton"
android:src="@drawable/ic_minus"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageButton
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/layers_button"
style="@style/MwmWidget.MapButton"
android:background="?nav_background"
android:layout_marginBottom="@dimen/margin_half"
android:contentDescription="@string/layers_title"
android:src="@drawable/ic_layers"
app:layout_constraintBottom_toTopOf="@+id/my_position"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/my_position"
style="@style/MwmWidget.MapButton"
android:layout_marginBottom="@dimen/margin_base"
android:contentDescription="@string/core_my_position"
android:tint="@null"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -5,86 +5,75 @@
android:id="@+id/search_button_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/nav_frame_padding"
android:clipChildren="false"
android:clipToPadding="false"
android:theme="?navButtonsTheme"
android:layoutDirection="ltr"
android:theme="?navButtonsTheme"
tools:background="@color/bg_primary">
<ImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btn_bookmarks"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_width="@dimen/margin_quadruple"
android:layout_height="@dimen/margin_quadruple"
style="@style/MwmWidget.MapButton"
android:layout_alignParentStart="true"
android:background="?nav_background"
android:src="@drawable/ic_menu_bookmarks"
android:tint="@null"/>
android:layout_marginBottom="@dimen/margin_half"
android:contentDescription="@string/bookmarks"
android:src="@drawable/ic_bookmarks" />
<RelativeLayout
android:id="@+id/search_frame"
android:layout_width="192dp"
android:layout_height="192dp"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_alignParentStart="true"
android:layout_marginTop="-68dp"
android:layout_below="@id/btn_bookmarks"
android:layout_marginStart="-68dp"
android:layout_marginStart="-56dp"
android:background="?searchLayoutBackground"
android:elevation="6dp"
android:visibility="invisible"
tools:visibility="visible">
<ImageView
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_fuel"
android:layout_marginTop="@dimen/margin_half_plus"
android:layout_marginStart="@dimen/margin_half_plus"
style="@style/MwmWidget.SearchNavigationButton"
style="@style/MwmWidget.MapButton.Search"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_routing_fuel_on"/>
<ImageView
android:id="@+id/search_parking"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_marginTop="@dimen/margin_double"
android:layout_toEndOf="@id/search_fuel"
android:src="@drawable/ic_routing_parking_on"/>
<ImageView
android:id="@+id/search_eat"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/margin_half_plus"
android:layout_centerVertical="true"
android:src="@drawable/ic_routing_eat_on"/>
<ImageView
android:id="@+id/search_food"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/margin_double"
android:layout_toEndOf="@id/search_fuel"
android:src="@drawable/ic_routing_food_on"/>
<ImageView
android:id="@+id/search_atm"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_marginBottom="@dimen/margin_half_plus"
android:layout_marginStart="@dimen/margin_half_plus"
android:layout_marginTop="@dimen/margin_half"
android:contentDescription="@string/fuel"
android:src="@drawable/ic_routing_fuel_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_parking"
style="@style/MwmWidget.MapButton.Search"
android:layout_marginTop="@dimen/margin_base_plus"
android:layout_toEndOf="@id/search_fuel"
android:contentDescription="@string/parkings"
android:src="@drawable/ic_routing_parking_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_eat"
style="@style/MwmWidget.MapButton.Search"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/margin_half"
android:contentDescription="@string/eat"
android:src="@drawable/ic_routing_eat_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_food"
style="@style/MwmWidget.MapButton.Search"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/margin_base_plus"
android:layout_toEndOf="@id/search_fuel"
android:contentDescription="@string/shopping"
android:src="@drawable/ic_routing_food_on" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/search_atm"
style="@style/MwmWidget.MapButton.Search"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_routing_atm_on"/>
android:layout_marginStart="@dimen/margin_half_plus"
android:layout_marginBottom="@dimen/margin_half"
android:contentDescription="@string/atm"
android:src="@drawable/ic_routing_atm_on" />
</RelativeLayout>
<ImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btn_search"
style="@style/MwmWidget.SearchNavigationButton"
android:layout_width="@dimen/margin_quadruple"
android:layout_height="@dimen/margin_quadruple"
style="@style/MwmWidget.MapButton"
android:layout_below="@id/btn_bookmarks"
android:layout_alignParentStart="true"
android:background="?nav_background"
android:src="@drawable/ic_menu_search"
android:tint="@null"/>
android:contentDescription="@string/search"
android:src="@drawable/ic_search" />
</RelativeLayout>

View file

@ -18,6 +18,8 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/action_bar_extended_height"
android:layout_marginBottom="@dimen/nav_my_position_bottom"
android:clipChildren="false"
android:clipToPadding="false"
android:layoutDirection="ltr"
android:padding="@dimen/nav_frame_padding"
android:theme="?navButtonsTheme">
@ -25,41 +27,27 @@
layout="@layout/layout_nav_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_base"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/zoom_buttons_container"
<include
layout="@layout/map_navigation_buttons_zoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/margin_base"
android:layout_marginBottom="@dimen/margin_half"
app:layout_constraintBottom_toTopOf="@+id/layers_button"
app:layout_constraintEnd_toEndOf="parent">
<ImageButton
android:id="@+id/nav_zoom_in"
style="@style/MwmWidget.MapButton"
android:src="@drawable/ic_plus"
app:layout_constraintBottom_toTopOf="@+id/nav_zoom_out"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/nav_zoom_out"
style="@style/MwmWidget.MapButton"
android:src="@drawable/ic_minus"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageButton
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/layers_button"
style="@style/MwmWidget.MapButton"
android:layout_marginBottom="@dimen/margin_base"
android:background="?nav_background"
android:layout_marginBottom="@dimen/margin_half"
android:contentDescription="@string/layers_title"
android:src="@drawable/ic_layers"
app:layout_constraintBottom_toTopOf="@+id/my_position"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/my_position"
style="@style/MwmWidget.MapButton"
android:contentDescription="@string/core_my_position"

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/zoom_buttons_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/nav_zoom_in"
style="@style/MwmWidget.MapButton"
android:src="@drawable/ic_plus"
android:layout_marginBottom="@dimen/margin_half"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/nav_zoom_out"
style="@style/MwmWidget.MapButton"
android:src="@drawable/ic_minus" />
</LinearLayout>

View file

@ -138,7 +138,7 @@
<dimen name="nav_menu_content_height">64dp</dimen>
<dimen name="nav_menu_landscape_width">360dp</dimen>
<dimen name="nav_frame_padding">@dimen/margin_eighth</dimen>
<dimen name="nav_frame_padding">@dimen/margin_half</dimen>
<dimen name="nav_my_position_bottom">136dp</dimen>
<dimen name="panel_elevation">12dp</dimen>

View file

@ -9,12 +9,18 @@
<style name="MwmWidget.Downloader"/>
<style name="MwmWidget.MapButton" parent="android:Widget.ImageButton">
<item name="android:scaleType">center</item>
<item name="android:layout_height">64dp</item>
<item name="android:layout_width">64dp</item>
<item name="android:background">?nav_background</item>
<style name="MwmWidget.MapButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:backgroundTint">?cardBackground</item>
<item name="android:alpha">0.8</item>
<item name="android:tint">?iconTint</item>
<item name="fabCustomSize">48dp</item>
<item name="borderWidth">0dp</item>
</style>
<style name="MwmWidget.MapButton.Search">
<item name="fabCustomSize">38dp</item>
</style>
<style name="MwmWidget.Button">
@ -307,14 +313,6 @@
<item name="android:textAppearance">@style/MwmTextAppearance.Toolbar.Title.Button</item>
</style>
<style name="MwmWidget.SearchNavigationButton" parent="android:Widget.ImageButton">
<item name="android:scaleType">center</item>
<item name="android:layout_height">44dp</item>
<item name="android:layout_width">44dp</item>
<item name="android:background">?selectableItemBackgroundBorderless</item>
<item name="android:tint">?iconTint</item>
</style>
<style name="MwmWidget.Discovery.Item.Button" parent="android:Widget.TextView">
<item name="android:minHeight">@dimen/discovery_button_min_height</item>
<item name="android:gravity">center</item>

View file

@ -73,7 +73,6 @@
<attr name="tipsBgColor" format="color" />
<attr name="tipsPrimaryTextColor" format="color" />
<attr name="tipsSecondaryTextColor" format="color" />
<attr name="bgCrown" format="reference" />
<attr name="bgDogBtn" format="reference" />
<attr name="guidesTime" format="reference" />
<attr name="guidesAltitude" format="reference" />
@ -84,9 +83,6 @@
<attr name="bgRoundedCard" format="reference" />
<attr name="tintLonelyPlanetLogo" format="color" />
</declare-styleable>
<declare-styleable name="ThemeAttrs.NavButtons">
<attr name="nav_background" format="reference" />
</declare-styleable>
<declare-styleable name="ThemeAttrs.Downloader">
<attr name="status_done" format="reference" />
<attr name="status_downloadable" format="reference" />

View file

@ -147,7 +147,6 @@
<item name="fontCaption">@style/TextAppearance.MdcTypographyStyles.Caption</item>
<item name="fontOverline">@style/TextAppearance.MdcTypographyStyles.Overline</item>
<item name="drivingOptionsViewBg">@color/light_green</item>
<item name="bgCrown">@drawable/bg_crown</item>
<item name="bgDogBtn">@drawable/ic_dog_bg</item>
<item name="elevationProfilePropertyBg">@drawable/bg_rounded_rect</item>
<item name="elevationProfilePropIconTint">@color/black_secondary</item>
@ -315,7 +314,6 @@
<item name="fontCaption">@style/TextAppearance.MdcTypographyStyles.Caption</item>
<item name="fontOverline">@style/TextAppearance.MdcTypographyStyles.Overline</item>
<item name="drivingOptionsViewBg">@color/driving_options_bg_black</item>
<item name="bgCrown">@drawable/bg_crown_night</item>
<item name="bgDogBtn">@drawable/ic_dog_bg_night</item>
<item name="elevationProfilePropertyBg">@drawable/bg_rounded_rect_night</item>
<item name="elevationProfilePropIconTint">@color/white_secondary</item>

View file

@ -161,12 +161,10 @@
</style>
<style name="MwmTheme.NavButtons">
<item name="nav_background">@drawable/button_navigation_circle</item>
<item name="searchLayoutBackground">@drawable/bg_circle_panel</item>
</style>
<style name="MwmTheme.NavButtons.Night" parent="MwmTheme.Night">
<item name="nav_background">@drawable/button_navigation_circle_night</item>
<item name="searchLayoutBackground">@drawable/bg_circle_panel_night</item>
</style>

View file

@ -1,22 +1,20 @@
package com.mapswithme.maps.maplayer;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.mapswithme.maps.R;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.routing.SearchWheel;
import com.mapswithme.maps.widget.menu.MyPositionButton;
import com.mapswithme.maps.widget.placepage.PlacePageController;
import com.mapswithme.util.Config;
import com.mapswithme.util.Graphics;
import com.mapswithme.util.UiUtils;
public class MapButtonsController
@ -26,7 +24,7 @@ public class MapButtonsController
@NonNull
private final View mZoomFrame;
@NonNull
private final ImageButton mLayersButton;
private final FloatingActionButton mLayersButton;
@NonNull
private final View myPosition;
@NonNull
@ -39,8 +37,7 @@ public class MapButtonsController
private final SearchWheel mSearchWheel;
private final PlacePageController mPlacePageController;
private final float mBottomMargin;
private final int mButtonWidth;
private final float mInitialButtonMargin;
private final float mButtonWidth;
private float mTopLimit;
private float mContentHeight;
private float mContentWidth;
@ -63,15 +60,18 @@ public class MapButtonsController
mSearchButtonFrame = activity.findViewById(R.id.search_button_frame);
mSearchWheel = new SearchWheel(frame, (v) -> mapButtonClickListener.onClick(MapButtons.navSearch));
ImageView bookmarkButton = mSearchButtonFrame.findViewById(R.id.btn_bookmarks);
bookmarkButton.setOnClickListener((v) -> mapButtonClickListener.onClick(MapButtons.navBookmarks));
bookmarkButton.setImageDrawable(Graphics.tint(bookmarkButton.getContext(), R.drawable.ic_menu_bookmarks));
mSearchButtonFrame.findViewById(R.id.btn_bookmarks)
.setOnClickListener((v) -> mapButtonClickListener.onClick(MapButtons.navBookmarks));
// Used to get the maximum height the buttons will evolve in
frame.addOnLayoutChangeListener(new MapButtonsController.ContentViewLayoutChangeListener(frame));
mBottomMargin = ((RelativeLayout.LayoutParams) mButtonsFrame.getLayoutParams()).bottomMargin;
mInitialButtonMargin = ((ConstraintLayout.LayoutParams) mZoomFrame.getLayoutParams()).bottomMargin;
mButtonWidth = mLayersButton.getLayoutParams().width;
TypedArray a = frame.getContext().getTheme().obtainStyledAttributes(
R.style.MwmWidget_MapButton,
new int[] { R.attr.fabCustomSize });
mButtonWidth = a.getDimension(0, 0);
a.recycle();
}
public void showButton(boolean show, MapButtonsController.MapButtons button)
@ -109,15 +109,6 @@ public class MapButtonsController
final float appliedTranslation = translation <= 0 ? translation : 0;
mButtonsFrame.setTranslationY(appliedTranslation);
// Reduce buttons margin to move them only if necessary
// Zoom frame is above the layers so if must move twice as much
final float appliedMarginTranslationLayers = Math.min(-appliedTranslation, mInitialButtonMargin);
final float maxZoomTranslation = UiUtils.isVisible(mLayersButton) ? 2 * mInitialButtonMargin : mInitialButtonMargin;
final float appliedMarginTranslationZoomFrame = Math.min(-appliedTranslation, maxZoomTranslation);
mLayersButton.setTranslationY(appliedMarginTranslationLayers);
mSearchButtonFrame.setTranslationY(appliedMarginTranslationLayers);
mZoomFrame.setTranslationY(appliedMarginTranslationZoomFrame);
updateButtonsVisibility(appliedTranslation);
}

View file

@ -8,6 +8,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.mapswithme.maps.R;
import com.mapswithme.maps.location.LocationState;
import com.mapswithme.maps.routing.RoutingController;
@ -20,7 +21,7 @@ public class MyPositionButton
private static final int FOLLOW_SHIFT = 1;
@NonNull
private final ImageView mButton;
private final FloatingActionButton mButton;
private static final SparseArray<Drawable> mIcons = new SparseArray<>(); // Location mode -> Button icon
private int mMode;
@ -30,7 +31,7 @@ public class MyPositionButton
public MyPositionButton(@NonNull View button, @NonNull View.OnClickListener listener)
{
mButton = (ImageView) button;
mButton = (FloatingActionButton) button;
mVisible = UiUtils.isVisible(mButton);
mButton.setOnClickListener(listener);
mIcons.clear();