summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-07 17:29:18 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-13 11:32:27 -0700
commit2ef401ef5f995153e366daaacd770d73a92c4503 (patch)
treeee6db378b6317c006e2e7415b70c29c5132fb1a7
parent6422079de59de580740e860994eb46b123baf2a1 (diff)
downloadsubsurface-2ef401ef5f995153e366daaacd770d73a92c4503.tar.gz
Mobile: when selecting dive via map, expand its trip
Previously if the dive was in a different trip, we'd scroll to that trip but not expand the trip, which was a confusing user experience. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/DiveList.qml8
1 files changed, 8 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml
index f94b93042..de06fb14e 100644
--- a/mobile-widgets/qml/DiveList.qml
+++ b/mobile-widgets/qml/DiveList.qml
@@ -49,6 +49,9 @@ Kirigami.ScrollablePage {
Kirigami.AbstractListItem {
// this looks weird, but it's how we can tell that this dive isn't in a trip
property bool diveOutsideTrip: tripNrDives === 0
+ // this allows us to access properties of the currentItem from outside
+ property variant myData: model
+
leftPadding: 0
topPadding: 0
id: innerListItem
@@ -612,8 +615,13 @@ Kirigami.ScrollablePage {
}
function setCurrentDiveListIndex(idx, noScroll) {
+ // pick the dive in the dive list and make sure its trip is expanded
diveListView.currentIndex = idx
+ activeTrip = diveListView.currentItem.myData.tripId
+
+ // update the diveDetails page to also show that dive
detailsWindow.showDiveIndex(idx)
+
// updating the index of the ListView triggers a non-linear scroll
// animation that can be very slow. the fix is to stop this animation
// by setting contentY to itself and then using positionViewAtIndex().