|
|
@ -113,6 +113,8 @@ class ComposeActivity : BaseActivity(), |
|
|
|
private var composeOptions: ComposeOptions? = null |
|
|
|
private var composeOptions: ComposeOptions? = null |
|
|
|
private lateinit var viewModel: ComposeViewModel |
|
|
|
private lateinit var viewModel: ComposeViewModel |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var mediaCount = 0 |
|
|
|
|
|
|
|
|
|
|
|
public override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
public override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this) |
|
|
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this) |
|
|
@ -304,10 +306,13 @@ class ComposeActivity : BaseActivity(), |
|
|
|
setStatusVisibility(visibility) |
|
|
|
setStatusVisibility(visibility) |
|
|
|
} |
|
|
|
} |
|
|
|
viewModel.media.observe { media -> |
|
|
|
viewModel.media.observe { media -> |
|
|
|
composeMediaPreviewBar.visible(media.isNotEmpty()) |
|
|
|
|
|
|
|
mediaAdapter.submitList(media) |
|
|
|
mediaAdapter.submitList(media) |
|
|
|
|
|
|
|
if(media.size != mediaCount) { |
|
|
|
|
|
|
|
mediaCount = media.size |
|
|
|
|
|
|
|
composeMediaPreviewBar.visible(media.isNotEmpty()) |
|
|
|
updateSensitiveMediaToggle(viewModel.markMediaAsSensitive.value != false, viewModel.showContentWarning.value != false) |
|
|
|
updateSensitiveMediaToggle(viewModel.markMediaAsSensitive.value != false, viewModel.showContentWarning.value != false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
viewModel.poll.observe { poll -> |
|
|
|
viewModel.poll.observe { poll -> |
|
|
|
pollPreview.visible(poll != null) |
|
|
|
pollPreview.visible(poll != null) |
|
|
|
poll?.let(pollPreview::setPoll) |
|
|
|
poll?.let(pollPreview::setPoll) |
|
|
@ -493,8 +498,6 @@ class ComposeActivity : BaseActivity(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun updateSensitiveMediaToggle(markMediaSensitive: Boolean, contentWarningShown: Boolean) { |
|
|
|
private fun updateSensitiveMediaToggle(markMediaSensitive: Boolean, contentWarningShown: Boolean) { |
|
|
|
TransitionManager.beginDelayedTransition(composeHideMediaButton.parent as ViewGroup) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (viewModel.media.value.isNullOrEmpty()) { |
|
|
|
if (viewModel.media.value.isNullOrEmpty()) { |
|
|
|
composeHideMediaButton.hide() |
|
|
|
composeHideMediaButton.hide() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|