Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Added bottom gesture for triggering cursor mover/advanced functions (#98
Browse files Browse the repository at this point in the history
)

Previously, the cursor mover/advanced functions can only be used if and only if, a space key is present in the layout so this excludes layouts such as Japanese, emoji, numpad, etc.
This can be removed and still work but I guess a hint is essential for discoverability and consistency.
This bottom gesture solves this and also improves the flow because instead of pressing and holding and waiting, you just swipe up from the bottom.
  • Loading branch information
kugiigi authored and UniversalSuperBox committed Nov 21, 2019
1 parent b41a930 commit 5a1bb21
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugins/az/qml/Keyboard_az.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/az/qml/Keyboard_az_email.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/az/qml/Keyboard_az_url.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/az/qml/Keyboard_az_url_search.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/fa/qml/Keyboard_symbols_fa.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; label: "اب‌پ"; shifted: "اب‌پ"; anchors.left: parent.left; height: parent.height; }
CharKey { id: commaKey; label: "،"; shifted: "،"; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/tr/qml/Keyboard_tr.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/tr/qml/Keyboard_tr_email.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/tr/qml/Keyboard_tr_url.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
2 changes: 1 addition & 1 deletion plugins/tr/qml/Keyboard_tr_url_search.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down
64 changes: 62 additions & 2 deletions qml/Keyboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Item {
objectName: "floatingActions"

z: 1
visible: fullScreenItem.cursorSwipe && !cursorSwipeArea.pressed
visible: fullScreenItem.cursorSwipe && !cursorSwipeArea.pressed && !bottomSwipe.pressed
}

MouseArea {
Expand All @@ -337,7 +337,7 @@ Item {
color: cursorSwipeArea.selectionMode ? fullScreenItem.theme.selectionColor : fullScreenItem.theme.charKeyPressedColor

Label {
visible: !cursorSwipeArea.pressed
visible: !cursorSwipeArea.pressed && !bottomSwipe.pressed
horizontalAlignment: Text.AlignHCenter
color: cursorSwipeArea.selectionMode ? UbuntuColors.porcelain : fullScreenItem.theme.fontColor
wrapMode: Text.WordWrap
Expand Down Expand Up @@ -418,6 +418,66 @@ Item {
firstPress = Qt.point(0,0)
}
}

SwipeArea{
id: bottomSwipe

property bool draggingCustom: distance >= units.gu(4)
property bool readyToSwipe: false

height: units.gu(1.5)
anchors{
left: parent.left
right: parent.right
bottom: parent.bottom
}
direction: SwipeArea.Upwards
immediateRecognition: true

onDraggingCustomChanged:{
if (dragging && !fullScreenItem.cursorSwipe) {
readyToSwipe = false
swipeDelay.restart()
fullScreenItem.cursorSwipe = true
}
}

onTouchPositionChanged: {
if (fullScreenItem.cursorSwipe && readyToSwipe) {
fullScreenItem.processSwipe(touchPosition.x, touchPosition.y)
}
}

onPressedChanged: {
if (!pressed) {
fullScreenItem.timerSwipe.restart()
}else{
fullScreenItem.timerSwipe.stop()
}
}

Timer {
id: swipeDelay
interval: 100
running: false
onTriggered: {
fullScreenItem.prevSwipePositionX = bottomSwipe.touchPosition.x
fullScreenItem.prevSwipePositionY = bottomSwipe.touchPosition.y
bottomSwipe.readyToSwipe = true
}
}
}

Icon {
id: bottomHint
name: "toolkit_bottom-edge-hint"
visible: !fullScreenItem.cursorSwipe
width: units.gu(3)
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
}

} // canvas

Expand Down
2 changes: 1 addition & 1 deletion qml/keys/key_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var actionKeyPressedColor = "#aeaeae"
var actionKeyBorderColor = "#888888"

var top_margin = 1; // gu
var bottom_margin = 0; // gu
var bottom_margin = 1; // gu
var tabletRowMargin = 1; // gu
var phoneRowMarginLandscape = 4; // dp
var phoneRowMarginPortrait = 7; // dp
Expand Down
2 changes: 1 addition & 1 deletion qml/languages/Keyboard_symbols.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ KeyPad {
anchors.left: parent.left
anchors.right: parent.right

height: panel.keyHeight + units.gu(UI.bottom_margin*2);
height: panel.keyHeight + units.gu(UI.row_margin);

SymbolShiftKey { id: symShiftKey; label: "ABC"; shifted: "ABC"; anchors.left: parent.left; height: parent.height; }
CharKey { id: commaKey; label: ","; shifted: "/"; anchors.left: symShiftKey.right; height: parent.height; }
Expand Down

0 comments on commit 5a1bb21

Please sign in to comment.