Skip to content

Commit

Permalink
feat(YouTube - Seekbar components): Enhance color picker responsivene…
Browse files Browse the repository at this point in the history
…ss and usability
  • Loading branch information
anddea committed Feb 3, 2025
1 parent 65065de commit 992fd92
Show file tree
Hide file tree
Showing 3 changed files with 314 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,23 @@ private void showColorPickerDialog(Context context) {
View dialogView = LayoutInflater.from(context).inflate(getLayoutIdentifier("revanced_color_picker"), layout);
// Get the CustomColorPickerView from the inflated layout.
CustomColorPickerView colorPickerView = dialogView.findViewById(ResourceUtils.getIdIdentifier("color_picker_view"));
// Set the initial color of the color picker.
colorPickerView.setColor(initialColor);
// Set the initial color of the color picker. Also provide the original color for the preview.
colorPickerView.setInitialColor(initialColor);

// Create an AlertDialog with the color picker view.
AlertDialog dialog = new AlertDialog.Builder(context)
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setView(dialogView)
.setPositiveButton(android.R.string.ok, null) // Listener will be set later to prevent immediate closing.
.setNegativeButton(android.R.string.cancel, null) // Listener will be set later.
.create();
.setPositiveButton(android.R.string.ok, null) // Listener will be set later.
.setNegativeButton(android.R.string.cancel, null); // Listener will be set later.

// Apply the dynamic theme for the dialog.
Utils.setEditTextDialogTheme(builder);

AlertDialog dialog = builder.create();

// Prevent the dialog from closing when touched outside.
dialog.setCanceledOnTouchOutside(false);

// Set an OnShowListener for the dialog to configure button behavior.
dialog.setOnShowListener(d -> {
// Set a listener for color changes in the color picker view.
colorPickerView.setOnColorChangedListener(color -> {
Expand Down
Loading

0 comments on commit 992fd92

Please sign in to comment.