mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
housekeeping to improve codacy/detekt score
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
bc20e0438f
commit
7372d108a7
@ -98,7 +98,9 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}
|
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||||
|
// unused atm
|
||||||
|
}
|
||||||
|
|
||||||
override fun convertToAbsoluteDirection(flags: Int, layoutDirection: Int): Int {
|
override fun convertToAbsoluteDirection(flags: Int, layoutDirection: Int): Int {
|
||||||
if (swipeBack) {
|
if (swipeBack) {
|
||||||
@ -192,19 +194,19 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
|
|||||||
scale = replyButtonProgress
|
scale = replyButtonProgress
|
||||||
alpha = min(FULLY_OPAQUE, FULLY_OPAQUE * replyButtonProgress).toInt()
|
alpha = min(FULLY_OPAQUE, FULLY_OPAQUE * replyButtonProgress).toInt()
|
||||||
}
|
}
|
||||||
shareRound.alpha = alpha
|
|
||||||
imageDrawable.alpha = alpha
|
|
||||||
|
|
||||||
if (startTracking) {
|
if (startTracking && !isVibrate && view.translationX >= convertToDp(REPLY_POINT)) {
|
||||||
if (!isVibrate && view.translationX >= convertToDp(REPLY_POINT)) {
|
|
||||||
view.performHapticFeedback(
|
view.performHapticFeedback(
|
||||||
HapticFeedbackConstants.KEYBOARD_TAP,
|
HapticFeedbackConstants.KEYBOARD_TAP,
|
||||||
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
|
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
|
||||||
)
|
)
|
||||||
isVibrate = true
|
isVibrate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawReplyIcon(alpha, scale, canvas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun drawReplyIcon(alpha: Int, scale: Float, canvas: Canvas) {
|
||||||
val x: Int = if (view.translationX > convertToDp(SWIPE_LIMIT)) {
|
val x: Int = if (view.translationX > convertToDp(SWIPE_LIMIT)) {
|
||||||
convertToDp(SWIPE_LIMIT) / AXIS_BASE
|
convertToDp(SWIPE_LIMIT) / AXIS_BASE
|
||||||
} else {
|
} else {
|
||||||
@ -212,6 +214,10 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
|
|||||||
}
|
}
|
||||||
|
|
||||||
val y = (view.top + view.measuredHeight / AXIS_BASE).toFloat()
|
val y = (view.top + view.measuredHeight / AXIS_BASE).toFloat()
|
||||||
|
|
||||||
|
shareRound.alpha = alpha
|
||||||
|
imageDrawable.alpha = alpha
|
||||||
|
|
||||||
shareRound.colorFilter = PorterDuffColorFilter(
|
shareRound.colorFilter = PorterDuffColorFilter(
|
||||||
ContextCompat.getColor(context, R.color.bg_message_list_incoming_bubble),
|
ContextCompat.getColor(context, R.color.bg_message_list_incoming_bubble),
|
||||||
PorterDuff.Mode.SRC_IN
|
PorterDuff.Mode.SRC_IN
|
||||||
@ -256,6 +262,7 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
private fun checkDisplaySize(context: Context) {
|
private fun checkDisplaySize(context: Context) {
|
||||||
try {
|
try {
|
||||||
density = context.resources.displayMetrics.density
|
density = context.resources.displayMetrics.density
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
build:
|
build:
|
||||||
maxIssues: 201
|
maxIssues: 264
|
||||||
weights:
|
weights:
|
||||||
# complexity: 2
|
# complexity: 2
|
||||||
# LongParameterList: 1
|
# LongParameterList: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user