Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change DeArrow title submission default #5909

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.widget.CompoundButton

Check failure on line 6 in app/src/main/java/com/github/libretube/ui/dialogs/SubmitDeArrowDialog.kt

View workflow job for this annotation

GitHub Actions / Check Code Quality

[ktlint] reported by reviewdog 🐶 Unused import Raw Output: app/src/main/java/com/github/libretube/ui/dialogs/SubmitDeArrowDialog.kt:6:1: error: Unused import (standard:no-unused-imports)
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import com.github.libretube.R
Expand Down Expand Up @@ -41,13 +42,6 @@
binding.dearrowTitle.typingEnabled = true
binding.thumbnailTime.setText(currentPosition.toString())

binding.titleCheckbox.setOnCheckedChangeListener { _, isChecked ->
binding.dearrowTitle.isEnabled = isChecked
}
binding.thumbnailTimeCheckbox.setOnCheckedChangeListener { _, isChecked ->
binding.thumbnailTimeInputLayout.isEnabled = isChecked
}

lifecycleScope.launch { fetchDeArrowData() }

return MaterialAlertDialogBuilder(requireContext())
Expand All @@ -56,7 +50,19 @@
.setNegativeButton(R.string.cancel, null)
.show()
.apply {
getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener {
val positiveButton = getButton(DialogInterface.BUTTON_POSITIVE)
positiveButton.isEnabled = false

binding.titleCheckbox.setOnCheckedChangeListener { _, isChecked ->
binding.dearrowTitle.isEnabled = isChecked
positiveButton.isEnabled = isChecked || binding.thumbnailTimeCheckbox.isChecked
}
binding.thumbnailTimeCheckbox.setOnCheckedChangeListener { _, isChecked ->
binding.thumbnailTimeInputLayout.isEnabled = isChecked
positiveButton.isEnabled = binding.titleCheckbox.isChecked || isChecked
}

positiveButton.setOnClickListener {
lifecycleScope.launch { submitDeArrow() }
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_submit_dearrow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:checked="true"
android:checked="false"
android:text="@string/title" />

<com.google.android.material.checkbox.MaterialCheckBox
Expand All @@ -47,13 +47,13 @@
android:id="@+id/thumbnail_time_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:hint="@string/thumbnail_time">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/thumbnail_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:inputType="numberDecimal" />
</com.google.android.material.textfield.TextInputLayout>

Expand Down
Loading