Move queue lock feature to the overflow menu
This commit is contained in:
parent
db39186760
commit
61e86151c6
|
@ -15,7 +15,6 @@ import org.junit.runner.RunWith;
|
||||||
import static androidx.test.espresso.Espresso.onView;
|
import static androidx.test.espresso.Espresso.onView;
|
||||||
import static androidx.test.espresso.action.ViewActions.click;
|
import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
|
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 androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
import static de.test.antennapod.NthMatcher.first;
|
import static de.test.antennapod.NthMatcher.first;
|
||||||
import static org.hamcrest.CoreMatchers.allOf;
|
import static org.hamcrest.CoreMatchers.allOf;
|
||||||
|
@ -40,9 +39,11 @@ public class QueueFragmentTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLockEmptyQueue() {
|
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(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
|
@Test
|
||||||
|
|
|
@ -247,16 +247,8 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi
|
||||||
() -> DownloadService.isRunning && DownloadRequester.getInstance().isDownloadingFeeds();
|
() -> DownloadService.isRunning && DownloadRequester.getInstance().isDownloadingFeeds();
|
||||||
|
|
||||||
private void refreshToolbarState() {
|
private void refreshToolbarState() {
|
||||||
final MenuItem queueLock = toolbar.getMenu().findItem(R.id.queue_lock);
|
toolbar.getMenu().findItem(R.id.queue_lock).setChecked(UserPreferences.isQueueLocked());
|
||||||
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);
|
|
||||||
}
|
|
||||||
boolean keepSorted = UserPreferences.isQueueKeepSorted();
|
boolean keepSorted = UserPreferences.isQueueKeepSorted();
|
||||||
|
|
||||||
toolbar.getMenu().findItem(R.id.queue_sort_random).setVisible(!keepSorted);
|
toolbar.getMenu().findItem(R.id.queue_sort_random).setVisible(!keepSorted);
|
||||||
toolbar.getMenu().findItem(R.id.queue_keep_sorted).setChecked(keepSorted);
|
toolbar.getMenu().findItem(R.id.queue_keep_sorted).setChecked(keepSorted);
|
||||||
isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(toolbar.getMenu(),
|
isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(toolbar.getMenu(),
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/queue_lock"
|
android:id="@+id/action_search"
|
||||||
android:title=""
|
android:icon="@drawable/ic_search"
|
||||||
android:menuCategory="container"
|
custom:showAsAction="ifRoom"
|
||||||
custom:showAsAction="always" />
|
android:title="@string/search_label"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/refresh_item"
|
android:id="@+id/refresh_item"
|
||||||
|
@ -17,10 +16,10 @@
|
||||||
android:icon="@drawable/ic_refresh"/>
|
android:icon="@drawable/ic_refresh"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_search"
|
android:id="@+id/queue_lock"
|
||||||
android:icon="@drawable/ic_search"
|
android:title="@string/lock_queue"
|
||||||
custom:showAsAction="ifRoom"
|
android:menuCategory="container"
|
||||||
android:title="@string/search_label"/>
|
android:checkable="true" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/queue_sort"
|
android:id="@+id/queue_sort"
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<vector android:height="24dp"
|
|
||||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<path android:fillColor="?attr/action_icon_color" android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2L8.9,8L8.9,6zM18,20L6,20L6,10h12v10z"/>
|
|
||||||
</vector>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<vector android:height="24dp"
|
|
||||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
|
||||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<path android:fillColor="?attr/action_icon_color" android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/>
|
|
||||||
</vector>
|
|
|
@ -304,7 +304,6 @@
|
||||||
|
|
||||||
<!-- Queue operations -->
|
<!-- Queue operations -->
|
||||||
<string name="lock_queue">Lock Queue</string>
|
<string name="lock_queue">Lock Queue</string>
|
||||||
<string name="unlock_queue">Unlock Queue</string>
|
|
||||||
<string name="queue_locked">Queue locked</string>
|
<string name="queue_locked">Queue locked</string>
|
||||||
<string name="queue_unlocked">Queue unlocked</string>
|
<string name="queue_unlocked">Queue unlocked</string>
|
||||||
<string name="queue_lock_warning">If you lock the queue, you can no longer swipe or reorder episodes.</string>
|
<string name="queue_lock_warning">If you lock the queue, you can no longer swipe or reorder episodes.</string>
|
||||||
|
|
Loading…
Reference in New Issue