fixed video not cutting in arabic
This commit is contained in:
parent
9dbf92a5d1
commit
e732bf0103
7 changed files with 31 additions and 75 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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<Format> = 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,
|
||||
|
|
|
|||
|
|
@ -121,49 +121,6 @@
|
|||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
<com.facebook.shimmer.ShimmerFrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/chips_recycler_horizontalscrollview"
|
||||
android:id="@+id/shimmer_history_framelayout"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/shimmer_history_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
<include layout="@layout/history_card_shimmer" />
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
android:paddingVertical="15dp"
|
||||
android:drawablePadding="35dp"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_terminal" />
|
||||
app:drawableStartCompat="@drawable/ic_terminal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logs"
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
android:paddingVertical="15dp"
|
||||
android:drawablePadding="35dp"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_baseline_file_open_24" />
|
||||
app:drawableStartCompat="@drawable/ic_baseline_file_open_24" />
|
||||
|
||||
|
||||
<TextView
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
android:focusable="true"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingHorizontal="15dp"
|
||||
app:drawableLeftCompat="@drawable/ic_baseline_keyboard_arrow_right_24" />
|
||||
app:drawableStartCompat="@drawable/ic_baseline_keyboard_arrow_right_24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_queue"
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
android:focusable="true"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingHorizontal="15dp"
|
||||
app:drawableLeftCompat="@drawable/ic_concurrent_downloads" />
|
||||
app:drawableStartCompat="@drawable/ic_concurrent_downloads" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/terminate"
|
||||
|
|
@ -94,10 +94,12 @@
|
|||
android:text="@string/kill_app"
|
||||
android:textStyle="bold"
|
||||
android:paddingHorizontal="15dp"
|
||||
app:drawableLeftCompat="@drawable/ic_power" />
|
||||
app:drawableStartCompat="@drawable/ic_power" />
|
||||
|
||||
|
||||
<View style="@style/Divider.Horizontal" />
|
||||
<View
|
||||
android:layout_margin="0dp"
|
||||
style="@style/Divider.Horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings"
|
||||
|
|
@ -112,7 +114,7 @@
|
|||
android:focusable="true"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingHorizontal="15dp"
|
||||
app:drawableLeftCompat="@drawable/ic_settings" />
|
||||
app:drawableStartCompat="@drawable/ic_settings" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/downloads_info_bottom"
|
||||
android:layout_width="296dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="bottom"
|
||||
android:maxLines="1"
|
||||
android:layout_margin="10dp"
|
||||
android:scrollbars="none"
|
||||
android:shadowColor="@color/black"
|
||||
android:shadowDx="4"
|
||||
|
|
@ -75,15 +75,15 @@
|
|||
android:textSize="11sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/downloads_info_time"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/downloads_title"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/downloads_info_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom|end"
|
||||
android:layout_margin="10dp"
|
||||
android:shadowColor="@color/black"
|
||||
android:shadowDx="4"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/date_added"
|
||||
app:drawableLeftCompat="@drawable/ic_arrow_up" />
|
||||
app:drawableStartCompat="@drawable/ic_arrow_up" />
|
||||
|
||||
|
||||
<TextView
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/title"
|
||||
app:drawableLeftCompat="@drawable/ic_arrow_up" />
|
||||
app:drawableStartCompat="@drawable/ic_arrow_up" />
|
||||
|
||||
|
||||
<TextView
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/author"
|
||||
app:drawableLeftCompat="@drawable/ic_arrow_up" />
|
||||
app:drawableStartCompat="@drawable/ic_arrow_up" />
|
||||
|
||||
|
||||
<TextView
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="@string/file_size"
|
||||
app:drawableLeftCompat="@drawable/ic_arrow_up" />
|
||||
app:drawableStartCompat="@drawable/ic_arrow_up" />
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue