Merge branch 'autoScrollGoTo' of https://github.com/zfox23/hifi into autoScroll

This commit is contained in:
Roxanne Skelly 2018-08-14 15:27:22 -07:00
commit 987d8569ae
3 changed files with 66 additions and 8 deletions

View file

@ -41,6 +41,8 @@ Column {
property var goFunction: null;
property var http: null;
property bool autoScrollTimerEnabled: false;
HifiConstants { id: hifi }
Component.onCompleted: suggestions.getFirstPage();
HifiModels.PSFListModel {
@ -88,7 +90,9 @@ Column {
online_users: data.details.connections || data.details.concurrency || 0,
// Server currently doesn't give isStacked (undefined). Could give bool.
drillDownToPlace: data.is_stacked || (data.action === 'concurrency'),
isStacked: !!data.is_stacked
isStacked: !!data.is_stacked,
time_before_autoscroll_ms: data.hold_time || 3000
};
}
@ -102,9 +106,12 @@ Column {
id: scroll;
model: suggestions;
orientation: ListView.Horizontal;
highlightFollowsCurrentItem: false
highlightMoveDuration: -1;
highlightMoveVelocity: -1;
highlightFollowsCurrentItem: true;
preferredHighlightBegin: 0;
preferredHighlightEnd: cardWidth;
highlightRangeMode: ListView.StrictlyEnforceRange;
highlightMoveDuration: 800;
highlightMoveVelocity: 1;
currentIndex: -1;
spacing: 12;
@ -137,5 +144,54 @@ Column {
hoverThunk: function () { hovered = true }
unhoverThunk: function () { hovered = false }
}
onCountChanged: {
if (scroll.currentIndex === -1 && scroll.count > 0 && root.autoScrollTimerEnabled) {
scroll.currentIndex = 0;
autoScrollTimer.interval = suggestions.get(scroll.currentIndex).time_before_autoscroll_ms;
autoScrollTimer.start();
}
}
onCurrentIndexChanged: {
if (root.autoScrollTimerEnabled) {
autoScrollTimer.interval = suggestions.get(scroll.currentIndex).time_before_autoscroll_ms;
if (!feedMouseArea.containsMouse) {
autoScrollTimer.start();
}
}
}
MouseArea {
id: feedMouseArea;
enabled: root.autoScrollTimerEnabled;
anchors.fill: parent;
hoverEnabled: true;
propagateComposedEvents: true;
onEntered: {
if (autoScrollTimer.running) {
autoScrollTimer.stop();
}
}
onExited: {
autoScrollTimer.restart();
}
}
}
Timer {
id: autoScrollTimer;
interval: 3000;
running: false;
repeat: false;
onTriggered: {
if (scroll.currentIndex !== -1) {
if (scroll.currentIndex === scroll.count - 1) {
scroll.currentIndex = 0;
} else {
scroll.currentIndex++;
}
}
}
}
}

View file

@ -1046,12 +1046,13 @@ Rectangle {
enabled: myData.userName !== "Unknown user" && !userInfoViewer.visible;
hoverEnabled: true;
onClicked: {
// TODO: Change language from "Happening Now" to something else (or remove entirely)
popupComboDialog("Set your availability:",
availabilityComboBox.availabilityStrings,
["Your username will be visible in everyone's 'Nearby' list. Anyone will be able to jump to your location from within the 'Nearby' list.",
"Your location will be visible in the 'Connections' list only for those with whom you are connected or friends. They'll be able to jump to your location if the domain allows.",
"Your location will be visible in the 'Connections' list only for those with whom you are friends. They'll be able to jump to your location if the domain allows. You will only receive 'Happening Now' notifications in 'Go To' from friends.",
"You will appear offline in the 'Connections' list, and you will not receive 'Happening Now' notifications in 'Go To'."],
"Your location will be visible in the 'Connections' list only for those with whom you are connected or friends. They'll be able to jump to your location if the domain allows, and you will see 'Snaps' Blasts from them in 'Go To'.",
"Your location will be visible in the 'Connections' list only for those with whom you are friends. They'll be able to jump to your location if the domain allows, and you will see 'Snaps' Blasts from them in 'Go To'",
"You will appear offline in the 'Connections' list, and you will not receive Snaps Blasts from connections or friends in 'Go To'."],
["all", "connections", "friends", "none"]);
}
onEntered: availabilityComboBox.color = hifi.colors.lightGrayText;

View file

@ -320,11 +320,12 @@ StackView {
width: parent.width;
cardWidth: 312 + (2 * 4);
cardHeight: 163 + (2 * 4);
labelText: 'HAPPENING NOW';
labelText: 'FEATURED';
actions: 'announcement';
filter: addressLine.text;
goFunction: goCard;
http: http;
autoScrollTimerEnabled: true;
}
Feed {
id: places;