For #16541: Download UX Updates
This commit is contained in:
parent
faf765a57d
commit
ef01cdcefe
|
@ -36,7 +36,7 @@ class DownloadAdapter(
|
|||
override fun onBindViewHolder(holder: DownloadsListItemViewHolder, position: Int) {
|
||||
val current = downloads[position]
|
||||
val isPendingDeletion = pendingDeletionIds.contains(current.id)
|
||||
holder.bind(downloads[position], position == 0, mode, isPendingDeletion)
|
||||
holder.bind(downloads[position], mode, isPendingDeletion)
|
||||
}
|
||||
|
||||
fun updateDownloads(downloads: List<DownloadItem>) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
|
|||
launch(Dispatchers.Main) {
|
||||
showSnackBar(
|
||||
requireView(),
|
||||
getString(R.string.download_delete_multiple_items_snackbar)
|
||||
getString(R.string.download_delete_multiple_items_snackbar_1)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
|
|||
inflater.inflate(menuRes, menu)
|
||||
|
||||
menu.findItem(R.id.delete_downloads_multi_select)?.title =
|
||||
SpannableString(getString(R.string.bookmark_menu_delete_button)).apply {
|
||||
SpannableString(getString(R.string.download_delete_item_1)).apply {
|
||||
setTextColor(requireContext(), R.attr.destructive)
|
||||
}
|
||||
}
|
||||
|
@ -191,16 +191,23 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
|
|||
downloadStore.dispatch(DownloadFragmentAction.ExitEditMode)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.select_all_downloads_multi_select -> {
|
||||
for (items in downloadStore.state.items) {
|
||||
downloadInteractor.select(items)
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun getMultiSelectSnackBarMessage(downloadItems: Set<DownloadItem>): String {
|
||||
return if (downloadItems.size > 1) {
|
||||
getString(R.string.download_delete_multiple_items_snackbar)
|
||||
getString(R.string.download_delete_multiple_items_snackbar_1)
|
||||
} else {
|
||||
String.format(
|
||||
requireContext().getString(
|
||||
R.string.history_delete_single_item_snackbar
|
||||
R.string.download_delete_single_item_snackbar
|
||||
), downloadItems.first().fileName
|
||||
)
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class DownloadView(
|
|||
download_list.isVisible = userHasDownloads
|
||||
download_empty_view.isVisible = !userHasDownloads
|
||||
if (!userHasDownloads) {
|
||||
download_empty_view.announceForAccessibility(context.getString(R.string.download_empty_message))
|
||||
download_empty_view.announceForAccessibility(context.getString(R.string.download_empty_message_1))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ class DownloadsListItemViewHolder(
|
|||
|
||||
fun bind(
|
||||
item: DownloadItem,
|
||||
showDeleteButton: Boolean,
|
||||
mode: DownloadFragmentState.Mode,
|
||||
isPendingDeletion: Boolean = false
|
||||
) {
|
||||
|
@ -54,15 +53,21 @@ class DownloadsListItemViewHolder(
|
|||
itemView.download_layout.titleView.text = item.fileName
|
||||
itemView.download_layout.urlView.text = item.size.toLong().toMegabyteOrKilobyteString()
|
||||
|
||||
toggleTopContent(showDeleteButton, mode == DownloadFragmentState.Mode.Normal)
|
||||
toggleTopContent(false, mode == DownloadFragmentState.Mode.Normal)
|
||||
|
||||
itemView.download_layout.setSelectionInteractor(item, selectionHolder, downloadInteractor)
|
||||
itemView.download_layout.changeSelected(item in selectionHolder.selectedItems)
|
||||
|
||||
itemView.favicon.setImageResource(item.getIcon())
|
||||
|
||||
itemView.overflow_menu.setImageResource(R.drawable.ic_delete)
|
||||
|
||||
itemView.overflow_menu.showAndEnable()
|
||||
|
||||
itemView.overflow_menu.setOnClickListener {
|
||||
downloadInteractor.onDeleteSome(setOf(item))
|
||||
}
|
||||
|
||||
this.item = item
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/download_empty_message"
|
||||
android:text="@string/download_empty_message_1"
|
||||
android:textColor="?secondaryText"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/select_all_downloads_multi_select"
|
||||
android:title="@string/create_collection_select_all"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/delete_downloads_multi_select"
|
||||
android:title="@string/download_delete_item"
|
||||
android:title="@string/download_delete_item_1"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -710,16 +710,18 @@
|
|||
<!-- Text for the dialog to confirm clearing all downloads -->
|
||||
<string name="download_delete_all_dialog">Are you sure you want to clear your downloads?</string>
|
||||
<!-- Text for the snackbar to confirm that multiple downloads items have been deleted -->
|
||||
<string name="download_delete_multiple_items_snackbar">Downloads Deleted</string>
|
||||
<string name="download_delete_multiple_items_snackbar_1">Downloads Removed</string>
|
||||
<!-- Text for the snackbar to confirm that a single download item has been deleted. The first parameter is the name of the download item. -->
|
||||
<string name="download_delete_single_item_snackbar">Removed %1$s</string>
|
||||
<!-- Text shown when no download exists -->
|
||||
<string name="download_empty_message">No downloads here</string>
|
||||
<string name="download_empty_message_1">No downloaded files</string>
|
||||
<!-- History multi select title in app bar
|
||||
The first parameter is the number of downloads selected -->
|
||||
<string name="download_multi_select_title">%1$d selected</string>
|
||||
<!-- History overflow menu open in new tab button -->
|
||||
<string name="download_menu_open">Open</string>
|
||||
<!-- Text for the button to delete a single history item -->
|
||||
<string name="download_delete_item">Delete</string>
|
||||
<string name="download_delete_item_1">Remove</string>
|
||||
|
||||
|
||||
<!-- Crashes -->
|
||||
|
|
Loading…
Reference in New Issue
Block a user