implemented multiple cuts in a video

This commit is contained in:
deniscerri 2023-04-08 14:00:42 +02:00
parent f88bfab70e
commit 2bfa9e5138
No known key found for this signature in database
GPG key ID: 95C43D517D830350
11 changed files with 377 additions and 178 deletions

View file

@ -11,6 +11,8 @@ import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.widget.*
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.children
import androidx.lifecycle.lifecycleScope
import com.deniscerri.ytdlnis.R
import com.deniscerri.ytdlnis.database.models.DownloadItem
@ -23,14 +25,13 @@ import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
import com.google.android.exoplayer2.source.MediaSource
import com.google.android.exoplayer2.source.MergingMediaSource
import com.google.android.exoplayer2.source.ProgressiveMediaSource
import com.google.android.exoplayer2.source.dash.DashMediaSource
import com.google.android.exoplayer2.source.hls.HlsMediaSource
import com.google.android.exoplayer2.ui.PlayerView
import com.google.android.exoplayer2.upstream.FileDataSource
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.card.MaterialCardView
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.slider.RangeSlider
import com.google.android.material.textfield.TextInputLayout
import kotlinx.coroutines.Dispatchers
@ -40,6 +41,7 @@ import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.*
import kotlin.properties.Delegates
class CutVideoBottomSheetDialog(private val item: DownloadItem, private val listener: VideoCutListener) : BottomSheetDialogFragment() {
@ -48,6 +50,20 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
private lateinit var infoUtil: InfoUtil
private lateinit var uiUtil: UiUtil
private lateinit var player: Player
private lateinit var cutSection : ConstraintLayout
private lateinit var progress : ProgressBar
private lateinit var rangeSlider : RangeSlider
private lateinit var fromTextInput : TextInputLayout
private lateinit var toTextInput : TextInputLayout
private lateinit var cancelBtn : Button
private lateinit var okBtn : Button
private lateinit var cutListSection : LinearLayout
private lateinit var newCutBtn : Button
private lateinit var chipGroup : ChipGroup
private var timeSeconds by Delegates.notNull<Int>()
override fun onCreate(savedInstanceState: Bundle?) {
@ -75,30 +91,26 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
val frame = view.findViewById<MaterialCardView>(R.id.frame_layout)
val videoView = view.findViewById<PlayerView>(R.id.video_view)
videoView.player = player
timeSeconds = convertStringToTimestamp(item.duration)
val progress = view.findViewById<ProgressBar>(R.id.progress)
val rangeSlider = view.findViewById<RangeSlider>(R.id.rangeSlider)
val fromTextInput = view.findViewById<TextInputLayout>(R.id.from_textinput)
val toTextInput = view.findViewById<TextInputLayout>(R.id.to_textinput)
//cut section
cutSection = view.findViewById(R.id.cut_section)
progress = view.findViewById(R.id.progress)
rangeSlider = view.findViewById(R.id.rangeSlider)
fromTextInput = view.findViewById(R.id.from_textinput)
toTextInput = view.findViewById(R.id.to_textinput)
cancelBtn = view.findViewById(R.id.cancelButton)
okBtn = view.findViewById(R.id.okButton)
initCutSection()
val timeSeconds = convertStringToTimestamp(item.duration)
//cut list section
cutListSection = view.findViewById(R.id.list_section)
newCutBtn = view.findViewById(R.id.new_cut)
chipGroup = view.findViewById(R.id.cut_list_chip_group)
initCutListSection()
if (item.downloadSections.isEmpty()){
fromTextInput.editText!!.setText("0:00")
toTextInput.editText!!.setText(item.duration)
}else{
val stamps = item.downloadSections.split("-")
fromTextInput.editText!!.setText(stamps[0])
toTextInput.editText!!.setText(stamps[1])
val startSeconds = convertStringToTimestamp(stamps[0])
val endSeconds = convertStringToTimestamp(stamps[1])
val startValue = (startSeconds.toFloat() / timeSeconds) * 100
val endValue = (endSeconds.toFloat() / timeSeconds) * 100
rangeSlider.setValues(startValue, endValue)
}
if (item.downloadSections.isBlank()) cutSection.visibility = View.VISIBLE
else cutListSection.visibility = View.VISIBLE
lifecycleScope.launch {
try {
@ -108,24 +120,23 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
if (url.isBlank()) throw Exception("No Streaming URL found!")
// val urls = url.split("\n")
// if (urls.size == 2){
// val audioSource: MediaSource =
// DefaultMediaSourceFactory(requireContext())
// .createMediaSource(fromUri(Uri.parse(urls[0])))
// val videoSource: MediaSource =
// DefaultMediaSourceFactory(requireContext())
// .createMediaSource(fromUri(Uri.parse(urls[1])))
// (player as ExoPlayer).setMediaSource(MergingMediaSource(videoSource, audioSource))
// }else{
// player.addMediaItem(fromUri(Uri.parse(urls[0])))
// }
player.addMediaItem(fromUri(Uri.parse(url)))
val urls = url.split("\n")
if (urls.size == 2){
val audioSource: MediaSource =
DefaultMediaSourceFactory(requireContext())
.createMediaSource(fromUri(Uri.parse(urls[0])))
val videoSource: MediaSource =
DefaultMediaSourceFactory(requireContext())
.createMediaSource(fromUri(Uri.parse(urls[1])))
(player as ExoPlayer).setMediaSource(MergingMediaSource(videoSource, audioSource))
}else{
player.addMediaItem(fromUri(Uri.parse(urls[0])))
}
progress.visibility = View.GONE
player.prepare()
player.seekTo((((rangeSlider.values[0].toInt() * timeSeconds) / 100) * 1000).toLong())
player.seekTo((((rangeSlider.valueFrom.toInt() * timeSeconds) / 100) * 1000).toLong())
player.play()
}catch (e: Exception){
progress.visibility = View.GONE
@ -133,12 +144,11 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
e.printStackTrace()
}
}
//poll video progress
lifecycleScope.launch {
videoProgress(player).collect {
val startTimestamp = (rangeSlider.values[0].toInt() * timeSeconds) / 100
val endTimestamp = (rangeSlider.values[1].toInt() * timeSeconds) / 100
val startTimestamp = (rangeSlider.valueFrom.toInt() * timeSeconds) / 100
val endTimestamp = (rangeSlider.valueTo.toInt() * timeSeconds) / 100
if (it >= endTimestamp){
player.seekTo((startTimestamp * 1000).toLong())
}
@ -153,6 +163,26 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
}
}
}
private fun initCutSection(){
if (item.downloadSections.isEmpty()){
fromTextInput.editText!!.setText("0:00")
toTextInput.editText!!.setText(item.duration)
}else{
val stamps = item.downloadSections.split("-")
fromTextInput.editText!!.setText(stamps[0])
toTextInput.editText!!.setText(stamps[1].replace(";", ""))
val startSeconds = convertStringToTimestamp(stamps[0])
val endSeconds = convertStringToTimestamp(stamps[1].replace(";", ""))
val startValue = (startSeconds.toFloat() / timeSeconds) * 100
val endValue = (endSeconds.toFloat() / timeSeconds) * 100
rangeSlider.setValues(startValue, endValue)
}
rangeSlider.addOnChangeListener { rangeSlider, value, fromUser ->
val values = rangeSlider.values
@ -165,11 +195,14 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
fromTextInput.editText!!.setText(startTimestampString)
toTextInput.editText!!.setText(endTimestampString)
okBtn.isEnabled = !(values[0] == 0F && values[1] == 100F)
try {
player.seekTo((startTimestamp * 1000).toLong())
player.play()
}catch (ignored: Exception) {}
listener.onChangeCut(startTimestampString, endTimestampString)
}
fromTextInput.editText!!.setOnKeyListener(object : View.OnKeyListener {
@ -178,8 +211,8 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
if ((event!!.action == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
val startTimestamp = (rangeSlider.values[0].toInt() * timeSeconds) / 100
val endTimestamp = (rangeSlider.values[1].toInt() * timeSeconds) / 100
val startTimestamp = (rangeSlider.valueFrom.toInt() * timeSeconds) / 100
val endTimestamp = (rangeSlider.valueTo.toInt() * timeSeconds) / 100
fromTextInput.editText!!.clearFocus()
val seconds = convertStringToTimestamp(fromTextInput.editText!!.text.toString())
@ -194,7 +227,7 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
return true
}
rangeSlider.setValues(startValue, rangeSlider.values[1])
rangeSlider.setValues(startValue, rangeSlider.valueTo)
val startValueTimeStampSeconds = (startValue.toInt() * timeSeconds) / 100
fromTextInput.editText!!.setText(infoUtil.formatIntegerDuration(startValueTimeStampSeconds, Locale.US))
@ -211,7 +244,7 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
if ((event!!.action == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
val endTimestamp = (rangeSlider.values[1].toInt() * timeSeconds) / 100
val endTimestamp = (rangeSlider.valueTo.toInt() * timeSeconds) / 100
toTextInput.editText!!.clearFocus()
val seconds = convertStringToTimestamp(toTextInput.editText!!.text.toString())
@ -221,12 +254,12 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
}
val endValue = (seconds.toFloat() / endTimestamp) * 100
if (endValue > 100 || endValue <= rangeSlider.values[0].toInt()){
if (endValue > 100 || endValue <= rangeSlider.valueFrom.toInt()){
toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endTimestamp, Locale.US))
return true
}
rangeSlider.setValues(rangeSlider.values[0], endValue)
rangeSlider.setValues(rangeSlider.valueFrom, endValue)
val endValueTimeStampSeconds = (endValue.toInt() * timeSeconds) / 100
toTextInput.editText!!.setText(infoUtil.formatIntegerDuration(endValueTimeStampSeconds, Locale.US))
@ -236,14 +269,82 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
}
})
val cancelBtn = view.findViewById<Button>(R.id.cancelButton)
cancelBtn.setOnClickListener {
listener.onCancelCut()
dismiss()
cutSection.visibility = View.GONE
cutListSection.visibility = View.VISIBLE
}
okBtn.isEnabled = false
okBtn.setOnClickListener {
val chip = createChip("${fromTextInput.editText!!.text}-${toTextInput.editText!!.text}")
listener.onChangeCut(chipGroup.children.map { c -> (c as Chip).text.toString() })
chip.performClick()
player.seekTo((((rangeSlider.valueFrom.toInt() * timeSeconds) / 100) * 1000).toLong())
player.play()
cutSection.visibility = View.GONE
cutListSection.visibility = View.VISIBLE
}
}
private fun videoProgress(player: Player?) = flow<Int> {
private fun initCutListSection() {
newCutBtn.setOnClickListener {
cutSection.visibility = View.VISIBLE
cutListSection.visibility = View.GONE
rangeSlider.setValues(0F, 100F)
player.seekTo(0)
}
if (item.downloadSections.isNotBlank()){
chipGroup.removeAllViews()
item.downloadSections.split(";").forEachIndexed { index, it ->
if (it.isBlank()) return
val startingValue = ((convertStringToTimestamp(it.split("-")[0]).toFloat() / timeSeconds) * 100).toInt()
val endingValue = ((convertStringToTimestamp(it.split("-")[1].replace(";", "")).toFloat() / timeSeconds) * 100).toInt()
createChip(it.replace(";", ""))
if (index == 0) rangeSlider.setValues(startingValue.toFloat(), endingValue.toFloat())
}
}
}
private fun createChip(timestamp: String) : Chip {
val startingValue = ((convertStringToTimestamp(timestamp.split("-")[0]).toFloat() / timeSeconds) * 100).toInt()
val endingValue = ((convertStringToTimestamp(timestamp.split("-")[1].replace(";", "")).toFloat() / timeSeconds) * 100).toInt()
val chip = layoutInflater.inflate(R.layout.filter_chip, chipGroup, false) as Chip
chip.text = timestamp
chip.isCheckedIconVisible = false
chipGroup.addView(chip)
listener.onChangeCut(chipGroup.children.map { c -> (c as Chip).text.toString() })
chip.setOnClickListener {
if (chip.isChecked) {
rangeSlider.setValues(startingValue.toFloat(), endingValue.toFloat())
}else {
player.seekTo(0)
player.pause()
}
}
chip.setOnLongClickListener {
val deleteDialog = MaterialAlertDialogBuilder(requireContext())
deleteDialog.setTitle(getString(R.string.you_are_going_to_delete) + " \"" + chip.text + "\"!")
deleteDialog.setNegativeButton(getString(R.string.cancel)) { dialogInterface: DialogInterface, _: Int -> dialogInterface.cancel() }
deleteDialog.setPositiveButton(getString(R.string.ok)) { _: DialogInterface?, _: Int ->
player.seekTo(0)
player.pause()
chipGroup.removeView(chip)
listener.onChangeCut(chipGroup.children.map { c -> (c as Chip).text.toString() })
}
deleteDialog.show()
true
}
return chip
}
private fun videoProgress(player: Player?) = flow {
while (true) {
emit((player!!.currentPosition / 1000).toInt())
delay(1000)
@ -285,6 +386,5 @@ class CutVideoBottomSheetDialog(private val item: DownloadItem, private val list
}
interface VideoCutListener{
fun onCancelCut()
fun onChangeCut(from: String, to: String)
fun onChangeCut(list: Sequence<String>)
}

View file

@ -247,26 +247,26 @@ class DownloadAudioFragment(private var resultItem: ResultItem, private var curr
}
val cut = view.findViewById<Chip>(R.id.cut)
cut.text = downloadItem.downloadSections
if (downloadItem.downloadSections.isNotBlank()) cut.text = downloadItem.downloadSections
val cutVideoListener = object : VideoCutListener {
override fun onCancelCut() {
downloadItem.downloadSections = ""
cut.text = ""
override fun onChangeCut(list: Sequence<String>) {
if (list.count() == 0){
downloadItem.downloadSections = ""
cut.text = ""
splitByChapters.isEnabled = true
splitByChapters.isChecked = downloadItem.audioPreferences.splitByChapters
}
splitByChapters.isEnabled = true
splitByChapters.isChecked = downloadItem.audioPreferences.splitByChapters
}else{
var value = ""
list.forEach {
value += "$it;"
}
downloadItem.downloadSections = value
cut.text = value.dropLast(1)
override fun onChangeCut(from: String, to: String) {
if (from == "0:00" && to == downloadItem.duration){
return
splitByChapters.isEnabled = false
splitByChapters.isChecked = false
}
val value = "${from}-${to}"
downloadItem.downloadSections = value
cut.text = value
splitByChapters.isEnabled = false
splitByChapters.isChecked = false
}
}
cut.setOnClickListener {

View file

@ -266,33 +266,34 @@ class DownloadVideoFragment(private val resultItem: ResultItem, private var curr
}
val cut = view.findViewById<Chip>(R.id.cut)
cut.text = downloadItem.downloadSections
if (downloadItem.downloadSections.isNotBlank()) cut.text = downloadItem.downloadSections
val cutVideoListener = object : VideoCutListener {
override fun onCancelCut() {
downloadItem.downloadSections = ""
cut.text = ""
splitByChapters.isEnabled = true
splitByChapters.isChecked = downloadItem.videoPreferences.splitByChapters
if (splitByChapters.isChecked){
addChapters.isEnabled = false
addChapters.isChecked = false
override fun onChangeCut(list: Sequence<String>) {
if (list.count() == 0){
downloadItem.downloadSections = ""
cut.text = getString(R.string.cut)
splitByChapters.isEnabled = true
splitByChapters.isChecked = downloadItem.videoPreferences.splitByChapters
if (splitByChapters.isChecked){
addChapters.isEnabled = false
addChapters.isChecked = false
}else{
addChapters.isEnabled = true
}
}else{
var value = ""
list.forEach {
value += "$it;"
}
downloadItem.downloadSections = value
cut.text = value.dropLast(1)
splitByChapters.isEnabled = false
splitByChapters.isChecked = false
addChapters.isEnabled = true
}
}
override fun onChangeCut(from: String, to: String) {
if (from == "0:00" && to == downloadItem.duration){
return
}
val value = "${from}-${to}"
downloadItem.downloadSections = value
cut.text = value
splitByChapters.isEnabled = false
splitByChapters.isChecked = false
addChapters.isEnabled = true
}
}

View file

@ -30,7 +30,6 @@ import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import com.yausername.youtubedl_android.YoutubeDL
import io.reactivex.disposables.CompositeDisposable
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -102,6 +101,7 @@ class TerminalActivity : AppCompatActivity() {
.observe(this){ list ->
list.forEach {work ->
if (work.state == WorkInfo.State.SUCCEEDED || work.state == WorkInfo.State.FAILED || work.state == WorkInfo.State.CANCELLED) {
input!!.setText("yt-dlp ")
input!!.visibility = View.VISIBLE
input!!.requestFocus()
hideCancelFab()
@ -233,12 +233,10 @@ class TerminalActivity : AppCompatActivity() {
private fun cancelDownload() {
YoutubeDL.getInstance().destroyProcessById(downloadID.toString())
WorkManager.getInstance(this).cancelUniqueWork(downloadID.toString())
notificationUtil.cancelDownloadNotification(downloadID.toInt())
notificationUtil.cancelDownloadNotification(downloadID)
}
companion object {
private const val TAG = "CustomCommandActivity"
private val compositeDisposable = CompositeDisposable()
}
}

View file

@ -630,13 +630,23 @@ class InfoUtil(context: Context) {
}
fun getStreamingUrl(url: String) : String {
return try {
try {
val request = YoutubeDLRequest(url)
request.addOption("-f", "best")
val youtubeDlInfo = YoutubeDL.getInstance().getInfo(request)
youtubeDlInfo.url ?: ""
request.addOption("-j")
request.addOption("--skip-download")
request.addOption("-R", "1")
request.addOption("--socket-timeout", "5")
val youtubeDLResponse = YoutubeDL.getInstance().execute(request)
val results: Array<String?> = try {
val lineSeparator = System.getProperty("line.separator")
youtubeDLResponse.out.split(lineSeparator!!).toTypedArray()
} catch (e: Exception) {
arrayOf(youtubeDLResponse.out)
}
val jsonObject = JSONObject(results[0]!!)
return jsonObject.getString("urls")
} catch (e: Exception) {
""
return ""
}
}

View file

@ -116,7 +116,11 @@ class DownloadWorker(
if (downloadItem.customFileNameTemplate.isBlank()) downloadItem.customFileNameTemplate = "%(uploader)s - %(title)s"
if (downloadItem.downloadSections.isNotBlank()){
request.addOption("--download-sections", "*${downloadItem.downloadSections}")
downloadItem.downloadSections.split(";").forEach {
if (it.isBlank()) return@forEach
request.addOption("--download-sections", "*$it")
}
downloadItem.customFileNameTemplate += "%(autonumber)s"
}
}

View file

@ -10,24 +10,20 @@
android:id="@+id/frame_layout"
android:layout_width="0dp"
android:layout_height="0dp"
app:cardCornerRadius="0dp"
app:layout_constraintDimensionRatio="H,16:9"
app:layout_constraintStart_toStartOf="parent"
android:layout_margin="10dp"
app:cardCornerRadius="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" >
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/video_view"
app:resize_mode="fixed_height"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:use_controller="false"
app:layout_constraintTop_toTopOf="parent"
app:useDefaultControls="true" >
</com.google.android.exoplayer2.ui.PlayerView>
app:resize_mode="fixed_height"
app:useDefaultControls="true"
app:use_controller="false" />
</com.google.android.material.card.MaterialCardView>
@ -35,6 +31,7 @@
android:id="@+id/progress"
android:layout_width="wrap_content"
android:indeterminate="true"
android:translationZ="10dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/frame_layout"
app:layout_constraintEnd_toEndOf="parent"
@ -42,86 +39,172 @@
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.slider.RangeSlider
android:id="@+id/rangeSlider"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cut_section"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:valueFrom="00.0"
app:labelBehavior="gone"
android:valueTo="100.0"
app:layout_constraintTop_toBottomOf="@+id/frame_layout"
app:values="@array/initial_slider_values"
tools:layout_editor_absoluteX="20dp" />
app:layout_constraintTop_toBottomOf="@+id/frame_layout">
<com.google.android.material.slider.RangeSlider
android:id="@+id/rangeSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="10dp"
android:valueFrom="00.0"
android:valueTo="100.0"
app:labelBehavior="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:thumbRadius="0dp"
app:trackHeight="20dp"
app:values="@array/initial_slider_values" />
<LinearLayout
android:id="@+id/linearLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.533"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rangeSlider"
app:layout_constraintVertical_bias="0.0">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/from_textinput"
style="@style/Widget.Material3.TextInputLayout.FilledBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/start">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/colon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingHorizontal="10dp"
android:text=":"
android:textSize="20sp"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/to_textinput"
style="@style/Widget.Material3.TextInputLayout.FilledBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/colon">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginHorizontal="20dp"
app:layout_constraintTop_toBottomOf="@+id/linearLayout5"
app:layout_constraintVertical_bias="1.0"
>
<Button
android:id="@+id/cancelButton"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content"
android:layout_marginEnd="10dp"
android:layout_height="wrap_content"
android:text="@string/cancel"
app:icon="@drawable/ic_baseline_delete_outline_24"/>
<Button
android:id="@+id/okButton"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cut"
app:icon="@drawable/ic_check"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="0dp"
android:id="@+id/list_section"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/cancelButton"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rangeSlider">
android:paddingHorizontal="20dp"
android:paddingVertical="10dp"
app:layout_constraintTop_toBottomOf="@+id/frame_layout"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/from_textinput"
style="@style/Widget.Material3.TextInputLayout.FilledBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/start">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
<TextView
android:id="@+id/bottom_sheet_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/colon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingHorizontal="10dp"
android:text=":"
android:textSize="20sp"
android:textStyle="bold" />
android:layout_marginTop="4dp"
android:maxLines="2"
android:singleLine="false"
android:text="@string/cut"
android:textSize="25sp"
app:layout_constraintEnd_toStartOf="@+id/new_cut"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/to_textinput"
style="@style/Widget.Material3.TextInputLayout.FilledBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/colon">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
<Button
android:id="@+id/new_cut"
style="@style/Widget.Material3.Button.ElevatedButton.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="text" />
android:autoLink="all"
android:text="@string/new_cut"
app:icon="@drawable/ic_cut"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.chip.ChipGroup
android:id="@+id/cut_list_chip_group"
android:paddingTop="10dp"
app:singleSelection="true"
app:selectionRequired="false"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</com.google.android.material.chip.ChipGroup>
</LinearLayout>
<Button
android:id="@+id/cancelButton"
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20dp"
android:layout_marginEnd="16dp"
android:text="@string/cancel"
app:icon="@drawable/ic_cancel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rangeSlider"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/website_chip"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -193,6 +193,7 @@
android:gravity="center"
app:chipIconVisible="true"
app:chipIcon="@drawable/ic_cut"
android:text="@string/cut"
android:minWidth="30dp"
app:cornerRadius="10dp"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -202,6 +202,7 @@
app:chipIconVisible="true"
app:chipIcon="@drawable/ic_cut"
android:minWidth="30dp"
android:text="@string/cut"
app:cornerRadius="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"

View file

@ -190,4 +190,6 @@
<string name="start">Start</string>
<string name="update_formats_summary">Automatically search for missing formats when clicking the format card</string>
<string name="ignore_battery_optimization">Ignore Battery Optimization</string>
<string name="cut">Cut</string>
<string name="new_cut">New Cut</string>
</resources>