diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt index 0a311c9b1a..58dc046f83 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt @@ -5,8 +5,10 @@ import android.animation.ValueAnimator import android.content.Context import android.content.res.ColorStateList import android.graphics.PointF +import android.os.Build import android.util.AttributeSet import android.view.Gravity +import android.view.HapticFeedbackConstants import android.view.MotionEvent import android.widget.ImageView import android.widget.RelativeLayout @@ -65,6 +67,7 @@ class InputBarButton : RelativeLayout { imageViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT) imageView.layoutParams = imageViewLayoutParams gravity = Gravity.TOP or Gravity.LEFT // Intentionally not Gravity.START + isHapticFeedbackEnabled = true } fun expand() { @@ -92,7 +95,14 @@ class InputBarButton : RelativeLayout { override fun onTouchEvent(event: MotionEvent): Boolean { when (event.action) { - MotionEvent.ACTION_DOWN -> { expand() } + MotionEvent.ACTION_DOWN -> { + expand() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK) + } else { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) + } + } MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { collapse() } } return true diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt index e4578e5fa9..a418369c90 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt @@ -1,19 +1,15 @@ package org.thoughtcrime.securesms.loki.views -import android.animation.ArgbEvaluator import android.animation.FloatEvaluator import android.animation.PointFEvaluator import android.animation.ValueAnimator import android.content.Context -import android.content.Context.VIBRATOR_SERVICE import android.content.res.ColorStateList import android.graphics.PointF import android.os.Build -import android.os.VibrationEffect -import android.os.VibrationEffect.DEFAULT_AMPLITUDE -import android.os.Vibrator import android.util.AttributeSet import android.view.Gravity +import android.view.HapticFeedbackConstants import android.view.MotionEvent import android.widget.ImageView import android.widget.RelativeLayout @@ -162,6 +158,7 @@ class NewConversationButtonSetView : RelativeLayout { private fun setUpViewHierarchy() { disableClipping() + isHapticFeedbackEnabled = true // Set up session button addView(sessionButton) sessionButton.alpha = 0.0f @@ -206,11 +203,10 @@ class NewConversationButtonSetView : RelativeLayout { isExpanded = true expand() } - val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - vibrator.vibrate(VibrationEffect.createOneShot(50, DEFAULT_AMPLITUDE)) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK) } else { - vibrator.vibrate(50) + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) } } MotionEvent.ACTION_MOVE -> { diff --git a/app/src/main/res/values-notnight-v21/colors.xml b/app/src/main/res/values-notnight-v21/colors.xml index 2a82dabd1d..95021ff8b0 100644 --- a/app/src/main/res/values-notnight-v21/colors.xml +++ b/app/src/main/res/values-notnight-v21/colors.xml @@ -21,7 +21,7 @@ #0D000000 #FFFFFF #FCFCFC - #F2F2F2 + #0D000000 #ffffff #fcfcfc diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index b1ad8d9715..e61ab9ccac 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -28,7 +28,7 @@ #0DFFFFFF #000000 #171717 - #0D0D0D + #0DFFFFFF #5ff8b0