Animate the attachment open/close button
This commit is contained in:
parent
464ac3bce2
commit
5eebc995ff
@ -84,7 +84,21 @@ class AttachmentTypeSelectorView(context: Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun animateOpen() {
|
||||||
|
views.attachmentCloseButton.animate()
|
||||||
|
.setDuration(200)
|
||||||
|
.rotation(135f)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun animateClose() {
|
||||||
|
views.attachmentCloseButton.animate()
|
||||||
|
.setDuration(200)
|
||||||
|
.rotation(0f)
|
||||||
|
}
|
||||||
|
|
||||||
fun show(anchor: View) {
|
fun show(anchor: View) {
|
||||||
|
animateOpen()
|
||||||
|
|
||||||
this.anchor = anchor
|
this.anchor = anchor
|
||||||
val anchorCoordinates = IntArray(2)
|
val anchorCoordinates = IntArray(2)
|
||||||
anchor.getLocationOnScreen(anchorCoordinates)
|
anchor.getLocationOnScreen(anchorCoordinates)
|
||||||
@ -96,6 +110,8 @@ class AttachmentTypeSelectorView(context: Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun dismiss() {
|
override fun dismiss() {
|
||||||
|
animateClose()
|
||||||
|
|
||||||
val capturedAnchor = anchor
|
val capturedAnchor = anchor
|
||||||
if (capturedAnchor != null) {
|
if (capturedAnchor != null) {
|
||||||
animateWindowOutCircular(capturedAnchor, contentView)
|
animateWindowOutCircular(capturedAnchor, contentView)
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="32dp"
|
|
||||||
android:height="32dp"
|
|
||||||
android:viewportWidth="36"
|
|
||||||
android:viewportHeight="36">
|
|
||||||
<path
|
|
||||||
android:pathData="M18,18m-0,-18a18,18 0,1 1,-0 36a18,18 0,1 1,-0 -36"
|
|
||||||
android:fillColor="?vctr_content_quinary"/>
|
|
||||||
<path
|
|
||||||
android:pathData="M13.521,23.4807L23.067,13.9348M13.521,13.9348L23.067,23.4807"
|
|
||||||
android:strokeWidth="2"
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:strokeColor="?vctr_content_secondary"
|
|
||||||
android:strokeLineCap="round"/>
|
|
||||||
</vector>
|
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/composer_min_height"
|
android:layout_height="@dimen/composer_min_height"
|
||||||
android:background="?android:colorBackground">
|
android:background="?android:colorBackground">
|
||||||
@ -12,10 +13,11 @@
|
|||||||
android:layout_margin="@dimen/composer_attachment_margin"
|
android:layout_margin="@dimen/composer_attachment_margin"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:contentDescription="@string/action_close"
|
android:contentDescription="@string/action_close"
|
||||||
android:src="@drawable/ic_attachment_close"
|
android:src="@drawable/ic_attachment"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:rotation="135" />
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
Loading…
Reference in New Issue
Block a user