Browse Source

Clean up code

master
Mohit Sarveiya 8 years ago
parent
commit
7251bccfea
  1. 6
      app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java
  2. 3
      app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt

6
app/src/main/java/acr/browser/lightning/search/SuggestionsAdapter.java

@ -302,11 +302,11 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable { @@ -302,11 +302,11 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable {
@NonNull
private Single<List<HistoryItem>> 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();
}

3
app/src/main/java/acr/browser/lightning/search/SuggestionsManager.kt

@ -13,6 +13,7 @@ internal object SuggestionsManager { @@ -13,6 +13,7 @@ internal object SuggestionsManager {
@JvmStatic
@Volatile var isRequestInProgress: Boolean = false
@JvmStatic
fun createGoogleQueryObservable(query: String, application: Application) =
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
isRequestInProgress = true
@ -22,6 +23,7 @@ internal object SuggestionsManager { @@ -22,6 +23,7 @@ internal object SuggestionsManager {
isRequestInProgress = false
})
@JvmStatic
fun createBaiduQueryObservable(query: String, application: Application) =
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
isRequestInProgress = true
@ -31,6 +33,7 @@ internal object SuggestionsManager { @@ -31,6 +33,7 @@ internal object SuggestionsManager {
isRequestInProgress = false
})
@JvmStatic
fun createDuckQueryObservable(query: String, application: Application) =
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
isRequestInProgress = true

Loading…
Cancel
Save