Fixes layout issues

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-01-09 14:46:32 +01:00
parent 733653cbef
commit 9f1e4bbc34
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
4 changed files with 19 additions and 17 deletions

View File

@ -712,11 +712,6 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
}
}
override fun onChangeStarted(changeHandler: ControllerChangeHandler, changeType: ControllerChangeType) {
actionBar?.setIcon(null)
super.onChangeStarted(changeHandler, changeType)
}
override fun onDetach(view: View) {
eventBus.unregister(this)

View File

@ -64,8 +64,6 @@ abstract class BaseController : ButterKnifeController(), ComponentCallbacks {
val context: Context by inject()
val eventBus: EventBus by inject()
// Note: This is just a quick demo of how an ActionBar *can* be accessed, not necessarily how it *should*
// be accessed. In a production app, this would use Dagger instead.
protected val actionBar: ActionBar?
get() {
var actionBarProvider: ActionBarProvider? = null
@ -100,6 +98,16 @@ abstract class BaseController : ButterKnifeController(), ComponentCallbacks {
}
}
override fun onChangeStarted(changeHandler: ControllerChangeHandler, changeType: ControllerChangeType) {
setOptionsMenuHidden(true)
super.onChangeStarted(changeHandler, changeType)
}
override fun onChangeEnded(changeHandler: ControllerChangeHandler, changeType: ControllerChangeType) {
setOptionsMenuHidden(false)
super.onChangeEnded(changeHandler, changeType)
}
private fun showSearchOrToolbar() {
val value = getIsUsingSearchLayout()
activity?.let {

View File

@ -29,6 +29,8 @@ import butterknife.OnClick
import com.afollestad.materialdialogs.LayoutMode
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.bluelinelabs.conductor.ControllerChangeHandler
import com.bluelinelabs.conductor.ControllerChangeType
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.autodispose.ControllerScopeProvider
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
@ -125,19 +127,15 @@ class ConversationsListView : BaseView() {
viewModel.filterLiveData.observe(this@ConversationsListView) {query ->
activity?.settingsButton?.isVisible = query.isNullOrEmpty()
activity?.clearButton?.isVisible = !query.isNullOrEmpty()
if (query.isNullOrEmpty()) {
if (floatingActionButton?.isOrWillBeShown == false) {
floatingActionButton?.show()
}
} else {
if (floatingActionButton?.isOrWillBeHidden == false) {
floatingActionButton?.hide()
}
}
}
return view
}
override fun onChangeStarted(changeHandler: ControllerChangeHandler, changeType: ControllerChangeType) {
actionBar?.setIcon(null)
super.onChangeStarted(changeHandler, changeType)
}
private fun setSearchQuery(query: CharSequence?) {
viewModel.filterLiveData.value = query
}

View File

@ -24,7 +24,8 @@
android:id="@+id/mainActivityCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.MainActivity">
tools:context=".activities.MainActivity"
android:animateLayoutChanges="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"