diff --git a/vector/src/main/java/im/vector/riotx/features/attachments/AttachmentTypeSelectorView.kt b/vector/src/main/java/im/vector/riotx/features/attachments/AttachmentTypeSelectorView.kt index 6d71d88eb2..e27fa70aed 100644 --- a/vector/src/main/java/im/vector/riotx/features/attachments/AttachmentTypeSelectorView.kt +++ b/vector/src/main/java/im/vector/riotx/features/attachments/AttachmentTypeSelectorView.kt @@ -124,8 +124,9 @@ class AttachmentTypeSelectorView(context: Context, } override fun dismiss() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - animateWindowOutCircular(anchor, contentView) + val capturedAnchor = anchor + if (capturedAnchor != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + animateWindowOutCircular(capturedAnchor, contentView) } else { animateWindowOutTranslate(contentView) } @@ -142,13 +143,13 @@ class AttachmentTypeSelectorView(context: Context, } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - private fun animateWindowInCircular(anchor: View?, contentView: View) { + private fun animateWindowInCircular(anchor: View, contentView: View) { val coordinates = getClickCoordinates(anchor, contentView) val animator = ViewAnimationUtils.createCircularReveal(contentView, - coordinates.first, - coordinates.second, - 0f, - max(contentView.width, contentView.height).toFloat()) + coordinates.first, + coordinates.second, + 0f, + max(contentView.width, contentView.height).toFloat()) animator.duration = ANIMATION_DURATION.toLong() animator.start() } @@ -160,13 +161,13 @@ class AttachmentTypeSelectorView(context: Context, } @TargetApi(Build.VERSION_CODES.LOLLIPOP) - private fun animateWindowOutCircular(anchor: View?, contentView: View) { + private fun animateWindowOutCircular(anchor: View, contentView: View) { val coordinates = getClickCoordinates(anchor, contentView) val animator = ViewAnimationUtils.createCircularReveal(getContentView(), - coordinates.first, - coordinates.second, - max(getContentView().width, getContentView().height).toFloat(), - 0f) + coordinates.first, + coordinates.second, + max(getContentView().width, getContentView().height).toFloat(), + 0f) animator.duration = ANIMATION_DURATION.toLong() animator.addListener(object : AnimatorListenerAdapter() { @@ -193,12 +194,12 @@ class AttachmentTypeSelectorView(context: Context, getContentView().startAnimation(animation) } - private fun getClickCoordinates(anchor: View?, contentView: View): Pair { + private fun getClickCoordinates(anchor: View, contentView: View): Pair { val anchorCoordinates = IntArray(2) - anchor?.getLocationOnScreen(anchorCoordinates) + anchor.getLocationOnScreen(anchorCoordinates) val contentCoordinates = IntArray(2) contentView.getLocationOnScreen(contentCoordinates) - val x = anchorCoordinates[0] - contentCoordinates[0] + val x = anchorCoordinates[0] - contentCoordinates[0] + anchor.width / 2 val y = anchorCoordinates[1] - contentCoordinates[1] return Pair(x, y) } diff --git a/vector/src/main/res/drawable/bg_attachment_type_selector.xml b/vector/src/main/res/drawable/bg_attachment_type_selector.xml index 53c7c1f1c9..12787f911a 100644 --- a/vector/src/main/res/drawable/bg_attachment_type_selector.xml +++ b/vector/src/main/res/drawable/bg_attachment_type_selector.xml @@ -2,7 +2,7 @@ - + @@ -13,7 +13,7 @@ android:right="1dp" android:top="1dp"> - + diff --git a/vector/src/main/res/values/colors_riotx.xml b/vector/src/main/res/values/colors_riotx.xml index 0e51d46cc2..aec2a4c535 100644 --- a/vector/src/main/res/values/colors_riotx.xml +++ b/vector/src/main/res/values/colors_riotx.xml @@ -147,6 +147,16 @@ #BF000000 #BF000000 + + #FFFFFFFF + #FF22262E + #FF090A0C + + + #FFE9EDF1 + #FF22262E + #FF090A0C + #FFF8E3 diff --git a/vector/src/main/res/values/theme_black.xml b/vector/src/main/res/values/theme_black.xml index 129a2e9b1c..7398a4bcb7 100644 --- a/vector/src/main/res/values/theme_black.xml +++ b/vector/src/main/res/values/theme_black.xml @@ -30,6 +30,8 @@ @color/riotx_fab_label_bg_black @color/riotx_fab_label_color_black @color/riotx_touch_guard_bg_black + @color/riotx_attachment_selector_background_black + @color/riotx_attachment_selector_border_black @drawable/highlighted_message_background_black diff --git a/vector/src/main/res/values/theme_dark.xml b/vector/src/main/res/values/theme_dark.xml index 4143229293..f09cb0c874 100644 --- a/vector/src/main/res/values/theme_dark.xml +++ b/vector/src/main/res/values/theme_dark.xml @@ -28,6 +28,8 @@ @color/riotx_fab_label_bg_dark @color/riotx_fab_label_color_dark @color/riotx_touch_guard_bg_dark + @color/riotx_attachment_selector_background_dark + @color/riotx_attachment_selector_border_dark @color/riotx_keys_backup_banner_accent_color_dark diff --git a/vector/src/main/res/values/theme_light.xml b/vector/src/main/res/values/theme_light.xml index 8d51486e76..1da010b8ff 100644 --- a/vector/src/main/res/values/theme_light.xml +++ b/vector/src/main/res/values/theme_light.xml @@ -29,6 +29,8 @@ @color/riotx_fab_label_color_light @color/riotx_touch_guard_bg_light @color/riotx_keys_backup_banner_accent_color_light + @color/riotx_attachment_selector_background_light + @color/riotx_attachment_selector_border_light @drawable/highlighted_message_background_light