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(),
|
System.currentTimeMillis(),
|
||||||
DateUtils.MINUTE_IN_MILLIS
|
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
|
datetime.text = relativeTime
|
||||||
|
|
||||||
// BUTTON ----------------------------------
|
// BUTTON ----------------------------------
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,10 @@ import com.google.android.material.chip.ChipGroup
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
import java.io.File
|
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.
|
* 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 codec = bottomSheet!!.findViewById<TextView>(R.id.codec)
|
||||||
val fileSize = bottomSheet!!.findViewById<TextView>(R.id.file_size)
|
val fileSize = bottomSheet!!.findViewById<TextView>(R.id.file_size)
|
||||||
|
|
||||||
time!!.text = DateUtils.getRelativeTimeSpanString(
|
val calendar = Calendar.getInstance()
|
||||||
item.time * 1000L,
|
calendar.timeInMillis = item.time * 1000L
|
||||||
System.currentTimeMillis(),
|
time!!.text = SimpleDateFormat(android.text.format.DateFormat.getBestDateTimePattern(Locale.getDefault(), "ddMMMyyyy - HHmm"), Locale.getDefault()).format(calendar.time)
|
||||||
DateUtils.MINUTE_IN_MILLIS
|
|
||||||
)
|
|
||||||
time.isClickable = false
|
time.isClickable = false
|
||||||
|
|
||||||
if (item.format.format_note == "?" || item.format.format_note == "") formatNote!!.visibility = GONE
|
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.app.Activity
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.format.DateFormat
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
|
@ -36,6 +37,8 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.w3c.dom.Text
|
import org.w3c.dom.Text
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickListener {
|
class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickListener {
|
||||||
|
|
@ -130,11 +133,9 @@ class QueuedDownloadsFragment : Fragment(), GenericDownloadAdapter.OnItemClickLi
|
||||||
|
|
||||||
if (item.downloadStartTime <= System.currentTimeMillis() / 1000) time!!.visibility = View.GONE
|
if (item.downloadStartTime <= System.currentTimeMillis() / 1000) time!!.visibility = View.GONE
|
||||||
else {
|
else {
|
||||||
time!!.text = DateUtils.getRelativeTimeSpanString(
|
val calendar = Calendar.getInstance()
|
||||||
item.downloadStartTime,
|
calendar.timeInMillis = item.downloadStartTime
|
||||||
System.currentTimeMillis(),
|
time!!.text = SimpleDateFormat(DateFormat.getBestDateTimePattern(Locale.getDefault(), "ddMMMyyyy - HHmm"), Locale.getDefault()).format(calendar.time)
|
||||||
DateUtils.MINUTE_IN_MILLIS
|
|
||||||
)
|
|
||||||
|
|
||||||
time.setOnClickListener {
|
time.setOnClickListener {
|
||||||
uiUtil.showDatePicker(parentFragmentManager) {
|
uiUtil.showDatePicker(parentFragmentManager) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue