Commit c5f2f634 authored by Viktor De Pasquale's avatar Viktor De Pasquale

Fixed slow scrolling and list updates on hide screen

parent b2b81a5d
...@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.redesign.hide ...@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.redesign.hide
import android.content.Context import android.content.Context
import android.graphics.Insets import android.graphics.Insets
import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuInflater import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
...@@ -24,13 +25,21 @@ class HideFragment : CompatFragment<HideViewModel, FragmentHideMd2Binding>() { ...@@ -24,13 +25,21 @@ class HideFragment : CompatFragment<HideViewModel, FragmentHideMd2Binding>() {
setHasOptionsMenu(true) setHasOptionsMenu(true)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val lama = binding.hideContent.layoutManager ?: return
lama.isAutoMeasureEnabled = false
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_hide_md2, menu) inflater.inflate(R.menu.menu_hide_md2, menu)
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.action_focus_up -> binding.hideScrollContainer.fullScroll(View.FOCUS_UP) R.id.action_focus_up -> binding.hideContent
.also { it.scrollToPosition(10) }
.also { it.smoothScrollToPosition(0) }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }
......
...@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.redesign.module ...@@ -3,7 +3,6 @@ package com.topjohnwu.magisk.redesign.module
import android.graphics.Insets import android.graphics.Insets
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
import com.topjohnwu.magisk.redesign.compat.CompatFragment import com.topjohnwu.magisk.redesign.compat.CompatFragment
...@@ -37,7 +36,7 @@ class ModuleFragment : CompatFragment<ModuleViewModel, FragmentModuleMd2Binding> ...@@ -37,7 +36,7 @@ class ModuleFragment : CompatFragment<ModuleViewModel, FragmentModuleMd2Binding>
} }
private fun setEndlessScroller() { private fun setEndlessScroller() {
val lama = binding.moduleRemote.layoutManager as? StaggeredGridLayoutManager ?: return val lama = binding.moduleRemote.layoutManager ?: return
lama.isAutoMeasureEnabled = false lama.isAutoMeasureEnabled = false
listener = EndlessRecyclerScrollListener(lama, viewModel::loadRemote) listener = EndlessRecyclerScrollListener(lama, viewModel::loadRemote)
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
style="?styleProgressDeterminate" style="?styleProgressDeterminate"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_gravity="top" android:layout_gravity="top"
progressAnimated="@{item.itemsCheckedPercent}" /> android:progress="@{item.itemsCheckedPercent}" />
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment