mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Lint warning: Lambda can be replaced with method reference.
This commit is contained in:
parent
a615e0784e
commit
f74de55b60
3 changed files with 10 additions and 15 deletions
|
|
@ -28,9 +28,7 @@ public abstract class AuthenticatedActivity extends NavigationBaseActivity {
|
|||
.subscribeOn(Schedulers.io())
|
||||
.doOnError(Timber::e)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
cookie -> onAuthCookieAcquired(cookie),
|
||||
throwable -> onAuthFailure());
|
||||
.subscribe(this::onAuthCookieAcquired, throwable -> onAuthFailure());
|
||||
}
|
||||
|
||||
private void addAccount(AccountManager accountManager) {
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ public class CategorizationFragment extends Fragment {
|
|||
categoriesCache = new HashMap<>();
|
||||
if (savedInstanceState != null) {
|
||||
items.addAll(savedInstanceState.getParcelableArrayList("currentCategories"));
|
||||
//noinspection unchecked
|
||||
categoriesCache.putAll((HashMap<String, ArrayList<String>>) savedInstanceState
|
||||
.getSerializable("categoriesCache"));
|
||||
}
|
||||
|
|
@ -201,9 +202,7 @@ public class CategorizationFragment extends Fragment {
|
|||
.distinct()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
s -> categoriesAdapter.add(s),
|
||||
throwable -> Timber.e(throwable),
|
||||
() -> {
|
||||
s -> categoriesAdapter.add(s), Timber::e, () -> {
|
||||
categoriesAdapter.notifyDataSetChanged();
|
||||
categoriesSearchInProgress.setVisibility(View.GONE);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import java.util.Collections;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import fr.free.nrw.commons.BuildConfig;
|
||||
import fr.free.nrw.commons.PageTitle;
|
||||
|
|
@ -235,8 +236,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
}
|
||||
|
||||
return categories;
|
||||
})
|
||||
.flatMapObservable(list -> Observable.fromIterable(list));
|
||||
}).flatMapObservable(Observable::fromIterable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -265,15 +265,14 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
}
|
||||
|
||||
return categories;
|
||||
})
|
||||
.flatMapObservable(list -> Observable.fromIterable(list));
|
||||
}).flatMapObservable(Observable::fromIterable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Observable<String> searchTitles(String title, int searchCatsLimit) {
|
||||
return Single.fromCallable(() -> {
|
||||
ArrayList<ApiResult> categoryNodes = null;
|
||||
return Single.fromCallable((Callable<List<String>>) () -> {
|
||||
ArrayList<ApiResult> categoryNodes;
|
||||
|
||||
try {
|
||||
categoryNodes = api.action("query")
|
||||
|
|
@ -287,7 +286,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
.getNodes("/api/query/search/p/@title");
|
||||
} catch (IOException e) {
|
||||
Timber.e("Failed to obtain searchTitles", e);
|
||||
return new ArrayList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (categoryNodes == null) {
|
||||
|
|
@ -302,8 +301,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
}
|
||||
|
||||
return titleCategories;
|
||||
})
|
||||
.flatMapObservable(list -> Observable.fromIterable(list));
|
||||
}).flatMapObservable(Observable::fromIterable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue