Differentiate between checklist vs not, and expanded vs not

This commit is contained in:
Mike-Antonacci 2021-01-06 17:26:19 -07:00
parent 668adc313e
commit cc1c7a3324
3 changed files with 39 additions and 11 deletions

View file

@ -228,12 +228,40 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
if (motionEvent != null) {
if (motionEvent.action != MotionEvent.ACTION_UP) return true
if (motionEvent.y <= mainTaskWrapper.height + 5.dpToPx(context)) {
if (motionEvent.x <= 72.dpToPx(context)) {
onLeftActionTouched()
return true
} else if ((itemView.width - motionEvent.x <= 72.dpToPx(context))) {
onRightActionTouched()
return true
if ((this.task?.checklist?.isNotEmpty() != true)) {
if (motionEvent.x <= 72.dpToPx(context)) {
onLeftActionTouched()
return true
} else if ((itemView.width - motionEvent.x <= 72.dpToPx(context))) {
onRightActionTouched()
return true
}
} else {
val checkboxHolder: ViewGroup = itemView.findViewById(R.id.checkBoxHolder)
if (mainTaskWrapper.height == checkboxHolder.height) {
if (motionEvent.x <= 72.dpToPx(context)) {
onLeftActionTouched()
return true
} else if ((itemView.width - motionEvent.x <= 72.dpToPx(context))) {
onRightActionTouched()
return true
}
} else {
if (motionEvent.y <= (checkboxHolder.height + 5.dpToPx(context))) {
if (motionEvent.x <= 72.dpToPx(context)) {
onLeftActionTouched()
return true
} else if ((itemView.width - motionEvent.x <= 72.dpToPx(context))) {
onRightActionTouched()
return true
}
} else if ((motionEvent.y > (checkboxHolder.height + 5.dpToPx(context)))) {
if (motionEvent.x <= 72.dpToPx(context)) {
onLeftActionTouched()
return true
}
}
}
}
}
}
@ -249,4 +277,4 @@ abstract class BaseTaskViewHolder constructor(itemView: View, var scoreTaskFunc:
this.openTaskDisabled = openTaskDisabled
this.taskActionsDisabled = taskActionsDisabled
}
}
}

View file

@ -3,15 +3,14 @@ package com.habitrpg.android.habitica.ui.viewHolders.tasks
import android.content.Context
import android.graphics.PorterDuff
import android.graphics.Rect
import android.view.LayoutInflater
import android.view.TouchDelegate
import android.view.View
import android.view.ViewGroup
import android.util.Log
import android.view.*
import android.widget.*
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.extensions.dpToPx
import com.habitrpg.android.habitica.extensions.getThemeColor
import com.habitrpg.android.habitica.extensions.isUsingNightModeResources
import com.habitrpg.android.habitica.helpers.RxErrorHandler

View file

@ -1,6 +1,7 @@
package com.habitrpg.android.habitica.ui.viewHolders.tasks
import android.graphics.PorterDuff
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.FrameLayout