From 2cc46ebb2cf07ea533a19a17724442c50e610322 Mon Sep 17 00:00:00 2001 From: Gavriil Sitnikov Date: Tue, 7 Jun 2016 15:12:31 +0300 Subject: [PATCH] lists naming fixed --- .../collections/loadable/LoadedItems.java | 2 +- .../loadable/LoadingGrowingList.java | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadedItems.java b/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadedItems.java index a33c03d..8853991 100644 --- a/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadedItems.java +++ b/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadedItems.java @@ -27,7 +27,7 @@ import java.util.Collection; */ public interface LoadedItems { - boolean haveMoreItems(); + boolean hasMoreItems(); Collection getItems(); diff --git a/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadingGrowingList.java b/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadingGrowingList.java index a0d87f9..a428905 100644 --- a/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadingGrowingList.java +++ b/src/main/java/ru/touchin/roboswag/core/observables/collections/loadable/LoadingGrowingList.java @@ -50,7 +50,7 @@ public class LoadingGrowingList> @Nullable private Observable loadingMoreConcreteObservable; @NonNull - private final BehaviorSubject haveMoreItems = BehaviorSubject.create(true); + private final BehaviorSubject hasMoreItems = BehaviorSubject.create(true); @NonNull private final ObservableList innerList = new ObservableList<>(); private boolean removeDuplicates; @@ -70,11 +70,11 @@ public class LoadingGrowingList> } @NonNull - public Observable observeHaveMoreItems() { - return haveMoreItems.distinctUntilChanged(); + public Observable observeHasMoreItems() { + return hasMoreItems.distinctUntilChanged(); } - public void setIsRemoveDuplicates(final boolean removeDuplicates) { + public void setRemoveDuplicates(final boolean removeDuplicates) { this.removeDuplicates = removeDuplicates; } @@ -102,7 +102,7 @@ public class LoadingGrowingList> removeDuplicatesFromList(items); } innerList.addAll(items); - haveMoreItems.onNext(loadedItems.haveMoreItems()); + hasMoreItems.onNext(loadedItems.hasMoreItems()); }) .replay(1) .refCount(); @@ -118,6 +118,7 @@ public class LoadingGrowingList> for (int j = 0; j < innerList.size(); j++) { if (innerList.get(j).equals(items.get(i))) { items.remove(i); + break; } } } @@ -142,7 +143,7 @@ public class LoadingGrowingList> .>create(subscriber -> { if (position < size()) { subscriber.onNext(Observable.just(get(position))); - } else if (!haveMoreItems.getValue()) { + } else if (!hasMoreItems.getValue()) { subscriber.onNext(Observable.just((TItem) null)); } else { subscriber.onNext(getLoadMoreObservable().switchMap(ignored -> Observable.error(new DoRetryException()))); @@ -156,12 +157,12 @@ public class LoadingGrowingList> public void reset() { innerList.clear(); - haveMoreItems.onNext(true); + hasMoreItems.onNext(true); } public void reset(@NonNull final Collection initialItems) { innerList.set(initialItems); - haveMoreItems.onNext(true); + hasMoreItems.onNext(true); } private static class DoRetryException extends Exception {