[android] Added divider between layers bloack and menu options

[android] Added tinting for menu option icons
This commit is contained in:
Александр Зацепин 2020-04-20 18:16:59 +03:00 committed by yoksnod
parent 52363336f2
commit 38d2660f47
4 changed files with 85 additions and 68 deletions

View file

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

View file

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

View file

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?cardBackground"
android:orientation="vertical"
android:padding="@dimen/margin_base">
<TextView
@ -26,56 +25,68 @@
android:layout_marginTop="@dimen/margin_base_plus"
android:minHeight="@dimen/toggle_map_layer_frame_height" />
</LinearLayout>
<TextView
android:id="@+id/add_place"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_plus"
android:text="@string/placepage_add_place_button"
tools:background="#40FF00FF" />
<TextView
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" />
<TextView
android:id="@+id/hotel_search"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_hotel_search"
android:text="@string/booking_button_toolbar"
tools:background="#200000FF" />
<FrameLayout
android:id="@+id/download_maps_container"
<include layout="@layout/list_divider" />
<include
layout="@layout/list_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="@dimen/divider_height"
android:layout_marginTop="@dimen/margin_half_plus" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?cardBackground"
android:orientation="vertical">
<TextView
android:id="@+id/download_maps"
android:id="@+id/add_place"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_download"
android:text="@string/download_maps"
tools:background="#2000FF00" />
android:drawableStart="@drawable/ic_plus"
android:text="@string/placepage_add_place_button"
tools:background="#40FF00FF" />
<TextView
android:id="@+id/counter"
style="@style/MwmWidget.Counter"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="@dimen/margin_base"
android:visibility="gone"
tools:text="9999"
tools:visibility="visible" />
</FrameLayout>
<TextView
android:id="@+id/settings"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_settings"
android:text="@string/settings"
tools:background="#20FF0000" />
<TextView
android:id="@+id/share"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_share"
android:text="@string/share_my_location"
tools:background="#400FF000" />
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" />
<TextView
android:id="@+id/hotel_search"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_hotel_search"
android:text="@string/booking_button_toolbar"
tools:background="#200000FF" />
<FrameLayout
android:id="@+id/download_maps_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/download_maps"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_download"
android:text="@string/download_maps"
tools:background="#2000FF00" />
<TextView
android:id="@+id/counter"
style="@style/MwmWidget.Counter"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="@dimen/margin_base"
android:visibility="gone"
tools:text="9999"
tools:visibility="visible" />
</FrameLayout>
<TextView
android:id="@+id/settings"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_settings"
android:text="@string/settings"
tools:background="#20FF0000" />
<TextView
android:id="@+id/share"
style="@style/MwmTheme.Menu.Content.ListItem"
android:drawableStart="@drawable/ic_menu_share"
android:text="@string/share_my_location"
tools:background="#400FF000" />
</LinearLayout>
</LinearLayout>

View file

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