forked from organicmaps/organicmaps
[android] New type circle button for Filter
This commit is contained in:
parent
1775175bd8
commit
436465c09d
13 changed files with 79 additions and 12 deletions
10
android/res/drawable/button_accent_round.xml
Normal file
10
android/res/drawable/button_accent_round.xml
Normal file
|
@ -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>
|
7
android/res/drawable/button_accent_round_disabled.xml
Normal file
7
android/res/drawable/button_accent_round_disabled.xml
Normal file
|
@ -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>
|
|
@ -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>
|
10
android/res/drawable/button_accent_round_night.xml
Normal file
10
android/res/drawable/button_accent_round_night.xml
Normal file
|
@ -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>
|
7
android/res/drawable/button_accent_round_normal.xml
Normal file
7
android/res/drawable/button_accent_round_normal.xml
Normal file
|
@ -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>
|
|
@ -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>
|
7
android/res/drawable/button_accent_round_pressed.xml
Normal file
7
android/res/drawable/button_accent_round_pressed.xml
Normal file
|
@ -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>
|
|
@ -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>
|
|
@ -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"
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
@ -157,6 +158,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>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue