From 098e9d8fc2e0760bc576ca65199de45878148100 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 26 Aug 2020 17:46:39 +0200 Subject: [PATCH] Design tweaks --- Habitica/res/drawable/checklist_unchecked.xml | 1 - .../res/drawable/round_checklist_checkbox.xml | 5 ++++ .../res/drawable/round_checklist_checked.xml | 12 +++++++++ .../drawable/round_checklist_unchecked.xml | 5 ++++ Habitica/res/layout/avatar_with_bars.xml | 5 +--- Habitica/res/layout/checklist_indicator.xml | 2 ++ Habitica/res/layout/checklist_item_row.xml | 27 ++++++++++++------- Habitica/res/layout/fragment_items.xml | 2 +- Habitica/res/layout/task_main_content.xml | 1 + Habitica/res/menu/menu_main_activity.xml | 7 ----- .../inventory/items/ItemsFragment.kt | 1 + .../social/GuildsOverviewFragment.kt | 1 + .../challenges/ChallengeDetailFragment.kt | 1 + .../challenges/ChallengesOverviewFragment.kt | 1 + .../viewHolders/tasks/BaseTaskViewHolder.kt | 2 +- .../tasks/ChecklistedViewHolder.kt | 27 ++++++++++++------- 16 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 Habitica/res/drawable/round_checklist_checkbox.xml create mode 100644 Habitica/res/drawable/round_checklist_checked.xml create mode 100644 Habitica/res/drawable/round_checklist_unchecked.xml diff --git a/Habitica/res/drawable/checklist_unchecked.xml b/Habitica/res/drawable/checklist_unchecked.xml index f816d47dd..1109b6b19 100644 --- a/Habitica/res/drawable/checklist_unchecked.xml +++ b/Habitica/res/drawable/checklist_unchecked.xml @@ -1,5 +1,4 @@ - diff --git a/Habitica/res/drawable/round_checklist_checkbox.xml b/Habitica/res/drawable/round_checklist_checkbox.xml new file mode 100644 index 000000000..9147e3f7d --- /dev/null +++ b/Habitica/res/drawable/round_checklist_checkbox.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Habitica/res/drawable/round_checklist_checked.xml b/Habitica/res/drawable/round_checklist_checked.xml new file mode 100644 index 000000000..0e5ab35b9 --- /dev/null +++ b/Habitica/res/drawable/round_checklist_checked.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Habitica/res/drawable/round_checklist_unchecked.xml b/Habitica/res/drawable/round_checklist_unchecked.xml new file mode 100644 index 000000000..54c3938e2 --- /dev/null +++ b/Habitica/res/drawable/round_checklist_unchecked.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Habitica/res/layout/avatar_with_bars.xml b/Habitica/res/layout/avatar_with_bars.xml index 60d30f300..b9d83cebb 100644 --- a/Habitica/res/layout/avatar_with_bars.xml +++ b/Habitica/res/layout/avatar_with_bars.xml @@ -21,7 +21,6 @@ android:layout_height="@dimen/avatar_header_height" android:layout_gravity="center_vertical" android:layout_marginEnd="20dp" - android:layout_marginStart="2dp" android:contentDescription="@string/sidebar_avatar" app:showBackground="true" app:showMount="true" @@ -64,9 +63,7 @@ + android:gravity="center_vertical"> + android:layout_height="wrap_content" + xmlns:tools="http://schemas.android.com/tools"> - + android:layout_height="match_parent" + tools:background="@color/red_10"> + + + - - ()) { val itemView = layoutInflater?.inflate(R.layout.checklist_item_row, this.checklistView, false) - val checkbox = itemView?.findViewById(R.id.checkBox) + val checkboxBackground = itemView?.findViewById(R.id.checkBoxBackground) + if (task?.type == Task.TYPE_TODO) { + checkboxBackground?.setBackgroundResource(R.drawable.round_checklist_unchecked) + } val textView = itemView?.findViewById(R.id.checkedTextView) // Populate the data into the template view using the data object textView?.text = item.text @@ -86,15 +90,18 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task .observeOn(AndroidSchedulers.mainThread()) .subscribe(Consumer { textView?.text = it }, RxErrorHandler.handleEmptyError()) } - checkbox?.isChecked = item.completed - checkbox?.setOnCheckedChangeListener { _, _ -> + val checkmark = itemView?.findViewById(R.id.checkmark) + checkmark?.drawable?.setTintMode(PorterDuff.Mode.SRC_ATOP) + checkmark?.visibility = if (item.completed) View.VISIBLE else View.GONE + val checkboxHolder = itemView?.findViewById(R.id.checkBoxHolder) as? ViewGroup + checkboxHolder?.setOnClickListener { _ -> task?.let { scoreChecklistItemFunc(it, item) } } - val checkboxHolder = itemView?.findViewById(R.id.checkBoxHolder) as? ViewGroup - expandCheckboxTouchArea(checkboxHolder, checkbox) val color = ContextCompat.getColor(context, if (task?.completed == true || (task?.type == Task.TYPE_DAILY && task?.isDue == false)) { + checkmark?.drawable?.setTint(ContextCompat.getColor(context, R.color.gray_400)) R.color.gray_600 } else { + checkmark?.drawable?.setTint(ContextCompat.getColor(context, task?.darkTaskColor ?: R.color.gray_400)) task?.extraLightTaskColor ?: R.color.gray_600 }) color.let { checkboxHolder?.setBackgroundColor(it) }