From 801f97353c59e2a738dcd54be8aeace1374097e2 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 15 Jul 2024 13:58:18 +0200 Subject: [PATCH] feat: button to swap sponsorblock segment start and end time --- .../libretube/ui/dialogs/SubmitSegmentDialog.kt | 6 ++++++ app/src/main/res/drawable/ic_arrow_left_right.xml | 13 +++++++++++++ app/src/main/res/layout/dialog_submit_segment.xml | 12 +++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_arrow_left_right.xml diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt index 43b2e28e8..bfebc5239 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/SubmitSegmentDialog.kt @@ -57,6 +57,12 @@ class SubmitSegmentDialog : DialogFragment() { binding.segmentCategory.items = resources.getStringArray(R.array.sponsorBlockSegmentNames).toList() + binding.swapTimestamps.setOnClickListener { + val temp = binding.startTime.text + binding.startTime.text = binding.endTime.text + binding.endTime.text = temp + } + lifecycleScope.launch(Dispatchers.IO) { fetchSegments() } diff --git a/app/src/main/res/drawable/ic_arrow_left_right.xml b/app/src/main/res/drawable/ic_arrow_left_right.xml new file mode 100644 index 000000000..3d9bff56d --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_left_right.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/app/src/main/res/layout/dialog_submit_segment.xml b/app/src/main/res/layout/dialog_submit_segment.xml index bc762eeda..9e2b8fb2e 100644 --- a/app/src/main/res/layout/dialog_submit_segment.xml +++ b/app/src/main/res/layout/dialog_submit_segment.xml @@ -39,10 +39,20 @@ android:inputType="time" /> + +