mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +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
|
||||
}
|
||||
|
||||
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 {
|
||||
if (swipeBack) {
|
||||
@ -192,19 +194,19 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
|
||||
scale = replyButtonProgress
|
||||
alpha = min(FULLY_OPAQUE, FULLY_OPAQUE * replyButtonProgress).toInt()
|
||||
}
|
||||
shareRound.alpha = alpha
|
||||
imageDrawable.alpha = alpha
|
||||
|
||||
if (startTracking) {
|
||||
if (!isVibrate && view.translationX >= convertToDp(REPLY_POINT)) {
|
||||
if (startTracking && !isVibrate && view.translationX >= convertToDp(REPLY_POINT)) {
|
||||
view.performHapticFeedback(
|
||||
HapticFeedbackConstants.KEYBOARD_TAP,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING
|
||||
)
|
||||
isVibrate = true
|
||||
}
|
||||
|
||||
drawReplyIcon(alpha, scale, canvas)
|
||||
}
|
||||
|
||||
private fun drawReplyIcon(alpha: Int, scale: Float, canvas: Canvas) {
|
||||
val x: Int = if (view.translationX > convertToDp(SWIPE_LIMIT)) {
|
||||
convertToDp(SWIPE_LIMIT) / AXIS_BASE
|
||||
} else {
|
||||
@ -212,6 +214,10 @@ class MessageSwipeCallback(private val context: Context, private val messageSwip
|
||||
}
|
||||
|
||||
val y = (view.top + view.measuredHeight / AXIS_BASE).toFloat()
|
||||
|
||||
shareRound.alpha = alpha
|
||||
imageDrawable.alpha = alpha
|
||||
|
||||
shareRound.colorFilter = PorterDuffColorFilter(
|
||||
ContextCompat.getColor(context, R.color.bg_message_list_incoming_bubble),
|
||||
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) {
|
||||
try {
|
||||
density = context.resources.displayMetrics.density
|
||||
|
@ -1,5 +1,5 @@
|
||||
build:
|
||||
maxIssues: 201
|
||||
maxIssues: 264
|
||||
weights:
|
||||
# complexity: 2
|
||||
# LongParameterList: 1
|
||||
|
Loading…
Reference in New Issue
Block a user