From 7251bccfeab2c625c34b3e27600a55d2c1c84045 Mon Sep 17 00:00:00 2001 From: Mohit Sarveiya Date: Mon, 26 Jun 2017 22:01:08 -0400 Subject: [PATCH] Clean up code --- .../acr/browser/lightning/search/SuggestionsAdapter.java | 6 +++--- .../java/acr/browser/lightning/search/SuggestionsManager.kt | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java b/app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java index 54c24b6..ccb4281 100644 --- a/app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java +++ b/app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java @@ -302,11 +302,11 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable { @NonNull private Single> getSuggestionsForQuery(@NonNull final String query) { if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_GOOGLE) { - return SuggestionsManager.INSTANCE.createGoogleQueryObservable(query, mApplication); + return SuggestionsManager.createGoogleQueryObservable(query, mApplication); } else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_DUCK) { - return SuggestionsManager.INSTANCE.createDuckQueryObservable(query, mApplication); + return SuggestionsManager.createDuckQueryObservable(query, mApplication); } else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_BAIDU) { - return SuggestionsManager.INSTANCE.createBaiduQueryObservable(query, mApplication); + return SuggestionsManager.createBaiduQueryObservable(query, mApplication); } else { return Single.empty(); } diff --git a/app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt b/app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt index 3a8edff..b28414e 100644 --- a/app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt +++ b/app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt @@ -13,6 +13,7 @@ internal object SuggestionsManager { @JvmStatic @Volatile var isRequestInProgress: Boolean = false + @JvmStatic fun createGoogleQueryObservable(query: String, application: Application) = Single.create(SingleAction> { subscriber -> isRequestInProgress = true @@ -22,6 +23,7 @@ internal object SuggestionsManager { isRequestInProgress = false }) + @JvmStatic fun createBaiduQueryObservable(query: String, application: Application) = Single.create(SingleAction> { subscriber -> isRequestInProgress = true @@ -31,6 +33,7 @@ internal object SuggestionsManager { isRequestInProgress = false }) + @JvmStatic fun createDuckQueryObservable(query: String, application: Application) = Single.create(SingleAction> { subscriber -> isRequestInProgress = true