fix: Fix toolbar flickering in additional activities (#48)
Testing showed additional activities with toolbar flicking issues. Fix as before, using `setLiftOnScrollTargetView` to specify the scrolling view the toolbar should lift above.
This commit is contained in:
parent
676c1eea2b
commit
ccb8ec06e7
|
@ -22,15 +22,23 @@ import androidx.fragment.app.commit
|
|||
import app.pachli.BottomSheetActivity
|
||||
import app.pachli.R
|
||||
import app.pachli.databinding.ActivityAccountListBinding
|
||||
import app.pachli.interfaces.AppBarLayoutHost
|
||||
import app.pachli.util.viewBinding
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import dagger.android.DispatchingAndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import javax.inject.Inject
|
||||
|
||||
class AccountListActivity : BottomSheetActivity(), HasAndroidInjector {
|
||||
class AccountListActivity : BottomSheetActivity(), AppBarLayoutHost, HasAndroidInjector {
|
||||
|
||||
@Inject
|
||||
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Any>
|
||||
|
||||
private val binding: ActivityAccountListBinding by viewBinding(ActivityAccountListBinding::inflate)
|
||||
|
||||
override val appBarLayout: AppBarLayout
|
||||
get() = binding.includedToolbar.appbar
|
||||
|
||||
enum class Type {
|
||||
FOLLOWS,
|
||||
FOLLOWERS,
|
||||
|
@ -43,7 +51,6 @@ class AccountListActivity : BottomSheetActivity(), HasAndroidInjector {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val binding = ActivityAccountListBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val type = intent.getSerializableExtra(EXTRA_TYPE) as Type
|
||||
|
|
|
@ -45,6 +45,7 @@ import app.pachli.di.Injectable
|
|||
import app.pachli.entity.Relationship
|
||||
import app.pachli.entity.TimelineAccount
|
||||
import app.pachli.interfaces.AccountActionListener
|
||||
import app.pachli.interfaces.AppBarLayoutHost
|
||||
import app.pachli.interfaces.LinkListener
|
||||
import app.pachli.network.MastodonApi
|
||||
import app.pachli.settings.PrefKeys
|
||||
|
@ -101,6 +102,7 @@ class AccountListFragment :
|
|||
binding.recyclerView.addItemDecoration(
|
||||
MaterialDividerItemDecoration(requireContext(), MaterialDividerItemDecoration.VERTICAL),
|
||||
)
|
||||
(requireActivity() as? AppBarLayoutHost)?.appBarLayout?.setLiftOnScrollTargetView(binding.recyclerView)
|
||||
|
||||
binding.swipeRefreshLayout.setOnRefreshListener { fetchAccounts() }
|
||||
binding.swipeRefreshLayout.setColorSchemeColors(MaterialColors.getColor(binding.root, androidx.appcompat.R.attr.colorPrimary))
|
||||
|
|
|
@ -42,6 +42,7 @@ class FiltersActivity : BaseActivity(), FiltersListener {
|
|||
|
||||
binding.swipeRefreshLayout.setOnRefreshListener { loadFilters() }
|
||||
binding.swipeRefreshLayout.setColorSchemeColors(MaterialColors.getColor(binding.root, androidx.appcompat.R.attr.colorPrimary))
|
||||
binding.includedToolbar.appbar.setLiftOnScrollTargetView(binding.filtersList)
|
||||
|
||||
setTitle(R.string.pref_title_timeline_filters)
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ class FollowedTagsActivity :
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.includedToolbar.appbar.setLiftOnScrollTargetView(binding.followedTagsView)
|
||||
}
|
||||
|
||||
private fun setupRecyclerView(adapter: FollowedTagsAdapter) {
|
||||
|
|
|
@ -89,6 +89,7 @@ class ScheduledStatusActivity :
|
|||
MaterialDividerItemDecoration(this, MaterialDividerItemDecoration.VERTICAL),
|
||||
)
|
||||
binding.scheduledTootList.adapter = adapter
|
||||
binding.includedToolbar.appbar.setLiftOnScrollTargetView(binding.scheduledTootList)
|
||||
|
||||
lifecycleScope.launch {
|
||||
viewModel.data.collectLatest { pagingData ->
|
||||
|
|
Loading…
Reference in New Issue