qml: add deadzones on the edge of the screen to work around android back gesture unintended click events
This commit is contained in:
committed by
accumulator
parent
a6a2679d8a
commit
583afefe33
@@ -17,7 +17,7 @@ Pane {
|
||||
id: layout
|
||||
anchors.fill: parent
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: listview
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -75,7 +75,7 @@ Pane {
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: listview
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.fillHeight: true
|
||||
|
||||
@@ -18,7 +18,7 @@ Pane {
|
||||
color: constants.darkerBackground
|
||||
}
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: listview
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@@ -107,18 +107,6 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
// cover list items, make left side insensitive to clicks
|
||||
// this helps with the back gesture on newer androids
|
||||
id: left_backgesture_hack
|
||||
anchors {
|
||||
top: listview.top
|
||||
left: listview.left
|
||||
bottom: listview.bottom
|
||||
}
|
||||
width: constants.fingerWidth
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: dragb
|
||||
anchors.right: vdragscroll.left
|
||||
|
||||
@@ -39,7 +39,7 @@ Pane {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: listview
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
@@ -79,7 +79,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: thousands
|
||||
@@ -96,7 +95,6 @@ Pane {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: fiatEnable
|
||||
@@ -125,7 +123,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: historicRates
|
||||
@@ -162,7 +159,6 @@ Pane {
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: usePin
|
||||
@@ -220,7 +216,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: syncLabels
|
||||
@@ -243,7 +238,6 @@ Pane {
|
||||
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: spendUnconfirmed
|
||||
@@ -267,7 +261,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: useTrampolineRouting
|
||||
@@ -303,7 +296,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: useRecoverableChannels
|
||||
@@ -338,7 +330,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: useFallbackAddress
|
||||
@@ -362,7 +353,6 @@ Pane {
|
||||
RowLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: -constants.paddingSmall
|
||||
spacing: 0
|
||||
Switch {
|
||||
id: enableDebugLogs
|
||||
|
||||
@@ -42,7 +42,7 @@ Pane {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: listview
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
@@ -47,7 +47,7 @@ Pane {
|
||||
horizontalPadding: 0
|
||||
background: PaneInsetBackground {}
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: listview
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
38
electrum/gui/qml/components/controls/ElListView.qml
Normal file
38
electrum/gui/qml/components/controls/ElListView.qml
Normal file
@@ -0,0 +1,38 @@
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls.Material 2.0
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
|
||||
property int width_left_exclusion_zone: 0
|
||||
property int width_right_exclusion_zone: 0
|
||||
|
||||
MouseArea {
|
||||
anchors {top: root.top; left: root.left; bottom: root.bottom }
|
||||
visible: width_left_exclusion_zone > 0
|
||||
width: width_left_exclusion_zone
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors { top: root.top; right: root.right; bottom: root.bottom }
|
||||
visible: width_right_exclusion_zone > 0
|
||||
width: width_right_exclusion_zone
|
||||
}
|
||||
|
||||
// determine distance from sides of window and reserve some
|
||||
// space using noop mouseareas in order to not emit clicks when
|
||||
// android back gesture is used
|
||||
function layoutExclusionZones() {
|
||||
var reserve = constants.fingerWidth / 2
|
||||
var p = root.mapToGlobal(0, 0)
|
||||
width_left_exclusion_zone = Math.max(0, reserve - p.x)
|
||||
p = root.mapToGlobal(width, 0)
|
||||
width_right_exclusion_zone = Math.max(0, reserve - (app.width - p.x))
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
layoutExclusionZones()
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: constants.paddingLarge
|
||||
|
||||
ListView {
|
||||
ElListView {
|
||||
id: serversListView
|
||||
anchors.fill: parent
|
||||
model: Network.serverListModel
|
||||
|
||||
Reference in New Issue
Block a user