mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-22 23:17:00 +00:00
add toast for suggestion error handling
This commit is contained in:
parent
799a27ec84
commit
8048ad343e
@ -15,6 +15,7 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.schabi.newpipe.extractor.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.SearchEngine;
|
||||
@ -89,6 +90,8 @@ public class VideoItemListActivity extends AppCompatActivity
|
||||
getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
} catch(NullPointerException e) {
|
||||
Log.e(TAG, "Could not get widget with focus");
|
||||
Toast.makeText(VideoItemListActivity.this, "Could not get widget with focus",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
e.printStackTrace();
|
||||
}
|
||||
// clear focus
|
||||
@ -168,8 +171,12 @@ public class VideoItemListActivity extends AppCompatActivity
|
||||
ArrayList<String>suggestions = engine.suggestionList(query,searchLanguage,new Downloader());
|
||||
h.post(new SuggestionResultRunnable(suggestions));
|
||||
} catch (ExtractionException e) {
|
||||
Toast.makeText(VideoItemListActivity.this, getString(R.string.parsing_error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(VideoItemListActivity.this, getString(R.string.network_error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -186,8 +186,12 @@ public class VideoItemListFragment extends ListFragment {
|
||||
videoListAdapter.addVideoList(list);
|
||||
terminateThreads();
|
||||
} catch(java.lang.IllegalStateException e) {
|
||||
Toast.makeText(getActivity(), "Trying to set value while activity doesn't exist anymore.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
Log.w(TAG, "Trying to set value while activity doesn't exist anymore.");
|
||||
} catch(Exception e) {
|
||||
Toast.makeText(getActivity(), getString(R.string.general_error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
loadingNextPage = false;
|
||||
|
Loading…
Reference in New Issue
Block a user