optical feedback on habit button +/- touch

This commit is contained in:
Max Dörfler 2015-12-16 14:39:32 +01:00
parent 52018f7009
commit 5851bacb98
3 changed files with 37 additions and 16 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:id="@android:id/mask"
android:drawable="@color/brand" />
</ripple>

View file

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="#33000000" />
</shape>
</item>
<item android:state_focused="true" >
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="#33000000" />
</shape>
</item>
<item>

View file

@ -25,26 +25,40 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/btnLayout">
<Button
android:id="@+id/btnPlus"
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="@{habit.up ? View.VISIBLE : View.GONE}"
android:text="+"
android:background="@{habit.down ? @drawable/btn_habit_background : @drawable/btn_habit_single_background}"
app:backgroundColor="@{habit.getLightTaskColor}"
style="@style/HabitButton" />
<Button
android:id="@+id/btnMinus"
android:layout_weight="1">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
app:backgroundColor="@{habit.getLightTaskColor}"/>
<Button
android:id="@+id/btnPlus"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="+"
android:background="@drawable/btn_habit_background"
style="@style/HabitButton" />
</FrameLayout>
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="@{habit.down ? View.VISIBLE : View.GONE}"
app:backgroundColor="@{habit.up ? habit.getMediumTaskColor : habit.getLightTaskColor}"
android:text="-"
android:background="@{habit.up ? @drawable/btn_habit_background : @drawable/btn_habit_single_background}"
style="@style/HabitButton"/>
android:layout_weight="1">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
app:backgroundColor="@{habit.up ? habit.getMediumTaskColor : habit.getLightTaskColor}"/>
<Button
android:id="@+id/btnMinus"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="-"
android:background="@drawable/btn_habit_background"
style="@style/HabitButton"/>
</FrameLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"