mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Clean
This commit is contained in:
parent
5755f4150a
commit
bb5f8e007d
@ -5,8 +5,10 @@ import android.animation.ValueAnimator
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.PointF
|
import android.graphics.PointF
|
||||||
|
import android.os.Build
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
@ -65,6 +67,7 @@ class InputBarButton : RelativeLayout {
|
|||||||
imageViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT)
|
imageViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT)
|
||||||
imageView.layoutParams = imageViewLayoutParams
|
imageView.layoutParams = imageViewLayoutParams
|
||||||
gravity = Gravity.TOP or Gravity.LEFT // Intentionally not Gravity.START
|
gravity = Gravity.TOP or Gravity.LEFT // Intentionally not Gravity.START
|
||||||
|
isHapticFeedbackEnabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expand() {
|
fun expand() {
|
||||||
@ -92,7 +95,14 @@ class InputBarButton : RelativeLayout {
|
|||||||
|
|
||||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
when (event.action) {
|
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() }
|
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { collapse() }
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -1,19 +1,15 @@
|
|||||||
package org.thoughtcrime.securesms.loki.views
|
package org.thoughtcrime.securesms.loki.views
|
||||||
|
|
||||||
import android.animation.ArgbEvaluator
|
|
||||||
import android.animation.FloatEvaluator
|
import android.animation.FloatEvaluator
|
||||||
import android.animation.PointFEvaluator
|
import android.animation.PointFEvaluator
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Context.VIBRATOR_SERVICE
|
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.PointF
|
import android.graphics.PointF
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.VibrationEffect
|
|
||||||
import android.os.VibrationEffect.DEFAULT_AMPLITUDE
|
|
||||||
import android.os.Vibrator
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
@ -162,6 +158,7 @@ class NewConversationButtonSetView : RelativeLayout {
|
|||||||
|
|
||||||
private fun setUpViewHierarchy() {
|
private fun setUpViewHierarchy() {
|
||||||
disableClipping()
|
disableClipping()
|
||||||
|
isHapticFeedbackEnabled = true
|
||||||
// Set up session button
|
// Set up session button
|
||||||
addView(sessionButton)
|
addView(sessionButton)
|
||||||
sessionButton.alpha = 0.0f
|
sessionButton.alpha = 0.0f
|
||||||
@ -206,11 +203,10 @@ class NewConversationButtonSetView : RelativeLayout {
|
|||||||
isExpanded = true
|
isExpanded = true
|
||||||
expand()
|
expand()
|
||||||
}
|
}
|
||||||
val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK)
|
||||||
vibrator.vibrate(VibrationEffect.createOneShot(50, DEFAULT_AMPLITUDE))
|
|
||||||
} else {
|
} else {
|
||||||
vibrator.vibrate(50)
|
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MotionEvent.ACTION_MOVE -> {
|
MotionEvent.ACTION_MOVE -> {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<color name="open_group_chip_color">#0D000000</color>
|
<color name="open_group_chip_color">#0D000000</color>
|
||||||
<color name="message_selected">#FFFFFF</color>
|
<color name="message_selected">#FFFFFF</color>
|
||||||
<color name="input_bar_background">#FCFCFC</color>
|
<color name="input_bar_background">#FCFCFC</color>
|
||||||
<color name="input_bar_button_background">#F2F2F2</color>
|
<color name="input_bar_button_background">#0D000000</color>
|
||||||
|
|
||||||
<color name="default_background_start">#ffffff</color>
|
<color name="default_background_start">#ffffff</color>
|
||||||
<color name="default_background_end">#fcfcfc</color>
|
<color name="default_background_end">#fcfcfc</color>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<color name="open_group_chip_color">#0DFFFFFF</color>
|
<color name="open_group_chip_color">#0DFFFFFF</color>
|
||||||
<color name="message_selected">#000000</color>
|
<color name="message_selected">#000000</color>
|
||||||
<color name="input_bar_background">#171717</color>
|
<color name="input_bar_background">#171717</color>
|
||||||
<color name="input_bar_button_background">#0D0D0D</color>
|
<color name="input_bar_button_background">#0DFFFFFF</color>
|
||||||
|
|
||||||
<array name="profile_picture_placeholder_colors">
|
<array name="profile_picture_placeholder_colors">
|
||||||
<item>#5ff8b0</item>
|
<item>#5ff8b0</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user