Clean up code
This commit is contained in:
parent
4389cf9985
commit
7251bccfea
@ -302,11 +302,11 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable {
|
|||||||
@NonNull
|
@NonNull
|
||||||
private Single<List<HistoryItem>> getSuggestionsForQuery(@NonNull final String query) {
|
private Single<List<HistoryItem>> getSuggestionsForQuery(@NonNull final String query) {
|
||||||
if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_GOOGLE) {
|
if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_GOOGLE) {
|
||||||
return SuggestionsManager.INSTANCE.createGoogleQueryObservable(query, mApplication);
|
return SuggestionsManager.createGoogleQueryObservable(query, mApplication);
|
||||||
} else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_DUCK) {
|
} 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) {
|
} else if (mSuggestionChoice == PreferenceManager.Suggestion.SUGGESTION_BAIDU) {
|
||||||
return SuggestionsManager.INSTANCE.createBaiduQueryObservable(query, mApplication);
|
return SuggestionsManager.createBaiduQueryObservable(query, mApplication);
|
||||||
} else {
|
} else {
|
||||||
return Single.empty();
|
return Single.empty();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ internal object SuggestionsManager {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Volatile var isRequestInProgress: Boolean = false
|
@Volatile var isRequestInProgress: Boolean = false
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun createGoogleQueryObservable(query: String, application: Application) =
|
fun createGoogleQueryObservable(query: String, application: Application) =
|
||||||
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
|
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
|
||||||
isRequestInProgress = true
|
isRequestInProgress = true
|
||||||
@ -22,6 +23,7 @@ internal object SuggestionsManager {
|
|||||||
isRequestInProgress = false
|
isRequestInProgress = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun createBaiduQueryObservable(query: String, application: Application) =
|
fun createBaiduQueryObservable(query: String, application: Application) =
|
||||||
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
|
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
|
||||||
isRequestInProgress = true
|
isRequestInProgress = true
|
||||||
@ -31,6 +33,7 @@ internal object SuggestionsManager {
|
|||||||
isRequestInProgress = false
|
isRequestInProgress = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
fun createDuckQueryObservable(query: String, application: Application) =
|
fun createDuckQueryObservable(query: String, application: Application) =
|
||||||
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
|
Single.create(SingleAction<List<HistoryItem>> { subscriber ->
|
||||||
isRequestInProgress = true
|
isRequestInProgress = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user