From 38d2660f470a5337bcf653e8bfe48d358a649504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Mon, 20 Apr 2020 18:16:59 +0300 Subject: [PATCH] [android] Added divider between layers bloack and menu options [android] Added tinting for menu option icons --- .../layout-land/main_menu_bottom_sheet.xml | 2 +- android/res/layout/main_menu_bottom_sheet.xml | 2 +- android/res/layout/menu_content.xml | 111 ++++++++++-------- .../maps/widget/menu/MainMenuRenderer.java | 38 +++--- 4 files changed, 85 insertions(+), 68 deletions(-) diff --git a/android/res/layout-land/main_menu_bottom_sheet.xml b/android/res/layout-land/main_menu_bottom_sheet.xml index 0dc379f7ab..9e5607f3ee 100644 --- a/android/res/layout-land/main_menu_bottom_sheet.xml +++ b/android/res/layout-land/main_menu_bottom_sheet.xml @@ -5,7 +5,7 @@ android:id="@+id/main_menu_sheet" android:layout_width="@dimen/main_menu_bottom_sheet_width" android:layout_height="wrap_content" - android:background="?cardBackground" + android:background="?windowBackgroundForced" android:clickable="true" android:focusable="true" android:fillViewport="true" diff --git a/android/res/layout/main_menu_bottom_sheet.xml b/android/res/layout/main_menu_bottom_sheet.xml index 545b5938bb..8ac64e5199 100644 --- a/android/res/layout/main_menu_bottom_sheet.xml +++ b/android/res/layout/main_menu_bottom_sheet.xml @@ -5,7 +5,7 @@ android:id="@+id/main_menu_sheet" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?cardBackground" + android:background="?windowBackgroundForced" android:clickable="true" android:focusable="true" android:fillViewport="true" diff --git a/android/res/layout/menu_content.xml b/android/res/layout/menu_content.xml index dd0af1c2d7..3d2a4f9880 100644 --- a/android/res/layout/menu_content.xml +++ b/android/res/layout/menu_content.xml @@ -4,12 +4,11 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="@dimen/margin_half" - android:layout_marginBottom="@dimen/margin_half" android:orientation="vertical"> - - - - + + android:layout_height="@dimen/divider_height" + android:layout_marginTop="@dimen/margin_half_plus" /> + + android:drawableStart="@drawable/ic_plus" + android:text="@string/placepage_add_place_button" + tools:background="#40FF00FF" /> - - - + android:id="@+id/download_guides" + style="@style/MwmTheme.Menu.Content.ListItem" + android:drawableStart="@drawable/ic_menu_download_guides" + android:drawableTint="?attr/colorAccent" + android:text="@string/download_guides" + android:textColor="?attr/colorAccent" + tools:background="#403033FF" + tools:targetApi="m" /> + + + + + + + + diff --git a/android/src/com/mapswithme/maps/widget/menu/MainMenuRenderer.java b/android/src/com/mapswithme/maps/widget/menu/MainMenuRenderer.java index b80cd64796..a7c5f3f937 100644 --- a/android/src/com/mapswithme/maps/widget/menu/MainMenuRenderer.java +++ b/android/src/com/mapswithme/maps/widget/menu/MainMenuRenderer.java @@ -1,6 +1,7 @@ package com.mapswithme.maps.widget.menu; import android.view.View; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -9,9 +10,10 @@ import androidx.recyclerview.widget.RecyclerView; import com.mapswithme.maps.R; import com.mapswithme.maps.adapter.OnItemClickListener; import com.mapswithme.maps.maplayer.BottomSheetItem; -import com.mapswithme.maps.maplayer.LayersUtils; import com.mapswithme.maps.maplayer.LayersAdapter; +import com.mapswithme.maps.maplayer.LayersUtils; import com.mapswithme.maps.widget.recycler.SpanningLinearLayoutManager; +import com.mapswithme.util.Graphics; import java.util.Objects; @@ -19,9 +21,6 @@ public class MainMenuRenderer implements MenuRenderer { @NonNull private final MainMenuOptionListener mListener; - @SuppressWarnings("NullableProblems") - @NonNull - private RecyclerView mLayersRecycler; @NonNull @SuppressWarnings("NullableProblems") private LayersAdapter mLayersAdapter; @@ -42,32 +41,39 @@ public class MainMenuRenderer implements MenuRenderer { Objects.requireNonNull(view); initLayersRecycler(view); - View addPlace = view.findViewById(R.id.add_place); + TextView addPlace = view.findViewById(R.id.add_place); addPlace.setOnClickListener(v -> mListener.onAddPlaceOptionSelected()); - View downloadGuides = view.findViewById(R.id.download_guides); + Graphics.tint(addPlace); + TextView downloadGuides = view.findViewById(R.id.download_guides); downloadGuides.setOnClickListener(v -> mListener.onSearchGuidesOptionSelected()); - View hotelSearch = view.findViewById(R.id.hotel_search); + Graphics.tint(downloadGuides); + TextView hotelSearch = view.findViewById(R.id.hotel_search); hotelSearch.setOnClickListener(v -> mListener.onHotelSearchOptionSelected()); - View downloadMaps = view.findViewById(R.id.download_maps_container); - downloadMaps.setOnClickListener(v -> mListener.onDownloadMapsOptionSelected()); - View settings = view.findViewById(R.id.settings); + Graphics.tint(hotelSearch); + View downloadMapsContainer = view.findViewById(R.id.download_maps_container); + downloadMapsContainer.setOnClickListener(v -> mListener.onDownloadMapsOptionSelected()); + TextView downloadMaps = view.findViewById(R.id.download_maps); + Graphics.tint(downloadMaps); + TextView settings = view.findViewById(R.id.settings); settings.setOnClickListener(v -> mListener.onSettingsOptionSelected()); - View share = view.findViewById(R.id.share); + Graphics.tint(settings); + TextView share = view.findViewById(R.id.share); share.setOnClickListener(v -> mListener.onShareLocationOptionSelected()); + Graphics.tint(share); } private void initLayersRecycler(@NonNull View view) { - mLayersRecycler = view.findViewById(R.id.layers_recycler); - RecyclerView.LayoutManager layoutManager = new SpanningLinearLayoutManager(mLayersRecycler.getContext(), + RecyclerView layersRecycler = view.findViewById(R.id.layers_recycler); + RecyclerView.LayoutManager layoutManager = new SpanningLinearLayoutManager(layersRecycler.getContext(), LinearLayoutManager.HORIZONTAL, false); - mLayersRecycler.setLayoutManager(layoutManager); - mLayersAdapter = new LayersAdapter(LayersUtils.createItems(mLayersRecycler.getContext(), + layersRecycler.setLayoutManager(layoutManager); + mLayersAdapter = new LayersAdapter(LayersUtils.createItems(layersRecycler.getContext(), new SubwayItemClickListener(), new TrafficItemClickListener(), new IsolinesItemClickListener())); - mLayersRecycler.setAdapter(mLayersAdapter); + layersRecycler.setAdapter(mLayersAdapter); } @Override