Increase trigger distance of swipe to refresh

This commit is contained in:
Willi Ye 2021-03-29 20:40:48 +02:00 committed by ◱ Mark
parent 88b05f45d5
commit 61c489dc68
3 changed files with 11 additions and 11 deletions

View File

@ -28,6 +28,10 @@ android {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
kotlinOptions {
jvmTarget = javaVersion.toString()
}
buildTypes {
release {
debuggable true
@ -48,6 +52,10 @@ android {
shrinkResources false
}
}
buildFeatures {
prefab true
viewBinding true
}
/* Linting */
lintOptions {
@ -56,7 +64,6 @@ android {
/* NDK */
ndkVersion '22.0.7026061'
externalNativeBuild {
cmake {
version '3.18.1+'
@ -67,14 +74,6 @@ android {
aaptOptions {
ignoreAssetsPattern "*.md"
}
kotlinOptions {
jvmTarget = javaVersion.toString()
}
buildFeatures {
viewBinding true
prefab true
}
}
dependencies {

View File

@ -41,6 +41,7 @@ import emu.skyline.loader.RomFormat
import emu.skyline.utils.Settings
import javax.inject.Inject
import kotlin.math.ceil
import kotlin.math.roundToInt
@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
@ -111,7 +112,7 @@ class MainActivity : AppCompatActivity() {
binding.swipeRefreshLayout.apply {
setProgressBackgroundColorSchemeColor(obtainStyledAttributes(intArrayOf(R.attr.colorPrimary)).use { it.getColor(0, Color.BLACK) })
setColorSchemeColors(obtainStyledAttributes(intArrayOf(R.attr.colorAccent)).use { it.getColor(0, Color.BLACK) })
post { setDistanceToTriggerSync(binding.swipeRefreshLayout.height / 3) }
post { setDistanceToTriggerSync((binding.swipeRefreshLayout.height / 2.5f).roundToInt()) }
setOnRefreshListener { loadRoms(false) }
}

View File

@ -10,8 +10,8 @@ buildscript {
repositories {
google()
jcenter()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'