1.2.2: fix accidental pull-to-refresh; settings tabs on phones
Some checks are pending
build / apk (push) Waiting to run
Some checks are pending
build / apk (push) Waiting to run
- the web app reports the message list's scroll position through the bridge, so pull-to-refresh only fires when the list is really at the top; the trigger distance is bigger (the WebView itself never scrolls) - settings tabs scroll horizontally on narrow screens (all tabs reachable) - version 1.2.2
This commit is contained in:
parent
bcebc1dbcf
commit
ad92e93660
2 changed files with 17 additions and 2 deletions
|
|
@ -22,8 +22,8 @@ android {
|
|||
applicationId = "dev.n1ko.nikogpt"
|
||||
minSdk = 29 // Android 10
|
||||
targetSdk = 35
|
||||
versionCode = 7
|
||||
versionName = "1.2.1"
|
||||
versionCode = 8
|
||||
versionName = "1.2.2"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
// Shared text ("Share to NikoGPT") waiting for the page to load.
|
||||
private var pendingShare: String? = null
|
||||
// Whether the chat's inner scroll container is at the top; pull-to-refresh
|
||||
// only fires there (the WebView itself never scrolls).
|
||||
@Volatile
|
||||
private var webAtTop = true
|
||||
// Where the camera writes the picture before it reaches the web app.
|
||||
private var pendingCameraUri: Uri? = null
|
||||
|
||||
|
|
@ -276,6 +280,10 @@ class MainActivity : AppCompatActivity() {
|
|||
})
|
||||
|
||||
refresh.setOnRefreshListener { webView.reload() }
|
||||
// Pull-to-refresh only when the chat list is really at the top; a
|
||||
// bigger trigger distance keeps normal scrolling from reloading.
|
||||
refresh.setOnChildScrollUpCallback { _, _ -> !webAtTop }
|
||||
refresh.setDistanceToTriggerSync((80 * resources.displayMetrics.density).toInt())
|
||||
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
|
|
@ -352,6 +360,13 @@ class MainActivity : AppCompatActivity() {
|
|||
fun linkGoogle(clientId: String) {
|
||||
runOnUiThread { openGooglePicker(clientId, link = true) }
|
||||
}
|
||||
|
||||
// The web app reports the message list's scroll position, so pulling
|
||||
// down only refreshes when the list really is at the top.
|
||||
@JavascriptInterface
|
||||
fun setAtTop(atTop: Boolean) {
|
||||
webAtTop = atTop
|
||||
}
|
||||
}
|
||||
|
||||
// openGooglePicker tries the native pickers in order: Credential Manager
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue