diff options
author | ByteHamster <info@bytehamster.com> | 2021-08-20 20:34:33 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-08-22 10:56:41 +0200 |
commit | 61e86151c686bda0ce26fdccc6c6afa4f070ee40 (patch) | |
tree | 3c05b5bc1e5b262d9f0a9cc7641d2685d27b4450 /app | |
parent | db391867608fa37f6568eca02678b3b376e52fa8 (diff) | |
download | AntennaPod-61e86151c686bda0ce26fdccc6c6afa4f070ee40.zip |
Move queue lock feature to the overflow menu
Diffstat (limited to 'app')
3 files changed, 13 insertions, 21 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java b/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java index 5b291752d..460dfdb3e 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/QueueFragmentTest.java @@ -15,7 +15,6 @@ import org.junit.runner.RunWith; import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.matcher.ViewMatchers.withClassName; -import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static de.test.antennapod.NthMatcher.first; import static org.hamcrest.CoreMatchers.allOf; @@ -40,9 +39,11 @@ public class QueueFragmentTest { @Test public void testLockEmptyQueue() { - onView(withContentDescription(R.string.lock_queue)).perform(click()); + onView(first(EspressoTestUtils.actionBarOverflow())).perform(click()); + onView(withText(R.string.lock_queue)).perform(click()); onView(allOf(withClassName(endsWith("Button")), withText(R.string.lock_queue))).perform(click()); - onView(withContentDescription(R.string.unlock_queue)).perform(click()); + onView(first(EspressoTestUtils.actionBarOverflow())).perform(click()); + onView(withText(R.string.lock_queue)).perform(click()); } @Test diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index ed99cb2dd..c4bef220e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -247,16 +247,8 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi () -> DownloadService.isRunning && DownloadRequester.getInstance().isDownloadingFeeds(); private void refreshToolbarState() { - final MenuItem queueLock = toolbar.getMenu().findItem(R.id.queue_lock); - if (UserPreferences.isQueueLocked()) { - queueLock.setTitle(de.danoeh.antennapod.R.string.unlock_queue); - queueLock.setIcon(R.drawable.ic_lock_open); - } else { - queueLock.setTitle(de.danoeh.antennapod.R.string.lock_queue); - queueLock.setIcon(R.drawable.ic_lock_closed); - } + toolbar.getMenu().findItem(R.id.queue_lock).setChecked(UserPreferences.isQueueLocked()); boolean keepSorted = UserPreferences.isQueueKeepSorted(); - toolbar.getMenu().findItem(R.id.queue_sort_random).setVisible(!keepSorted); toolbar.getMenu().findItem(R.id.queue_keep_sorted).setChecked(keepSorted); isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(toolbar.getMenu(), diff --git a/app/src/main/res/menu/queue.xml b/app/src/main/res/menu/queue.xml index 2d341d8e4..c1c2d982c 100644 --- a/app/src/main/res/menu/queue.xml +++ b/app/src/main/res/menu/queue.xml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> - <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto"> <item - android:id="@+id/queue_lock" - android:title="" - android:menuCategory="container" - custom:showAsAction="always" /> + android:id="@+id/action_search" + android:icon="@drawable/ic_search" + custom:showAsAction="ifRoom" + android:title="@string/search_label"/> <item android:id="@+id/refresh_item" @@ -17,10 +16,10 @@ android:icon="@drawable/ic_refresh"/> <item - android:id="@+id/action_search" - android:icon="@drawable/ic_search" - custom:showAsAction="ifRoom" - android:title="@string/search_label"/> + android:id="@+id/queue_lock" + android:title="@string/lock_queue" + android:menuCategory="container" + android:checkable="true" /> <item android:id="@+id/queue_sort" |