added detailed time in bottom sheet
This commit is contained in:
parent
3d493e4e58
commit
b86c7a616e
3 changed files with 13 additions and 26 deletions
|
|
@ -92,22 +92,6 @@ class HistoryAdapter(onItemClickListener: OnItemClickListener, activity: Activit
|
|||
System.currentTimeMillis(),
|
||||
DateUtils.MINUTE_IN_MILLIS
|
||||
)
|
||||
//
|
||||
// val time = item.time
|
||||
// val downloadedTime: String
|
||||
// if (time == 0L) {
|
||||
// downloadedTime = activity.getString(R.string.currently_downloading) + " " + item.type
|
||||
// } else {
|
||||
// val cal = Calendar.getInstance()
|
||||
// val date = Date(time * 1000L)
|
||||
// cal.time = date
|
||||
// val day = cal[Calendar.DAY_OF_MONTH]
|
||||
// val month = cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault())
|
||||
// val year = cal[Calendar.YEAR]
|
||||
// val formatter: DateFormat = SimpleDateFormat("HH:mm", Locale.getDefault())
|
||||
// val timeString = formatter.format(date)
|
||||
// downloadedTime = "$day $month $year - $timeString"
|
||||
// }
|
||||
datetime.text = relativeTime
|
||||
|
||||
// BUTTON ----------------------------------
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ import com.google.android.material.chip.ChipGroup
|
|||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
import java.io.File
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
/**
|
||||
* A fragment representing a list of Items.
|
||||
|
|
@ -416,11 +420,9 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{
|
|||
val codec = bottomSheet!!.findViewById<TextView>(R.id.codec)
|
||||
val fileSize = bottomSheet!!.findViewById<TextView>(R.id.file_size)
|
||||
|
||||
time!!.text = DateUtils.getRelativeTimeSpanString(
|
||||
item.time * 1000L,
|
||||
System.currentTimeMillis(),
|
||||
DateUtils.MINUTE_IN_MILLIS
|
||||
)
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.timeInMillis = item.time * 1000L
|
||||
time!!.text = SimpleDateFormat(android.text.format.DateFormat.getBestDateTimePattern(Locale.getDefault(), "ddMMMyyyy - HHmm"), Locale.getDefault()).format(calendar.time)
|
||||
time.isClickable = false
|
||||
|
||||
if (item.format.format_note == "?" || item.format.format_note == "") formatNote!!.visibility = GONE
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.deniscerri.ytdlnis.ui.downloads
|
|||
import android.app.Activity
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateFormat
|
||||
import android.text.format.DateUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
|
@ -36,6 +37,8 @@ import kotlinx.coroutines.Dispatchers
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.w3c.dom.Text
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickListener {
|
||||
|
|
@ -130,11 +133,9 @@ class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickLi
|
|||
|
||||
if (item.downloadStartTime <= System.currentTimeMillis() / 1000) time!!.visibility = View.GONE
|
||||
else {
|
||||
time!!.text = DateUtils.getRelativeTimeSpanString(
|
||||
item.downloadStartTime,
|
||||
System.currentTimeMillis(),
|
||||
DateUtils.MINUTE_IN_MILLIS
|
||||
)
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.timeInMillis = item.downloadStartTime
|
||||
time!!.text = SimpleDateFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), "ddMMMyyyy - HHmm"), Locale.getDefault()).format(calendar.time)
|
||||
|
||||
time.setOnClickListener {
|
||||
uiUtil.showDatePicker(parentFragmentManager) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue