Design tweaks

This commit is contained in:
Phillip Thelen 2020-08-26 17:46:39 +02:00
parent 75fd669107
commit 098e9d8fc2
16 changed files with 67 additions and 33 deletions

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="@dimen/daily_checkbox_corner_radius"/>
<solid android:color="#A6FFFFFF" />

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/round_checklist_checked" />
<item android:state_checked="false" android:drawable="@drawable/round_checklist_unchecked" />
</selector>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="#A6FFFFFF" />
<size android:height="20dp" android:width="20dp" />
</shape>
</item>
<item>
<bitmap android:src="@drawable/checkmark" android:gravity="center" />
</item>
</layer-list>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#A6FFFFFF" />
<size android:height="20dp" android:width="20dp" />
</shape>

View file

@ -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 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingBottom="6dp"
android:paddingTop="2dp">
android:gravity="center_vertical">
<TextView
android:id="@+id/lvl_tv"

View file

@ -7,6 +7,8 @@
android:gravity="center"
android:layout_gravity="center"
android:layout_marginEnd="12dp"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:orientation="vertical">
<TextView

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="fill_parent"
@ -9,14 +10,22 @@
<FrameLayout
android:id="@+id/checkBoxHolder"
android:layout_width="@dimen/button_width"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="@dimen/checkbox_size"
android:layout_height="@dimen/checkbox_size"
android:gravity="center"
android:button="@drawable/checklist_checkbox"
android:layout_gravity="center" />
android:layout_height="match_parent"
tools:background="@color/red_10">
<FrameLayout
android:id="@+id/checkBoxBackground"
android:layout_width="20dp"
android:layout_height="20dp"
android:gravity="center"
android:background="@drawable/checklist_unchecked"
android:layout_gravity="center">
<ImageView
android:id="@+id/checkmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/checkmark" />
</FrameLayout>
</FrameLayout>
<com.habitrpg.android.habitica.ui.views.HabiticaEmojiTextView
android:id="@+id/checkedTextView"

View file

@ -16,7 +16,7 @@
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_700"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.habitrpg.android.habitica.ui.helpers.RecyclerViewEmptySupport
android:id="@+id/recyclerView"

View file

@ -6,6 +6,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:paddingTop="@dimen/task_top_bottom_padding"
android:paddingBottom="@dimen/task_top_bottom_padding"
android:paddingEnd="@dimen/task_text_padding"

View file

@ -2,13 +2,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.habitrpg.android.habitica.TaskActivity">
<item
android:id="@+id/action_reload"
android:icon="@drawable/ic_refresh_white"
android:title="@string/action_refresh"
app:showAsAction="never"
app:actionViewClass="android.widget.ImageButton"/>
<item android:id="@+id/action_search"
android:title="@string/search"
android:icon="@drawable/ic_search"

View file

@ -19,6 +19,7 @@ class ItemsFragment : BaseMainFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
this.usesTabLayout = true
this.hidesToolbar = true
super.onCreateView(inflater, container, savedInstanceState)
return inflater.inflate(R.layout.fragment_viewpager, container, false)
}

View file

@ -39,6 +39,7 @@ class GuildsOverviewFragment : BaseMainFragment(), androidx.swiperefreshlayout.w
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
this.hidesToolbar = true
super.onCreateView(inflater, container, savedInstanceState)
binding = FragmentGuildsOverviewBinding.inflate(inflater, container, false)
return binding?.root

View file

@ -70,6 +70,7 @@ class ChallengeDetailFragment: BaseMainFragment() {
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
this.hidesToolbar = true
super.onCreateView(inflater, container, savedInstanceState)
return container?.inflate(R.layout.fragment_challenge_detail)
}

View file

@ -30,6 +30,7 @@ class ChallengesOverviewFragment : BaseMainFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
this.usesTabLayout = true
this.hidesToolbar = true
super.onCreateView(inflater, container, savedInstanceState)
return inflater.inflate(R.layout.fragment_viewpager, container, false)
}

View file

@ -40,7 +40,7 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
private val expandNotesButton: Button? by bindOptionalView(R.id.expand_notes_button)
private val syncingView: ProgressBar? by bindOptionalView(R.id.syncing_view)
private val errorIconView: ImageButton? by bindOptionalView(R.id.error_icon)
protected val taskGray: Int by bindColor(itemView.context, R.color.task_gray)
protected val taskGray: Int by bindColor(itemView.context, R.color.gray_600)
protected val streakTextView: TextView by bindView(itemView, R.id.streakTextView)
protected val reminderTextView: TextView by bindView(itemView, R.id.reminder_textview)

View file

@ -7,10 +7,7 @@ import android.view.LayoutInflater
import android.view.TouchDelegate
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.CompoundButton
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.*
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -53,7 +50,11 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
if (this.shouldDisplayAsActive(newTask) && !newTask.isPendingApproval) {
this.checkboxHolder.setBackgroundResource(newTask.lightTaskColor)
} else {
this.checkboxHolder.setBackgroundColor(this.taskGray)
if (newTask.completed) {
this.checkboxHolder.setBackgroundResource(R.color.gray_700)
} else {
this.checkboxHolder.setBackgroundColor(this.taskGray)
}
}
this.checklistCompletedTextView.text = newTask.completedChecklistCount.toString()
this.checklistAllTextView.text = newTask.checklist?.size.toString()
@ -75,7 +76,10 @@ abstract class ChecklistedViewHolder(itemView: View, scoreTaskFunc: ((Task, Task
checklistView.removeAllViews()
for (item in this.task?.checklist ?: emptyList<ChecklistItem>()) {
val itemView = layoutInflater?.inflate(R.layout.checklist_item_row, this.checklistView, false)
val checkbox = itemView?.findViewById<CheckBox>(R.id.checkBox)
val checkboxBackground = itemView?.findViewById<FrameLayout>(R.id.checkBoxBackground)
if (task?.type == Task.TYPE_TODO) {
checkboxBackground?.setBackgroundResource(R.drawable.round_checklist_unchecked)
}
val textView = itemView?.findViewById<HabiticaEmojiTextView>(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<CharSequence> { textView?.text = it }, RxErrorHandler.handleEmptyError())
}
checkbox?.isChecked = item.completed
checkbox?.setOnCheckedChangeListener { _, _ ->
val checkmark = itemView?.findViewById<ImageView>(R.id.checkmark)
checkmark?.drawable?.setTintMode(PorterDuff.Mode.SRC_ATOP)
checkmark?.visibility = if (item.completed) View.VISIBLE else View.GONE
val checkboxHolder = itemView?.findViewById<View>(R.id.checkBoxHolder) as? ViewGroup
checkboxHolder?.setOnClickListener { _ ->
task?.let { scoreChecklistItemFunc(it, item) }
}
val checkboxHolder = itemView?.findViewById<View>(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) }