mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-02-02 12:19:16 +00:00
Added new Snackbar for suggestion after searching.
This commit is contained in:
parent
ff54b4d0c9
commit
e5be9aa356
@ -6,6 +6,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.ListFragment;
|
import android.support.v4.app.ListFragment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -195,18 +196,31 @@ public class VideoItemListFragment extends ListFragment {
|
|||||||
this.streamingService = streamingService;
|
this.streamingService = streamingService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateListOnResult(SearchResult result, int requestId) {
|
public void updateListOnResult(final SearchResult result, int requestId) {
|
||||||
if(requestId == currentRequestId) {
|
if (requestId == currentRequestId) {
|
||||||
setListShown(true);
|
setListShown(true);
|
||||||
updateList(result.resultList);
|
updateList(result.resultList);
|
||||||
if(!result.suggestion.isEmpty()) {
|
if (!result.suggestion.isEmpty())
|
||||||
Toast.makeText(getActivity(),
|
Snackbar.make(getView(), String.format(getString(R.string.did_you_mean, result.suggestion)), Snackbar.LENGTH_LONG)
|
||||||
String.format(getString(R.string.did_you_mean), result.suggestion),
|
.setAction(R.string.yes, new View.OnClickListener() {
|
||||||
Toast.LENGTH_LONG).show();
|
@Override
|
||||||
}
|
public void onClick(View v) {
|
||||||
|
query = result.suggestion;
|
||||||
|
updatesearchQuery(query);
|
||||||
|
Toast.makeText(getActivity(), R.string.search + ": " + String.format(query), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatesearchQuery(String query) {
|
||||||
|
search(query);
|
||||||
|
//VideoItemListActivity VIL = new VideoItemListActivity();
|
||||||
|
//this.searchView = searchView;
|
||||||
|
// searchView.setQuery(query,true) <-- This don't work
|
||||||
|
}
|
||||||
|
|
||||||
private void updateList(List<StreamPreviewInfo> list) {
|
private void updateList(List<StreamPreviewInfo> list) {
|
||||||
try {
|
try {
|
||||||
videoListAdapter.addVideoList(list);
|
videoListAdapter.addVideoList(list);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<string name="settings_activity_title">Settings</string>
|
<string name="settings_activity_title">Settings</string>
|
||||||
<string name="use_external_video_player_title">Use external video player</string>
|
<string name="use_external_video_player_title">Use external video player</string>
|
||||||
<string name="use_external_audio_player_title">Use external audio player</string>
|
<string name="use_external_audio_player_title">Use external audio player</string>
|
||||||
|
<string name="yes">Yes</string>
|
||||||
|
|
||||||
<string name="download_path_title">Download path video</string>
|
<string name="download_path_title">Download path video</string>
|
||||||
<string name="download_path_summary">Path to store downloaded videos in.</string>
|
<string name="download_path_summary">Path to store downloaded videos in.</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user