|
22 | 22 | import android.view.MenuItem; |
23 | 23 | import android.view.View; |
24 | 24 | import android.view.ViewGroup; |
| 25 | +import android.widget.LinearLayout; |
25 | 26 | import android.widget.Toast; |
26 | 27 |
|
27 | 28 | import androidx.annotation.NonNull; |
|
55 | 56 | import org.schabi.newpipe.local.history.HistoryRecordManager; |
56 | 57 | import org.schabi.newpipe.player.playqueue.PlayQueue; |
57 | 58 | import org.schabi.newpipe.player.playqueue.SinglePlayQueue; |
| 59 | +import org.schabi.newpipe.util.DeviceUtils; |
58 | 60 | import org.schabi.newpipe.util.Localization; |
59 | 61 | import org.schabi.newpipe.util.NavigationHelper; |
60 | 62 | import org.schabi.newpipe.util.OnClickGesture; |
@@ -366,16 +368,29 @@ public boolean onOptionsItemSelected(final MenuItem item) { |
366 | 368 | createRenameDialog(); |
367 | 369 | } else if (item.getItemId() == R.id.menu_item_remove_watched) { |
368 | 370 | if (!isRewritingPlaylist) { |
| 371 | + final android.widget.CheckBox removePartiallyWatchedCheckbox = |
| 372 | + new android.widget.CheckBox(requireContext()); |
| 373 | + removePartiallyWatchedCheckbox.setText( |
| 374 | + R.string.remove_watched_popup_yes_and_partially_watched_videos); |
| 375 | + |
| 376 | + // Wrap the checkbox in a container with dialog-like horizontal padding |
| 377 | + // so it aligns with the dialog title/message on the start side. |
| 378 | + final LinearLayout checkboxContainer = new LinearLayout(requireContext()); |
| 379 | + checkboxContainer.setOrientation(LinearLayout.VERTICAL); |
| 380 | + final int padding = DeviceUtils.dpToPx(20, requireContext()); |
| 381 | + checkboxContainer.setPadding(padding, padding, padding, 0); |
| 382 | + checkboxContainer.addView(removePartiallyWatchedCheckbox, |
| 383 | + new android.widget.LinearLayout.LayoutParams( |
| 384 | + ViewGroup.LayoutParams.MATCH_PARENT, |
| 385 | + ViewGroup.LayoutParams.WRAP_CONTENT)); |
| 386 | + |
369 | 387 | new AlertDialog.Builder(requireContext()) |
370 | 388 | .setMessage(R.string.remove_watched_popup_warning) |
371 | 389 | .setTitle(R.string.remove_watched_popup_title) |
372 | | - .setPositiveButton(R.string.ok, (d, id) -> |
373 | | - removeWatchedStreams(false)) |
374 | | - .setNeutralButton( |
375 | | - R.string.remove_watched_popup_yes_and_partially_watched_videos, |
376 | | - (d, id) -> removeWatchedStreams(true)) |
377 | | - .setNegativeButton(R.string.cancel, |
378 | | - (d, id) -> d.cancel()) |
| 390 | + .setView(checkboxContainer) |
| 391 | + .setPositiveButton(R.string.yes, (d, id) -> |
| 392 | + removeWatchedStreams(removePartiallyWatchedCheckbox.isChecked())) |
| 393 | + .setNegativeButton(R.string.cancel, (d, id) -> d.cancel()) |
379 | 394 | .show(); |
380 | 395 | } |
381 | 396 | } else if (item.getItemId() == R.id.menu_item_remove_duplicates) { |
|
0 commit comments