fix requestLayout() improperly called warning in AccountActivity (#1507)

This commit is contained in:
Konrad Pozniak 2019-10-01 08:08:21 +02:00 committed by GitHub
parent 8f92274e0b
commit c35f744a17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,11 +236,18 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
// Add a listener to change the toolbar icon color when it enters/exits its collapsed state. // Add a listener to change the toolbar icon color when it enters/exits its collapsed state.
accountAppBarLayout.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener { accountAppBarLayout.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener {
var priorOffset = 0
@AttrRes @AttrRes
var priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed var priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed
override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) { override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) {
if(verticalOffset == priorOffset) {
return
}
priorOffset = verticalOffset
@AttrRes val attribute = if (titleVisibleHeight + verticalOffset < 0) { @AttrRes val attribute = if (titleVisibleHeight + verticalOffset < 0) {
supportActionBar?.setDisplayShowTitleEnabled(true) supportActionBar?.setDisplayShowTitleEnabled(true)