For #13031: Show size in KB for smaller downloaded files.

pull/200/head^2
mcarare 4 years ago committed by Arturo Mejia
parent ee4a5283a4
commit b696fc4c4b

@ -11,7 +11,7 @@ import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.download_dialog_layout.view.*
import mozilla.components.browser.state.state.content.DownloadState
import mozilla.components.feature.downloads.AbstractFetchDownloadService
import mozilla.components.feature.downloads.toMegabyteString
import mozilla.components.feature.downloads.toMegabyteOrKilobyteString
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.metrics
@ -86,7 +86,7 @@ class DynamicDownloadDialog(
} else {
val titleText = container.context.getString(
R.string.mozac_feature_downloads_completed_notification_text2
) + " (${downloadState.contentLength?.toMegabyteString()})"
) + " (${downloadState.contentLength?.toMegabyteOrKilobyteString()})"
view.download_dialog_title.text = titleText

@ -8,12 +8,12 @@ import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.download_list_item.view.*
import kotlinx.android.synthetic.main.library_site_item.view.*
import mozilla.components.feature.downloads.toMegabyteOrKilobyteString
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.hideAndDisable
import org.mozilla.fenix.library.SelectionHolder
import org.mozilla.fenix.library.downloads.DownloadInteractor
import org.mozilla.fenix.library.downloads.DownloadItem
import mozilla.components.feature.downloads.toMegabyteString
import org.mozilla.fenix.ext.getIcon
class DownloadsListItemViewHolder(
@ -29,7 +29,7 @@ class DownloadsListItemViewHolder(
) {
itemView.download_layout.visibility = View.VISIBLE
itemView.download_layout.titleView.text = item.fileName
itemView.download_layout.urlView.text = item.size.toLong().toMegabyteString()
itemView.download_layout.urlView.text = item.size.toLong().toMegabyteOrKilobyteString()
itemView.download_layout.setSelectionInteractor(item, selectionHolder, downloadInteractor)
itemView.download_layout.changeSelected(item in selectionHolder.selectedItems)

Loading…
Cancel
Save