redesign habit and todo list

This commit is contained in:
Phillip Thelen 2015-08-17 22:32:21 +02:00
parent 257bbaef4f
commit efadeeecb6
4 changed files with 124 additions and 93 deletions

View file

@ -20,7 +20,7 @@
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="50dp"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent"
android:checked="@{daily.completed}"
app:backgroundColor="@{daily.getLightTaskColor}"
@ -56,7 +56,7 @@
</LinearLayout>
<RelativeLayout android:orientation="vertical"
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="30dp"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="match_parent"
app:backgroundColor="@{daily.getLightTaskColor}"
android:visibility="@{daily.checklist.size > 0 ? View.VISIBLE : View.GONE}"
@ -74,8 +74,8 @@
android:layout_above="@+id/checklistDivider"/>
<View
android:id="@+id/checklistDivider"
android:layout_width="10dp"
android:layout_height="0.5dp"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white"
android:layout_centerInParent="true"/>
<TextView
@ -101,7 +101,7 @@
<View
android:id="@+id/bottomBorderView"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_height="@dimen/hairline_height"
android:background="@color/cell_separator"/>
</LinearLayout>
</layout>

View file

@ -11,59 +11,42 @@
type="Task" />
</data>
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="@dimen/cardMarginVertical"
android:layout_marginLeft="@dimen/cardMarginHorizontal"
android:layout_marginRight="@dimen/cardMarginHorizontal"
android:layout_marginTop="@dimen/cardMarginVertical"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp"
app:cardColor="@{habit.getLightTaskColor}">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/btnLayout">
<Button
android:id="@+id/btnPlus"
android:layout_width="@dimen/button_width"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.up ? View.VISIBLE : View.GONE}"
android:text="+"
android:textSize="15sp"
app:backgroundColor="@{habit.getLightTaskColor}" />
<Button
android:id="@+id/btnMinus"
android:layout_width="@dimen/button_width"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.down ? View.VISIBLE : View.GONE}"
app:backgroundColor="@{habit.getLightTaskColor}"
android:text="-"
android:textSize="15sp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="fill_horizontal|center_vertical|center_horizontal|fill|clip_vertical|fill_vertical|center|start|clip_horizontal|bottom|left|right|end|top"
android:minHeight="250dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/btnLayout">
<Button
android:id="@+id/btnPlus"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.up ? View.VISIBLE : View.GONE}"
android:text="+"
android:textSize="15sp"
app:backgroundColor="@{habit.getDarkTaskColor}" />
<Button
android:id="@+id/btnMinus"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="@{habit.down ? View.VISIBLE : View.GONE}"
app:backgroundColor="@{habit.getDarkTaskColor}"
android:text="-"
android:textSize="15sp"/>
</LinearLayout>
<CheckedTextView
android:layout_height="match_parent">
<TextView
android:id="@+id/checkedTextView"
style="@style/CardTitle"
android:layout_width="match_parent"
@ -71,8 +54,6 @@
android:layout_alignParentBottom="false"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/btnLayout"
android:layout_toEndOf="@id/btnLayout"
android:layout_alignParentTop="true"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
@ -91,8 +72,21 @@
android:layout_below="@+id/checkedTextView"
android:text="@{habit.notes}" />
<View
android:id="@+id/rightBorderView"
android:layout_width="5dp"
android:layout_height="match_parent"
app:backgroundColor="@{habit.getLightTaskColor}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/bottomBorderView"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/cell_separator"/>
</LinearLayout>
</layout>

View file

@ -3,46 +3,33 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.magicmicky.habitrpgwrapper.lib.models.tasks.Task" />
<import type="android.view.View"/>
<variable
name="todo"
type="Task" />
</data>
<FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white">
<LinearLayout
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginBottom="@dimen/cardMarginVertical"
android:layout_marginLeft="@dimen/cardMarginHorizontal"
android:layout_marginRight="@dimen/cardMarginHorizontal"
android:layout_marginTop="@dimen/cardMarginVertical"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
app:cardPreventCornerOverlap="false"
app:contentPadding="0dp"
app:cardColor="@{todo.getLightTaskColor}">
<LinearLayout
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/button_width"
android:layout_height="fill_parent"
android:checked="@{todo.completed}"
app:backgroundColor="@{todo.getLightTaskColor}"
android:gravity="center"/>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/textView6"
android:layout_alignLeft="@+id/checkedTextView"
android:layout_alignStart="@+id/checkedTextView">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:checked="@{todo.completed}"
app:backgroundColor="@{todo.getDarkTaskColor}"
android:gravity="center"/>
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
@ -62,10 +49,54 @@
android:layout_height="match_parent"
android:text="@{todo.notes}" />
</LinearLayout>
<RelativeLayout android:orientation="vertical"
android:id="@+id/checklistIndicatorWrapper"
android:layout_width="@dimen/checklist_wrapper_width"
android:layout_height="match_parent"
app:backgroundColor="@{todo.getLightTaskColor}"
android:visibility="@{todo.checklist.size > 0 ? View.VISIBLE : View.GONE}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(todo.getCompletedChecklistCount)}"
android:textColor="@color/white"
android:gravity="center"
android:layout_above="@+id/checklistDivider"/>
<View
android:id="@+id/checklistDivider"
android:layout_width="@dimen/checklist_divider_width"
android:layout_height="@dimen/hairline_height"
android:background="@color/white"
android:layout_centerInParent="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(todo.checklist.size)}"
android:textColor="@color/white"
android:gravity="center"
android:layout_below="@+id/checklistDivider"/>
</RelativeLayout>
<View
android:id="@+id/rightBorderView"
android:layout_width="5dp"
android:layout_height="match_parent"
app:backgroundColor="@{todo.getLightTaskColor}"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/bottomBorderView"
android:layout_width="match_parent"
android:layout_height="@dimen/hairline_height"
android:background="@color/cell_separator"/>
</LinearLayout>
</layout>

View file

@ -32,4 +32,10 @@
<!-- Widget -->
<dimen name="widget_bar_horizontal_margin">20dp</dimen>
<dimen name="button_width">60dp</dimen>
<dimen name="hairline_height">0.5dp</dimen>
<dimen name="checklist_divider_width">14dp</dimen>
<dimen name="checklist_wrapper_width">35dp</dimen>
</resources>