|
|
@ -28,6 +28,7 @@ class InputBarButton : RelativeLayout {
|
|
|
|
private val gestureHandler = Handler(Looper.getMainLooper())
|
|
|
|
private val gestureHandler = Handler(Looper.getMainLooper())
|
|
|
|
private var isSendButton = false
|
|
|
|
private var isSendButton = false
|
|
|
|
private var hasOpaqueBackground = false
|
|
|
|
private var hasOpaqueBackground = false
|
|
|
|
|
|
|
|
private var isGIFButton = false
|
|
|
|
@DrawableRes private var iconID = 0
|
|
|
|
@DrawableRes private var iconID = 0
|
|
|
|
private var longPressCallback: Runnable? = null
|
|
|
|
private var longPressCallback: Runnable? = null
|
|
|
|
private var onDownTimestamp = 0L
|
|
|
|
private var onDownTimestamp = 0L
|
|
|
@ -71,7 +72,7 @@ class InputBarButton : RelativeLayout {
|
|
|
|
|
|
|
|
|
|
|
|
private val imageView by lazy {
|
|
|
|
private val imageView by lazy {
|
|
|
|
val result = ImageView(context)
|
|
|
|
val result = ImageView(context)
|
|
|
|
val size = toPx(16, resources)
|
|
|
|
val size = if (isGIFButton) toPx(24, resources) else toPx(16, resources)
|
|
|
|
result.layoutParams = LayoutParams(size, size)
|
|
|
|
result.layoutParams = LayoutParams(size, size)
|
|
|
|
result.scaleType = ImageView.ScaleType.CENTER_INSIDE
|
|
|
|
result.scaleType = ImageView.ScaleType.CENTER_INSIDE
|
|
|
|
result.setImageResource(iconID)
|
|
|
|
result.setImageResource(iconID)
|
|
|
@ -84,10 +85,12 @@ class InputBarButton : RelativeLayout {
|
|
|
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { throw IllegalAccessException("Use InputBarButton(context:iconID:) instead.") }
|
|
|
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { throw IllegalAccessException("Use InputBarButton(context:iconID:) instead.") }
|
|
|
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { throw IllegalAccessException("Use InputBarButton(context:iconID:) instead.") }
|
|
|
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { throw IllegalAccessException("Use InputBarButton(context:iconID:) instead.") }
|
|
|
|
|
|
|
|
|
|
|
|
constructor(context: Context, @DrawableRes iconID: Int, isSendButton: Boolean = false, hasOpaqueBackground: Boolean = false) : super(context) {
|
|
|
|
constructor(context: Context, @DrawableRes iconID: Int, isSendButton: Boolean = false,
|
|
|
|
|
|
|
|
hasOpaqueBackground: Boolean = false, isGIFButton: Boolean = false) : super(context) {
|
|
|
|
this.isSendButton = isSendButton
|
|
|
|
this.isSendButton = isSendButton
|
|
|
|
this.iconID = iconID
|
|
|
|
this.iconID = iconID
|
|
|
|
this.hasOpaqueBackground = hasOpaqueBackground
|
|
|
|
this.hasOpaqueBackground = hasOpaqueBackground
|
|
|
|
|
|
|
|
this.isGIFButton = isGIFButton
|
|
|
|
val size = resources.getDimension(R.dimen.input_bar_button_expanded_size).toInt()
|
|
|
|
val size = resources.getDimension(R.dimen.input_bar_button_expanded_size).toInt()
|
|
|
|
val layoutParams = LayoutParams(size, size)
|
|
|
|
val layoutParams = LayoutParams(size, size)
|
|
|
|
this.layoutParams = layoutParams
|
|
|
|
this.layoutParams = layoutParams
|
|
|
|