code style fixes - naming, indentation, etc.
This commit is contained in:
parent
418d4fa4d4
commit
69c0022472
|
@ -97,11 +97,11 @@
|
|||
android:summary="@string/pref_queueAddToFront_sum"
|
||||
android:title="@string/pref_queueAddToFront_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:enabled="false"
|
||||
android:key="prefQueueKeepInProgressAtFront"
|
||||
android:summary="@string/pref_queueKeepInProgressAtFront_sum"
|
||||
android:title="@string/pref_queueKeepInProgressAtFront_title"/>
|
||||
android:defaultValue="false"
|
||||
android:enabled="false"
|
||||
android:key="prefQueueKeepInProgressAtFront"
|
||||
android:summary="@string/pref_queueKeepInProgressAtFront_sum"
|
||||
android:title="@string/pref_queueKeepInProgressAtFront_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
|
|
|
@ -38,8 +38,8 @@ class ItemEnqueuePositionCalculator {
|
|||
}
|
||||
}
|
||||
|
||||
private final @NonNull
|
||||
Options options;
|
||||
@NonNull
|
||||
private final Options options;
|
||||
|
||||
@VisibleForTesting
|
||||
DownloadStateProvider downloadStateProvider = DownloadRequester.getInstance();
|
||||
|
@ -66,18 +66,18 @@ class ItemEnqueuePositionCalculator {
|
|||
curQueue.get(0).getMedia() != null &&
|
||||
curQueue.get(0).getMedia().isInProgress()) {
|
||||
// leave the front in progress item at the front
|
||||
return getPositionOf1stNonDownloadingItem(positionAmongToAdd + 1, curQueue);
|
||||
return getPositionOfFirstNonDownloadingItem(positionAmongToAdd + 1, curQueue);
|
||||
} else { // typical case
|
||||
// return NOT 0, so that when a list of items are inserted, the items inserted
|
||||
// keep the same order. Returning 0 will reverse the order
|
||||
return getPositionOf1stNonDownloadingItem(positionAmongToAdd, curQueue);
|
||||
return getPositionOfFirstNonDownloadingItem(positionAmongToAdd, curQueue);
|
||||
}
|
||||
} else {
|
||||
return curQueue.size();
|
||||
}
|
||||
}
|
||||
|
||||
private int getPositionOf1stNonDownloadingItem(int startPosition, List<FeedItem> curQueue) {
|
||||
private int getPositionOfFirstNonDownloadingItem(int startPosition, List<FeedItem> curQueue) {
|
||||
final int curQueueSize = curQueue.size();
|
||||
for (int i = startPosition; i < curQueueSize; i++) {
|
||||
if (!isItemAtPositionDownloading(i, curQueue)) {
|
||||
|
@ -95,9 +95,9 @@ class ItemEnqueuePositionCalculator {
|
|||
curItem = null;
|
||||
}
|
||||
|
||||
if (curItem != null &&
|
||||
curItem.getMedia() != null &&
|
||||
downloadStateProvider.isDownloadingFile(curItem.getMedia())) {
|
||||
if (curItem != null
|
||||
&& curItem.getMedia() != null
|
||||
&& downloadStateProvider.isDownloadingFile(curItem.getMedia())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -26,7 +26,7 @@ import static org.mockito.Mockito.stub;
|
|||
public class ItemEnqueuePositionCalculatorTest {
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public static class IEPCBasicTest {
|
||||
public static class BasicTest {
|
||||
@Parameters(name = "{index}: case<{0}>, expected:{1}")
|
||||
public static Iterable<Object[]> data() {
|
||||
Options optDefault = new Options();
|
||||
|
@ -90,7 +90,7 @@ public class ItemEnqueuePositionCalculatorTest {
|
|||
}
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public static class IEPCKeepInProgressAtFrontTest extends IEPCBasicTest {
|
||||
public static class KeepInProgressAtFrontTest extends BasicTest {
|
||||
@Parameters(name = "{index}: case<{0}>, expected:{1}")
|
||||
public static Iterable<Object[]> data() {
|
||||
Options optKeepInProgressAtFront =
|
||||
|
|
Loading…
Reference in New Issue