From 414082d2581a056fc38bd45f062f51959a14e3b2 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 20 Jul 2019 18:28:00 -0400 Subject: [PATCH] Make EditAccount keyboard-flickable, fix function --- src/qml/Pages/EditAccount/EditAccount.qml | 1 + src/qml/Shortcuts.qml | 13 +++++-------- src/qml/UI.qml | 16 ++++++++-------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/qml/Pages/EditAccount/EditAccount.qml b/src/qml/Pages/EditAccount/EditAccount.qml index 2c848eb1..14b7cc7d 100644 --- a/src/qml/Pages/EditAccount/EditAccount.qml +++ b/src/qml/Pages/EditAccount/EditAccount.qml @@ -9,6 +9,7 @@ import "../../utils.js" as Utils HPage { id: editAccount + Component.onCompleted: shortcuts.flickTarget = flickable property int avatarPreferredSize: 256 diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index 18d74056..9dfe19cf 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -7,15 +7,12 @@ Item { property Item flickTarget: Item {} function smartVerticalFlick(baseVelocity, fastMultiply=3) { - let vel = flickTarget.verticalVelocity + if (! flickTarget.interactive) { return } - if (flickTarget.verticalLayoutDirection == ListView.BottomToTop) { - baseVelocity = -baseVelocity - vel = -vel - } - - let fast = (baseVelocity < 0 && vel < baseVelocity / 2) || - (baseVelocity > 0 && vel > baseVelocity / 2) + baseVelocity = -baseVelocity + let vel = -flickTarget.verticalVelocity + let fast = (baseVelocity < 0 && vel < baseVelocity / 2) || + (baseVelocity > 0 && vel > baseVelocity / 2) flickTarget.flick(0, baseVelocity * (fast ? fastMultiply : 1)) } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 2ccc69bb..8e845722 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -74,19 +74,19 @@ Item { id: initialRoomTimer interval: 4000 repeat: false - onTriggered: pageStack.showRoom( - "@test_mary:matrix.org", - "Rooms", + // onTriggered: pageStack.showRoom( + // "@test_mary:matrix.org", + // "Rooms", // "!TSXGsbBbdwsdylIOJZ:matrix.org" // st // "!VDSsFIzQnXARSCVNxS:matrix.org" // hs - "!XhxUcnVhVhUHkBZEIL:matrix.org" // nc + // "!XhxUcnVhVhUHkBZEIL:matrix.org" // nc // "Invites", // "!xjqvLOGhMVutPXpAqi:matrix.org" - ) - // onTriggered: pageStack.showPage( - // "EditAccount/EditAccount", - // {"userId": "@test_mary:matrix.org"} // ) + onTriggered: pageStack.showPage( + "EditAccount/EditAccount", + {"userId": "@test_mary:matrix.org"} + ) } onCurrentItemChanged: if (currentItem) {