Skip to content

Implement Duplication Warning Dialog

tda1009 requested to merge tda1009/vlc-android:duplication_warning_dialog into master

This MR is an attempt to solve issue #1363 (closed)

Desired Behaviors

When the user adds item(s) to a playlist, there are several possible scenarios:

  1. If the user wants to add 1 item:
    1.a. If it does not exist in the playlist yet, VLC will simply add this item to the playlist
    1.b. If it already exists, VLC should show a warning dialog

  2. If the user wants to add N items (N > 1):
    2.a. If all N items are new, VLC will add these items to the playlist
    2.b. If all N items already exist, VLC should show a warning dialog
    2.c. If only K items exist (1 <= K < N), VLC should show a warning dialog

In 1.b and 2.b, the user can either add or cancel, hence we show this dialog:

dialog_two_options

In 2.c, however, we should provide the user with 3 options:

dialog_three_options

When the user selects "ADD NEW ONLY", only new items are added, duplicate ones are ignored. This is the default option.
When the user selects "ADD ALL", all items are added, duplicate or not.

Implementation

In this MR I added a new dialog, DuplicationWarningDialog. This dialog gets the user's option, and then delegates processing that option back to SavePlaylistDialog.

I also made some minor modifications to the existing code of SavePlaylistDialog to make it compatible with the new code added in this MR.

Testing

To verify that this MR works, I have performed several tests, on the Emulator and on a physical phone.

(In these tests, initially the test playlist has 2 items.)

The tests are:

Test 1: add 1 non-duplicate item
Test 2: add 1 duplicate item
Test 3: add 2 non-duplicate items
Test 4: add 2 items, in which 1 is duplicate, and we choose "add new only"
Test 5: add 2 items, in which 1 is duplicate, and we choose "add all"
Test 6: add 2 duplicate items
Test 7: add 3 items, in which 2 are duplicate, and we choose "add new only"
Test 8: add 3 items, in which 2 are duplicate, and we choose "add all"
Test 9: perform 2 additions consecutively:
      add 1 duplicate item
      add 2 non-duplicate items
Test 10: rotate screen while adding:
      add 3 items, in which 2 are duplicate
      rotate screen before choosing "add all"

Please review this MR and provide feedbacks if need be. Thanks!

Edited by tda1009

Merge request reports

Loading