ComposeActivity: fix compiling

main
Alibek Omarov 5 years ago
parent 9aa29b75b4
commit 343b121d7b
  1. 10
      app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
  2. 6
      app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt

@ -421,8 +421,8 @@ class ComposeActivity : BaseActivity(),
composeEditField.setSelection(start + text.length)
}
private fun toggleMarkdownMode() {
viewModel.toggleMarkdownMode()
private fun enableMarkdownMode(enable: Boolean) {
viewModel.markdownMode = enable
enableMarkdownWYSIWYGButtons(viewModel.markdownMode)
@ -432,6 +432,10 @@ class ComposeActivity : BaseActivity(),
composeMarkdownButton.drawable.colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN);
}
private fun toggleMarkdownMode() {
enableMarkdownMode(!viewModel.markdownMode)
}
private fun enableMarkdownWYSIWYGButtons(visible: Boolean) {
val visibility = if(visible) View.VISIBLE else View.GONE
codeButton.visibility = visibility
@ -478,7 +482,7 @@ class ComposeActivity : BaseActivity(),
currentInputContentInfo = null
currentFlags = 0
outState.putParcelable("photoUploadUri", photoUploadUri)
outState.putParcelable("markdownMode", viewModel.markdownMode)
outState.putBoolean("markdownMode", viewModel.markdownMode)
super.onSaveInstanceState(outState)
}

@ -62,7 +62,7 @@ class ComposeViewModel
private var inReplyToId: String? = null
private var startingVisibility: Status.Visibility = Status.Visibility.UNKNOWN
private val instance: MutableLiveData<InstanceEntity?> = MutableLiveData()
public val markdownMode: Boolean = false
public var markdownMode: Boolean = false
val instanceParams: LiveData<ComposeInstanceParams> = instance.map { instance ->
ComposeInstanceParams(
@ -87,10 +87,6 @@ class ComposeViewModel
val poll: MutableLiveData<NewPoll?> = mutableLiveData(null)
val scheduledAt: MutableLiveData<String?> = mutableLiveData(null)
fun toggleMarkdownMode() {
this.markdownMode = !this.markdownMode!!
}
val media = mutableLiveData<List<QueuedMedia>>(listOf())
val uploadError = MutableLiveData<Throwable>()

Loading…
Cancel
Save