diff options
author | Roman Romanov <rromanov@65gb.net> | 2017-04-25 12:04:11 +0300 |
---|---|---|
committer | Roman Romanov <rromanov@65gb.net> | 2017-04-26 08:39:30 +0300 |
commit | f11133834c80496aadd6d97a0c06418d69180e0a (patch) | |
tree | 2d53de5131317e89da45e68f089cbd3077d691e1 /android | |
parent | 6e031971dc7a39d39eaab2a18622ed6c3ccc7ad6 (diff) |
[android] New type circle button for Filter
Diffstat (limited to 'android')
13 files changed, 79 insertions, 12 deletions
diff --git a/android/res/drawable/button_accent_round.xml b/android/res/drawable/button_accent_round.xml new file mode 100644 index 0000000000..3a1913237f --- /dev/null +++ b/android/res/drawable/button_accent_round.xml @@ -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/button_accent_round_pressed" + android:state_pressed="true"/> + + <item android:drawable="@drawable/button_accent_round_normal" + android:state_enabled="true"/> + + <item android:drawable="@drawable/button_accent_round_disabled"/> +</selector> diff --git a/android/res/drawable/button_accent_round_disabled.xml b/android/res/drawable/button_accent_round_disabled.xml new file mode 100644 index 0000000000..2bb7fd67cf --- /dev/null +++ b/android/res/drawable/button_accent_round_disabled.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@color/button_accent_disabled"/> + <size android:height="@dimen/hotel_filters_tag_height"/> + <corners android:radius="@dimen/margin_base"/> +</shape> diff --git a/android/res/drawable/button_accent_round_disabled_night.xml b/android/res/drawable/button_accent_round_disabled_night.xml new file mode 100644 index 0000000000..4812137a29 --- /dev/null +++ b/android/res/drawable/button_accent_round_disabled_night.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@color/button_accent_disabled_night"/> + <size android:height="@dimen/hotel_filters_tag_height"/> + <corners android:radius="@dimen/margin_base"/> +</shape> diff --git a/android/res/drawable/button_accent_round_night.xml b/android/res/drawable/button_accent_round_night.xml new file mode 100644 index 0000000000..231320010b --- /dev/null +++ b/android/res/drawable/button_accent_round_night.xml @@ -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/button_accent_round_pressed_night" + android:state_pressed="true"/> + + <item android:drawable="@drawable/button_accent_round_normal_night" + android:state_enabled="true"/> + + <item android:drawable="@drawable/button_accent_round_disabled_night"/> +</selector> diff --git a/android/res/drawable/button_accent_round_normal.xml b/android/res/drawable/button_accent_round_normal.xml new file mode 100644 index 0000000000..26a305f8f4 --- /dev/null +++ b/android/res/drawable/button_accent_round_normal.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@color/button_accent"/> + <size android:height="@dimen/hotel_filters_tag_height"/> + <corners android:radius="@dimen/margin_base"/> +</shape> diff --git a/android/res/drawable/button_accent_round_normal_night.xml b/android/res/drawable/button_accent_round_normal_night.xml new file mode 100644 index 0000000000..6b3ec343c8 --- /dev/null +++ b/android/res/drawable/button_accent_round_normal_night.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@color/button_accent_night"/> + <size android:height="@dimen/hotel_filters_tag_height"/> + <corners android:radius="@dimen/margin_base"/> +</shape> diff --git a/android/res/drawable/button_accent_round_pressed.xml b/android/res/drawable/button_accent_round_pressed.xml new file mode 100644 index 0000000000..16cd98fa83 --- /dev/null +++ b/android/res/drawable/button_accent_round_pressed.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@color/button_accent_pressed"/> + <size android:height="@dimen/hotel_filters_tag_height"/> + <corners android:radius="@dimen/margin_base"/> +</shape> diff --git a/android/res/drawable/button_accent_round_pressed_night.xml b/android/res/drawable/button_accent_round_pressed_night.xml new file mode 100644 index 0000000000..4c764c850c --- /dev/null +++ b/android/res/drawable/button_accent_round_pressed_night.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@color/button_accent_pressed_night"/> + <size android:height="@dimen/hotel_filters_tag_height"/> + <corners android:radius="@dimen/margin_base"/> +</shape> diff --git a/android/res/layout/search_filter_panel.xml b/android/res/layout/search_filter_panel.xml index a810466a0a..871f609094 100644 --- a/android/res/layout/search_filter_panel.xml +++ b/android/res/layout/search_filter_panel.xml @@ -4,8 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/filter_frame" android:layout_width="match_parent" - android:layout_height="@dimen/height_block_base" - android:padding="@dimen/margin_half" + android:layout_height="@dimen/margin_double_and_half" + android:padding="@dimen/margin_quarter" android:background="?cardBackground" android:clipToPadding="false" android:visibility="gone" @@ -28,15 +28,15 @@ <RelativeLayout android:id="@+id/filter_button" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:paddingLeft="@dimen/margin_half" - android:paddingRight="@dimen/margin_half" + android:layout_height="@dimen/hotel_filters_tag_height" + android:paddingLeft="@dimen/margin_half_plus" + android:paddingRight="@dimen/margin_half_plus" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" + android:layout_centerVertical="true" android:background="?clickableBackground" android:visibility="gone" - tools:background="?accentButtonBackground" - tools:elevation="@dimen/margin_quarter" + tools:background="?accentButtonRoundBackground" tools:visibility="visible"> <ImageView android:id="@+id/filter_icon" diff --git a/android/res/values/themes-attrs.xml b/android/res/values/themes-attrs.xml index e96a688d36..4c1bc0897a 100644 --- a/android/res/values/themes-attrs.xml +++ b/android/res/values/themes-attrs.xml @@ -40,6 +40,7 @@ <attr name="buttonDialogTextColor" format="color"/> <attr name="accentButtonBackground" format="reference"/> + <attr name="accentButtonRoundBackground" format="reference"/> <attr name="accentButtonTextColor" format="color"/> <attr name="accentButtonTextColorDisabled" format="color"/> diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml index 187154463c..6fbcfc815e 100644 --- a/android/res/values/themes-base.xml +++ b/android/res/values/themes-base.xml @@ -51,6 +51,7 @@ <item name="buttonDialogTextColor">@color/base_accent</item> <item name="accentButtonBackground">@drawable/button_accent</item> + <item name="accentButtonRoundBackground">@drawable/button_accent_round</item> <item name="accentButtonTextColor">@color/button_accent_text</item> <item name="accentButtonTextColorDisabled">@color/button_accent_text_disabled</item> @@ -156,6 +157,7 @@ <item name="buttonDialogTextColor">@color/base_accent_night</item> <item name="accentButtonBackground">@drawable/button_accent_night</item> + <item name="accentButtonRoundBackground">@drawable/button_accent_round_night</item> <item name="accentButtonTextColor">@color/button_accent_text_night</item> <item name="accentButtonTextColorDisabled">@color/button_accent_text_disabled_night</item> diff --git a/android/src/com/mapswithme/maps/search/HotelsFilterView.java b/android/src/com/mapswithme/maps/search/HotelsFilterView.java index c995e37f03..fce3e7d8c8 100644 --- a/android/src/com/mapswithme/maps/search/HotelsFilterView.java +++ b/android/src/com/mapswithme/maps/search/HotelsFilterView.java @@ -100,6 +100,9 @@ public class HotelsFilterView extends FrameLayout protected void onFinishInflate() { super.onFinishInflate(); + if (isInEditMode()) + return; + mFrame = findViewById(R.id.frame); mFrame.setTranslationY(mFrame.getResources().getDisplayMetrics().heightPixels); mFade = findViewById(R.id.fade); @@ -152,6 +155,9 @@ public class HotelsFilterView extends FrameLayout { super.onMeasure(widthMeasureSpec, heightMeasureSpec); + if (isInEditMode()) + return; + mContent.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); mElevation.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int height = mContent.getMeasuredHeight() + mHeaderHeight + mButtonsHeight diff --git a/android/src/com/mapswithme/maps/search/SearchFilterController.java b/android/src/com/mapswithme/maps/search/SearchFilterController.java index 556de6de9e..439dce9288 100644 --- a/android/src/com/mapswithme/maps/search/SearchFilterController.java +++ b/android/src/com/mapswithme/maps/search/SearchFilterController.java @@ -166,9 +166,7 @@ public class SearchFilterController mFilterIcon.setImageResource(R.drawable.ic_cancel); mFilterIcon.setColorFilter(ContextCompat.getColor(mFrame.getContext(), UiUtils.getStyledResourceId(mFrame.getContext(), R.attr.accentButtonTextColor))); - UiUtils.setBackgroundDrawable(mFilterButton, R.attr.accentButtonBackground); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) - mFilterButton.setElevation(mElevation); + UiUtils.setBackgroundDrawable(mFilterButton, R.attr.accentButtonRoundBackground); mFilterText.setTextColor(ContextCompat.getColor(mFrame.getContext(), UiUtils.getStyledResourceId(mFrame.getContext(), R.attr.accentButtonTextColor))); } @@ -179,8 +177,6 @@ public class SearchFilterController mFilterIcon.setColorFilter(ContextCompat.getColor(mFrame.getContext(), UiUtils.getStyledResourceId(mFrame.getContext(), R.attr.colorAccent))); UiUtils.setBackgroundDrawable(mFilterButton, R.attr.clickableBackground); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) - mFilterButton.setElevation(0); mFilterText.setTextColor(ContextCompat.getColor(mFrame.getContext(), UiUtils.getStyledResourceId(mFrame.getContext(), R.attr.colorAccent))); } |