Sharvaniharan has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405359 )
Change subject: Create option to Delete Lists and multiple Test article lists ...................................................................... Create option to Delete Lists and multiple Test article lists - Option created to delete the already created test reading lists : -option provided to state how many lists are to be deleted -logic handles existing lists number >, < and =number of lists that exist - Option to create many test lists with articles, Test reading list, Test reading list1, so on with 'n' articles Bug: T185343 Change-Id: I9b72c5ad23dba877e0bff8e146b83c5565fa26fc --- M app/src/main/java/org/wikipedia/settings/DeveloperSettingsPreferenceLoader.java M app/src/main/res/values/dev_settings_strings.xml M app/src/main/res/values/preference_keys.xml M app/src/main/res/xml/developer_preferences.xml 4 files changed, 32 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/59/405359/1 diff --git a/app/src/main/java/org/wikipedia/settings/DeveloperSettingsPreferenceLoader.java b/app/src/main/java/org/wikipedia/settings/DeveloperSettingsPreferenceLoader.java index 97283b7..3b393ee 100644 --- a/app/src/main/java/org/wikipedia/settings/DeveloperSettingsPreferenceLoader.java +++ b/app/src/main/java/org/wikipedia/settings/DeveloperSettingsPreferenceLoader.java @@ -102,8 +102,15 @@ findPreference(R.string.preference_key_add_articles) .setOnPreferenceChangeListener((preference, newValue) -> { + int index = -1; if (!newValue.toString().trim().equals("") && !newValue.toString().trim().equals("0")) { - createTestReadingList("Test reading list", Integer.valueOf(newValue.toString().trim())); + List<ReadingList> lists = ReadingListDbHelper.instance().getAllListsWithoutContents(); + for (ReadingList list : lists) { + if (list.title().contains("Test reading list")) { + index = (list.title().substring(17).isEmpty()) ? 0 : (Integer.valueOf(list.title().substring(17)) > index ? Integer.valueOf(list.title().substring(17)) : index); + } + } + createTestReadingList(index == -1 ? "Test reading list" : "Test reading list" + (index + 1), Integer.valueOf(newValue.toString().trim())); } return true; }); @@ -119,6 +126,22 @@ } return true; }); + + findPreference(R.string.preference_key_delete_reading_lists) + .setOnPreferenceChangeListener((preference, newValue) -> { + if (newValue.toString().trim().equals("") || newValue.toString().trim().equals("0")) { + return true; + } + int numOfLists = Integer.valueOf(newValue.toString().trim()); + List<ReadingList> lists = ReadingListDbHelper.instance().getAllLists(); + for (ReadingList list : lists) { + if (list.title().contains("Reading list") && numOfLists > 0) { + ReadingListDbHelper.instance().deleteList(list); + numOfLists--; + } + } + return true; + }); } private void setUpRestBaseCheckboxes() { diff --git a/app/src/main/res/values/dev_settings_strings.xml b/app/src/main/res/values/dev_settings_strings.xml index 25c377f..8c01734 100644 --- a/app/src/main/res/values/dev_settings_strings.xml +++ b/app/src/main/res/values/dev_settings_strings.xml @@ -26,6 +26,7 @@ <string name="preferences_developer_reading_list_category">Reading Lists</string> <string name="preferences_developer_add_articles">Add articles</string> <string name="preferences_developer_add_lists">Add reading lists</string> + <string name="preferences_developer_delete_lists">Delete reading lists</string> <string name="preferences_developer_summary_configure_articles">Type the number of articles</string> <string name="preferences_developer_summary_configure_reading_lists">Type the number of lists</string> diff --git a/app/src/main/res/values/preference_keys.xml b/app/src/main/res/values/preference_keys.xml index 7880742..ba00e16 100644 --- a/app/src/main/res/values/preference_keys.xml +++ b/app/src/main/res/values/preference_keys.xml @@ -71,6 +71,7 @@ <string name="preference_key_feed_customize_onboarding_card_enabled">feedCustomizeOnboardingCardEnabled</string> <string name="preference_key_add_articles">addArticles</string> <string name="preference_key_add_reading_lists">addReadingLists</string> + <string name="preference_key_delete_reading_lists">deleteReadingLists</string> <string name="preference_key_reading_lists_last_sync_time">readingListsLastSyncTime</string> <string name="preference_key_reading_lists_deleted_ids">readingListsDeletedIds</string> <string name="preference_key_reading_list_pages_deleted_ids">readingListPagesDeletedIds</string> diff --git a/app/src/main/res/xml/developer_preferences.xml b/app/src/main/res/xml/developer_preferences.xml index 8248b78..753e64d 100644 --- a/app/src/main/res/xml/developer_preferences.xml +++ b/app/src/main/res/xml/developer_preferences.xml @@ -213,6 +213,12 @@ android:key="@string/preference_key_add_reading_lists" android:title="@string/preferences_developer_add_lists" /> + <org.wikipedia.settings.EditTextAutoSummarizePreference + style="@style/EditTextAutoSummarizePreference" + android:dialogMessage="@string/preferences_developer_summary_configure_reading_lists" + android:key="@string/preference_key_delete_reading_lists" + android:title="@string/preferences_developer_delete_lists" /> + </PreferenceCategory> <PreferenceCategory -- To view, visit https://gerrit.wikimedia.org/r/405359 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9b72c5ad23dba877e0bff8e146b83c5565fa26fc Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Sharvaniharan <sha...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits