From 33855ba805c19cef46bbb27b81f8e8b0f52a3bdf Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Tue, 16 Feb 2016 14:30:07 +0200 Subject: [PATCH] Fixing raster map menu design. --- .../res/layout/drawer_list_material_item.xml | 2 +- OsmAnd/res/layout/progress_list_item.xml | 20 ++++++++++++------- OsmAnd/res/layout/two_line_list_item.xml | 14 ++++++++----- .../osmand/plus/dialogs/RasterMapMenu.java | 15 ++++++++------ 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/OsmAnd/res/layout/drawer_list_material_item.xml b/OsmAnd/res/layout/drawer_list_material_item.xml index 9ffae78607..f1a77a9e65 100644 --- a/OsmAnd/res/layout/drawer_list_material_item.xml +++ b/OsmAnd/res/layout/drawer_list_material_item.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="56dp" + android:minHeight="54dp" android:orientation="horizontal" android:paddingLeft="16dp" android:paddingRight="16dp"> diff --git a/OsmAnd/res/layout/progress_list_item.xml b/OsmAnd/res/layout/progress_list_item.xml index ab977b8013..bdd7eb26e5 100644 --- a/OsmAnd/res/layout/progress_list_item.xml +++ b/OsmAnd/res/layout/progress_list_item.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="74dp" android:descendantFocusability="blocksDescendants" android:gravity="center_vertical" android:minHeight="@dimen/list_item_height" @@ -13,24 +13,30 @@ + android:layout_height="0dp" + android:layout_weight="1"> + + android:layout_height="wrap_content" + tools:src="@drawable/ic_action_opacity"/> + + android:layout_height="wrap_content" + android:max="255"/> \ No newline at end of file diff --git a/OsmAnd/res/layout/two_line_list_item.xml b/OsmAnd/res/layout/two_line_list_item.xml index f39c1ae2bc..acbb8b13bd 100644 --- a/OsmAnd/res/layout/two_line_list_item.xml +++ b/OsmAnd/res/layout/two_line_list_item.xml @@ -3,11 +3,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="72dp" android:descendantFocusability="blocksDescendants" android:gravity="center_vertical" - android:minHeight="@dimen/list_item_height" android:orientation="horizontal" + android:paddingTop="12dp" + android:paddingBottom="12dp" android:paddingLeft="16dp" android:paddingRight="16dp"> @@ -22,14 +23,16 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="vertical"> @@ -37,8 +40,9 @@ adapter, View view, int itemId, int pos) { - Log.v(TAG, "onRowItemClick(" + "adapter=" + adapter + ", view=" + view + ", itemId=" + itemId + ", pos=" + pos + ")"); if (itemId == mapTypeString) { if (selected) { plugin.selectMapOverlayLayer(mapActivity.getMapView(), mapTypePreference, @@ -108,7 +106,8 @@ public class RasterMapMenu { int selectedCode = selected ? 1 : 0; mapTypeDescr = selected ? mapTypeDescr : mapActivity.getString(R.string.shared_string_none); contextMenuAdapter.item(toggleActionStringId).listen(l).selected(selectedCode).reg(); - contextMenuAdapter.item(mapTypeString).listen(l).layout(R.layout.two_line_list_item).description(mapTypeDescr).reg(); + contextMenuAdapter.item(mapTypeString).listen(l).layout(R.layout.two_line_list_item) + .description(mapTypeDescr).reg(); ContextMenuAdapter.OnIntegerValueChangedListener integerListener = new ContextMenuAdapter.OnIntegerValueChangedListener() { @Override @@ -119,10 +118,14 @@ public class RasterMapMenu { } }; // android:max="255" in layout is expected - contextMenuAdapter.item(mapTypeStringTransparency).layout(R.layout.progress_list_item) - .progress(mapTransparencyPreference.get()).listenInteger(integerListener).reg(); + contextMenuAdapter.item(mapTypeStringTransparency) + .layout(R.layout.progress_list_item) + .iconColor(R.drawable.ic_action_opacity) + .progress(mapTransparencyPreference.get()) + .listenInteger(integerListener).reg(); if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) { - contextMenuAdapter.item(R.string.show_polygons).listen(l).selected(hidePolygonsPref.get() ? 0 : 1).reg(); + contextMenuAdapter.item(R.string.show_polygons).listen(l) + .selected(hidePolygonsPref.get() ? 0 : 1).reg(); } }