Compare commits

...
Author SHA1 Message Date
Dimitris Kardarakos 0ea2d757d7 Fix action naming and icon 2022-01-02 15:13:02 +02:00
Dimitris Kardarakos 93d7164229 Improve search page item accessibility
On mobile, interaction with the search page swipe list items result in a set of inconveniences:
- Accidentally play a track - triggered by item click- while trying to click the swipe handler, and vice versa
- Swipe list item actions do not offer a text description; you have to try them to see what they offer
- The styling of the swipe list item on mobile, in many cases, makes hard to trigger the actions
- When more than one pages exist in the stack, gestures for swiping an item and navigating between pages overlap

An alternative pattern is offered:
- The search results are presented as simple list items
- When the user clicks on an item, the item is expanded; a new row is displayed, displaying the actions available for this item.
- When the user clicks on an expanded item, the item's actions are hiding
2022-01-02 12:54:38 +00:00
+60 -42
View File
@@ -75,8 +75,9 @@ Kirigami.ScrollablePage {
}
}
}
delegate: Kirigami.SwipeListItem {
delegate: Kirigami.AbstractListItem {
id: delegateItem
property bool showActionButtons: false
required property int index
required property string title
required property int type
@@ -84,55 +85,72 @@ Kirigami.ScrollablePage {
required property var artists
required property string radioPlaylistId
RowLayout {
Layout.fillHeight: true
Kirigami.Icon {
Layout.fillHeight: true
source: {
switch (type) {
case SearchModel.Artist:
return "view-media-artist"
case SearchModel.Album:
return "media-album-cover"
case SearchModel.Playlist:
return "view-media-playlist"
case SearchModel.Song:
return "emblem-music-symbolic"
case SearchModel.Video:
return "emblem-videos-symbolic"
ColumnLayout {
RowLayout {
Layout.fillWidth: true
Kirigami.Icon {
Layout.fillHeight: true
source: {
switch (type) {
case SearchModel.Artist:
return "view-media-artist"
case SearchModel.Album:
return "media-album-cover"
case SearchModel.Playlist:
return "view-media-playlist"
case SearchModel.Song:
return "emblem-music-symbolic"
case SearchModel.Video:
return "emblem-videos-symbolic"
}
}
}
Controls.Label {
Layout.fillWidth: true
text: title
elide: Qt.ElideRight
}
}
Controls.Label {
Kirigami.Separator {
visible: showActionButtons
Layout.fillWidth: true
text: title
elide: Qt.ElideRight
}
Kirigami.ActionToolBar {
Layout.fillWidth: true
alignment: Qt.AlignLeft
visible: showActionButtons
actions: [
Kirigami.Action {
icon.name: (delegateItem.type === SearchModel.Song || delegateItem.type == SearchModel.Video) ? "media-playback-start" : "project-open"
text: (delegateItem.type === SearchModel.Song || delegateItem.type == SearchModel.Video) ? i18n("Play") : i18n("Open")
onTriggered: searchModel.triggerItem(index)
} ,
Kirigami.Action {
icon.name: "go-next"
text: i18n("Play next")
visible: delegateItem.type === SearchModel.Song || delegateItem.type == SearchModel.Video
onTriggered: UserPlaylistModel.playNext(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "media-playlist-append"
text: i18n("Add to Playlist")
visible: delegateItem.type === SearchModel.Song || delegateItem.type == SearchModel.Video
onTriggered: UserPlaylistModel.append(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "radio"
text: i18n("Radio")
visible: delegateItem.type === SearchModel.Artist && delegateItem.radioPlaylistId
onTriggered: playPlaylist(delegateItem.radioPlaylistId)
}
]
}
}
actions: [
Kirigami.Action {
icon.name: "go-next"
text: i18n("Play next")
visible: delegateItem.type === SearchModel.Song || delegateItem.type == SearchModel.Video
onTriggered: UserPlaylistModel.playNext(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "media-playlist-append"
text: i18n("Add to Playlist")
visible: delegateItem.type === SearchModel.Song || delegateItem.type == SearchModel.Video
onTriggered: UserPlaylistModel.append(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "radio"
text: i18n("Radio")
visible: delegateItem.type === SearchModel.Artist && delegateItem.radioPlaylistId
onTriggered: playPlaylist(delegateItem.radioPlaylistId)
}
]
onClicked: searchModel.triggerItem(index)
onClicked: showActionButtons = !showActionButtons
}
Controls.BusyIndicator {
anchors.centerIn: parent