mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-21 21:35:03 +00:00
Differentiate between checklist vs not, and expanded vs not
This commit is contained in:
parent
668adc313e
commit
cc1c7a3324
3 changed files with 39 additions and 11 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue