Added QOL improvements

- fast scroll in module/filter list
- auto closing keyboard on scroll
This commit is contained in:
Viktor De Pasquale 2019-11-19 17:15:44 +01:00
parent f5342a09d3
commit 0a239c2fef
6 changed files with 54 additions and 0 deletions

View File

@ -22,10 +22,12 @@ class ModuleInstallDialog(private val item: Repo) : DialogEvent() {
.cancellable(true)
.applyButton(MagiskDialog.ButtonType.POSITIVE) {
titleRes = R.string.install
icon = R.drawable.ic_install
onClick { download(true) }
}
.applyButton(MagiskDialog.ButtonType.NEGATIVE) {
titleRes = R.string.download
icon = R.drawable.ic_download_md2
onClick { download(false) }
}
.reveal()

View File

@ -17,6 +17,7 @@ import androidx.core.view.marginBottom
import androidx.core.view.marginEnd
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.circularreveal.CircularRevealCompat
import com.google.android.material.circularreveal.CircularRevealWidget
import com.google.android.material.floatingactionbutton.FloatingActionButton
@ -50,6 +51,11 @@ class HideFragment : CompatFragment<HideViewModel, FragmentHideMd2Binding>() {
hideKeyboard()
MotionRevealHelper.withViews(binding.hideFilter, binding.hideFilterToggle, false)
}
binding.hideContent.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
if (newState != RecyclerView.SCROLL_STATE_IDLE) hideKeyboard()
}
})
val lama = binding.hideContent.layoutManager ?: return
lama.isAutoMeasureEnabled = false

View File

@ -8,6 +8,7 @@ import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.databinding.FragmentModuleMd2Binding
@ -55,6 +56,12 @@ class ModuleFragment : CompatFragment<ModuleViewModel, FragmentModuleMd2Binding>
hideKeyboard()
MotionRevealHelper.withViews(binding.moduleFilter, binding.moduleFilterToggle, false)
}
binding.moduleFilterInclude.moduleFilterList.addOnScrollListener(object :
RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
if (newState != RecyclerView.SCROLL_STATE_IDLE) hideKeyboard()
}
})
}
override fun onDestroyView() {

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="?colorOnSurfaceVariant" />
<size android:width="5dp" android:height="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="?colorOnSurfaceVariant" />
<size android:width="5dp" android:height="5dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>

View File

@ -30,6 +30,11 @@
items="@{viewModel.itemsSearch}"
android:layout_width="match_parent"
android:layout_height="0dp"
app:fastScrollEnabled="true"
app:fastScrollHorizontalThumbDrawable="@drawable/fast_scroll_thumb"
app:fastScrollHorizontalTrackDrawable="@drawable/fast_scroll_track"
app:fastScrollVerticalThumbDrawable="@drawable/fast_scroll_thumb"
app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track"
android:layout_marginBottom="@dimen/l1"
android:clipToPadding="false"
android:orientation="vertical"