diff --git a/app/src/main/java/com/deniscerri/ytdlnis/ui/downloadcard/CutVideoBottomSheetDialog.kt b/app/src/main/java/com/deniscerri/ytdlnis/ui/downloadcard/CutVideoBottomSheetDialog.kt index a52fd0c6..eea38ff6 100644 --- a/app/src/main/java/com/deniscerri/ytdlnis/ui/downloadcard/CutVideoBottomSheetDialog.kt +++ b/app/src/main/java/com/deniscerri/ytdlnis/ui/downloadcard/CutVideoBottomSheetDialog.kt @@ -135,8 +135,8 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list val startTimestamp = (values[0].toInt() * timeSeconds) / 100 val endTimestamp = (values[1].toInt() * timeSeconds) / 100 - val startTimestampString = infoUtil.formatIntegerDuration(startTimestamp) - val endTimestampString = infoUtil.formatIntegerDuration(endTimestamp) + val startTimestampString = infoUtil.formatIntegerDuration(startTimestamp, Locale.US) + val endTimestampString = infoUtil.formatIntegerDuration(endTimestamp, Locale.US) fromTextInput.editText!!.setText(startTimestampString) toTextInput.editText!!.setText(endTimestampString) @@ -160,19 +160,19 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list fromTextInput.editText!!.clearFocus() val seconds = convertStringToTimestamp(fromTextInput.editText!!.text.toString()) if (seconds == 0) { - fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startTimestamp)) + fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startTimestamp, Locale.US)) return true } val startValue = (seconds.toFloat() / endTimestamp) * 100 if (startValue > 100){ - fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startTimestamp)) + fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startTimestamp, Locale.US)) return true } rangeSlider.setValues(startValue, rangeSlider.values[1]) val startValueTimeStampSeconds = (startValue.toInt() * timeSeconds) / 100 - fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startValueTimeStampSeconds)) + fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startValueTimeStampSeconds, Locale.US)) return true; } @@ -192,19 +192,19 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list toTextInput.editText!!.clearFocus() val seconds = convertStringToTimestamp(toTextInput.editText!!.text.toString()) if (seconds == 0) { - toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endTimestamp)) + toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endTimestamp, Locale.US)) return true } val endValue = (seconds.toFloat() / endTimestamp) * 100 if (endValue > 100 || endValue <= rangeSlider.values[0].toInt()){ - toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endTimestamp)) + toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endTimestamp, Locale.US)) return true } rangeSlider.setValues(rangeSlider.values[0], endValue) val endValueTimeStampSeconds = (endValue.toInt() * timeSeconds) / 100 - toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endValueTimeStampSeconds)) + toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endValueTimeStampSeconds, Locale.US)) return true; } diff --git a/app/src/main/java/com/deniscerri/ytdlnis/ui/downloads/HistoryFragment.kt b/app/src/main/java/com/deniscerri/ytdlnis/ui/downloads/HistoryFragment.kt index ddc7fc6b..317a6e66 100644 --- a/app/src/main/java/com/deniscerri/ytdlnis/ui/downloads/HistoryFragment.kt +++ b/app/src/main/java/com/deniscerri/ytdlnis/ui/downloads/HistoryFragment.kt @@ -57,7 +57,6 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{ private var mainActivity: MainActivity? = null private var fragmentContext: Context? = null private var layoutinflater: LayoutInflater? = null - private var shimmerCards: ShimmerFrameLayout? = null private var topAppBar: MaterialToolbar? = null private var recyclerView: RecyclerView? = null private var historyAdapter: HistoryAdapter? = null @@ -92,7 +91,6 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{ fragmentContext = context layoutinflater = LayoutInflater.from(context) - shimmerCards = view.findViewById(R.id.shimmer_history_framelayout) topAppBar = view.findViewById(R.id.history_toolbar) noResults = view.findViewById(R.id.no_results) selectionChips = view.findViewById(R.id.history_selection_chips) @@ -125,7 +123,6 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{ recyclerView?.adapter = historyAdapter noResults?.visibility = GONE - shimmerCards?.visibility = GONE historyViewModel = ViewModelProvider(this)[HistoryViewModel::class.java] diff --git a/app/src/main/java/com/deniscerri/ytdlnis/util/InfoUtil.kt b/app/src/main/java/com/deniscerri/ytdlnis/util/InfoUtil.kt index 0b37cc8a..6d2d966c 100644 --- a/app/src/main/java/com/deniscerri/ytdlnis/util/InfoUtil.kt +++ b/app/src/main/java/com/deniscerri/ytdlnis/util/InfoUtil.kt @@ -116,7 +116,7 @@ class InfoUtil(context: Context) { for (i in 0 until dataArray.length()) { val element = dataArray.getJSONObject(i) if (!element.getString("type").equals("video")) continue - val duration = formatIntegerDuration(element.getInt("lengthSeconds")) + val duration = formatIntegerDuration(element.getInt("lengthSeconds"), Locale.getDefault()) if (duration == "0:00") { continue } @@ -279,7 +279,7 @@ class InfoUtil(context: Context) { if (author.isBlank()) throw Exception() - val duration = formatIntegerDuration(obj.getInt("lengthSeconds")) + val duration = formatIntegerDuration(obj.getInt("lengthSeconds"), Locale.getDefault()) val thumb = "https://i.ytimg.com/vi/$id/hqdefault.jpg" val url = "https://www.youtube.com/watch?v=$id" val formats : ArrayList = ArrayList() @@ -515,7 +515,7 @@ class InfoUtil(context: Context) { } var duration = "" if (jsonObject.has("duration")) { - duration = formatIntegerDuration(jsonObject.getInt("duration")) + duration = formatIntegerDuration(jsonObject.getInt("duration"), Locale.getDefault()) } val url = jsonObject.getString("webpage_url") var thumb: String? = "" @@ -615,9 +615,9 @@ class InfoUtil(context: Context) { return duration } - fun formatIntegerDuration(dur: Int): String { + fun formatIntegerDuration(dur: Int, locale: Locale): String { var format = String.format( - Locale.getDefault(), + locale, "%02d:%02d:%02d", dur / 3600, dur % 3600 / 60, diff --git a/app/src/main/res/layout/fragment_history.xml b/app/src/main/res/layout/fragment_history.xml index 229ab6d5..9751e5d3 100644 --- a/app/src/main/res/layout/fragment_history.xml +++ b/app/src/main/res/layout/fragment_history.xml @@ -121,49 +121,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/fragment_more.xml b/app/src/main/res/layout/fragment_more.xml index f03801d6..829ca95d 100644 --- a/app/src/main/res/layout/fragment_more.xml +++ b/app/src/main/res/layout/fragment_more.xml @@ -33,7 +33,7 @@ android:paddingVertical="15dp" android:drawablePadding="35dp" android:textSize="16sp" - app:drawableLeftCompat="@drawable/ic_terminal" /> + app:drawableStartCompat="@drawable/ic_terminal" /> + app:drawableStartCompat="@drawable/ic_baseline_file_open_24" /> + app:drawableStartCompat="@drawable/ic_baseline_keyboard_arrow_right_24" /> + app:drawableStartCompat="@drawable/ic_concurrent_downloads" /> + app:drawableStartCompat="@drawable/ic_power" /> - + + app:drawableStartCompat="@drawable/ic_settings" /> diff --git a/app/src/main/res/layout/history_card.xml b/app/src/main/res/layout/history_card.xml index 6d0de877..62dcb462 100644 --- a/app/src/main/res/layout/history_card.xml +++ b/app/src/main/res/layout/history_card.xml @@ -60,12 +60,12 @@ + app:drawableStartCompat="@drawable/ic_arrow_up" /> + app:drawableStartCompat="@drawable/ic_arrow_up" /> + app:drawableStartCompat="@drawable/ic_arrow_up" /> + app:drawableStartCompat="@drawable/ic_arrow_up" />