mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-14 10:45:53 +01:00
Quick rework, better to search for expected MenuItem
This commit is contained in:
parent
3e42cec4ec
commit
293a177148
@ -21,7 +21,6 @@ import android.content.Intent
|
|||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.core.view.forEach
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import com.airbnb.mvrx.Fail
|
import com.airbnb.mvrx.Fail
|
||||||
@ -182,19 +181,9 @@ class RoomDevToolActivity :
|
|||||||
|
|
||||||
override fun handlePrepareMenu(menu: Menu) {
|
override fun handlePrepareMenu(menu: Menu) {
|
||||||
withState(viewModel) { state ->
|
withState(viewModel) { state ->
|
||||||
menu.forEach {
|
menu.findItem(R.id.menuItemEdit).isVisible = state.displayMode == RoomDevToolViewState.Mode.StateEventDetail
|
||||||
val isVisible = when (it.itemId) {
|
menu.findItem(R.id.menuItemSend).isVisible = state.displayMode == RoomDevToolViewState.Mode.EditEventContent ||
|
||||||
R.id.menuItemEdit -> {
|
state.displayMode is RoomDevToolViewState.Mode.SendEventForm
|
||||||
state.displayMode is RoomDevToolViewState.Mode.StateEventDetail
|
|
||||||
}
|
|
||||||
R.id.menuItemSend -> {
|
|
||||||
state.displayMode is RoomDevToolViewState.Mode.EditEventContent ||
|
|
||||||
state.displayMode is RoomDevToolViewState.Mode.SendEventForm
|
|
||||||
}
|
|
||||||
else -> true
|
|
||||||
}
|
|
||||||
it.isVisible = isVisible
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user