mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-25 15:16:01 +00:00
redesign daily list
This commit is contained in:
parent
92ef8c6e44
commit
0a3a693f91
2 changed files with 78 additions and 32 deletions
|
|
@ -3,61 +3,105 @@
|
|||
<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="daily"
|
||||
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:background="@color/white">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<CheckBox
|
||||
android:id="@+id/checkBox"
|
||||
android:layout_width="50dp"
|
||||
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="@{daily.completed}"
|
||||
app:backgroundColor="@{daily.getLightTaskColor}"
|
||||
android:gravity="center"/>
|
||||
|
||||
android:checked="@{daily.completed}"
|
||||
app:backgroundColor="@{daily.getLightTaskColor}"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="5dp">
|
||||
<CheckedTextView
|
||||
android:padding="5dp"
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@+id/checklistIndicatorWrapper"
|
||||
android:layout_toStartOf="@+id/checklistIndicatorWrapper">
|
||||
<TextView
|
||||
android:id="@+id/checkedTextView"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{daily.text}" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
style="@style/CardText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@{daily.notes}" />
|
||||
android:text="@{daily.notes}"
|
||||
android:visibility="@{daily.notes != null ? View.VISIBLE : View.GONE}"/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<RelativeLayout android:orientation="vertical"
|
||||
android:id="@+id/checklistIndicatorWrapper"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@{String.valueOf(daily.getCompletedChecklistCount)+'/'+String.valueOf(daily.checklist.size)}"/>
|
||||
app:backgroundColor="@{daily.getLightTaskColor}"
|
||||
android:visibility="@{daily.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(daily.getCompletedChecklistCount)}"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center"
|
||||
android:layout_above="@+id/checklistDivider"/>
|
||||
<View
|
||||
android:id="@+id/checklistDivider"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/white"
|
||||
android:layout_centerInParent="true"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{String.valueOf(daily.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="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:backgroundColor="@{daily.getLightTaskColor}"
|
||||
android:gravity="center"/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
android:gravity="center"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/bottomBorderView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/cell_separator"/>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
|
|
@ -217,10 +217,12 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
|
|||
ViewHelper.SetBackgroundTint(view, view.getResources().getColor(color));
|
||||
}
|
||||
|
||||
public abstract class ViewHolder<THabitItem extends Task> extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
@BindingAdapter("app:backgroundColor")
|
||||
public static void setBackgroundTintColor(View view, int color) {
|
||||
view.setBackgroundColor(view.getResources().getColor(color));
|
||||
}
|
||||
|
||||
@InjectView(R.id.checkedTextView)
|
||||
protected CheckedTextView checkedTextView;
|
||||
public abstract class ViewHolder<THabitItem extends Task> extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
|
||||
protected android.content.res.Resources resources;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue