From 29ef92edd3e43945814ad7f42b263e15594cfd7a Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Thu, 30 Jan 2020 21:17:37 +0100 Subject: [PATCH] fix overlapping icons in ComposeActivity (#1661) --- .../tusky/components/compose/ComposeActivity.kt | 11 +++++++---- app/src/main/res/layout/activity_compose.xml | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt index f2dc033f6..b728af84b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt @@ -113,6 +113,8 @@ class ComposeActivity : BaseActivity(), private var composeOptions: ComposeOptions? = null private lateinit var viewModel: ComposeViewModel + private var mediaCount = 0 + public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val preferences = PreferenceManager.getDefaultSharedPreferences(this) @@ -304,9 +306,12 @@ class ComposeActivity : BaseActivity(), setStatusVisibility(visibility) } viewModel.media.observe { media -> - composeMediaPreviewBar.visible(media.isNotEmpty()) mediaAdapter.submitList(media) - updateSensitiveMediaToggle(viewModel.markMediaAsSensitive.value != false, viewModel.showContentWarning.value != false) + if(media.size != mediaCount) { + mediaCount = media.size + composeMediaPreviewBar.visible(media.isNotEmpty()) + updateSensitiveMediaToggle(viewModel.markMediaAsSensitive.value != false, viewModel.showContentWarning.value != false) + } } viewModel.poll.observe { poll -> pollPreview.visible(poll != null) @@ -493,8 +498,6 @@ class ComposeActivity : BaseActivity(), } private fun updateSensitiveMediaToggle(markMediaSensitive: Boolean, contentWarningShown: Boolean) { - TransitionManager.beginDelayedTransition(composeHideMediaButton.parent as ViewGroup) - if (viewModel.media.value.isNullOrEmpty()) { composeHideMediaButton.hide() } else { diff --git a/app/src/main/res/layout/activity_compose.xml b/app/src/main/res/layout/activity_compose.xml index d592eff6e..6e97bcaee 100644 --- a/app/src/main/res/layout/activity_compose.xml +++ b/app/src/main/res/layout/activity_compose.xml @@ -243,6 +243,7 @@ android:layout_gravity="bottom" android:background="?android:colorBackground" android:elevation="12dp" + android:animateLayoutChanges="true" android:gravity="center_vertical" android:paddingStart="8dp" android:paddingTop="4dp" @@ -274,13 +275,12 @@