Adjust tap area on forwarding fab.

This commit is contained in:
Cody Henthorne 2022-04-22 13:40:07 -04:00
parent 33d28c4359
commit cd10aa90cc
2 changed files with 34 additions and 12 deletions

View file

@ -1,9 +1,11 @@
package org.thoughtcrime.securesms.conversation.mutiselect.forward
import android.graphics.Rect
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.LayoutInflater
import android.view.TouchDelegate
import android.view.View
import android.view.ViewGroup
import android.view.animation.AnimationUtils
@ -11,6 +13,7 @@ import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import androidx.annotation.PluralsRes
import androidx.core.view.doOnNextLayout
import androidx.core.view.isVisible
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
@ -125,6 +128,7 @@ class MultiselectForwardFragment :
val bottomBar = LayoutInflater.from(requireContext()).inflate(R.layout.multiselect_forward_fragment_bottom_bar, container, false)
val shareSelectionRecycler: RecyclerView = bottomBar.findViewById(R.id.selected_list)
val shareSelectionAdapter = ShareSelectionAdapter()
val sendButtonFrame: View = bottomBar.findViewById(R.id.share_confirm_frame)
val sendButton: View = bottomBar.findViewById(R.id.share_confirm)
val backgroundHelper: View = bottomBar.findViewById(R.id.background_helper)
@ -134,6 +138,16 @@ class MultiselectForwardFragment :
addMessage = bottomBar.findViewById(R.id.add_message)
sendButton.doOnNextLayout {
val rect = Rect()
sendButton.getHitRect(rect)
rect.top -= sendButtonFrame.paddingTop
rect.left -= sendButtonFrame.paddingStart
rect.right += sendButtonFrame.paddingEnd
rect.bottom += sendButtonFrame.paddingBottom
sendButtonFrame.touchDelegate = TouchDelegate(rect, sendButton)
}
sendButton.setOnClickListener {
sendButton.isEnabled = false

View file

@ -20,8 +20,8 @@
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/signal_divider_major"
app:layout_constraintBottom_toBottomOf="@id/share_confirm"
app:layout_constraintTop_toTopOf="@id/share_confirm" />
app:layout_constraintBottom_toBottomOf="@id/share_confirm_frame"
app:layout_constraintTop_toTopOf="@id/share_confirm_frame" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/selected_list"
@ -62,17 +62,25 @@
android:textAppearance="@style/Signal.Text.Body" />
</FrameLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/share_confirm"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:contentDescription="@string/ShareActivity__share"
app:backgroundTint="@color/signal_accent_primary"
<FrameLayout
android:id="@+id/share_confirm_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="@id/divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_send_24" />
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/share_confirm"
android:layout_width="56dp"
android:layout_height="56dp"
android:contentDescription="@string/ShareActivity__share"
app:backgroundTint="@color/signal_accent_primary"
app:srcCompat="@drawable/ic_send_24" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>