This commit is contained in:
Benoît Mauduit 2017-01-03 14:28:11 +01:00
parent c9edac2820
commit 80c9dbf180
2 changed files with 10 additions and 12 deletions

View file

@ -123,9 +123,8 @@ public class StreamInfoWorker {
} }
}); });
e.printStackTrace(); e.printStackTrace();
} } catch (YoutubeStreamExtractor.DecryptException de) {
// custom service related exceptions // custom service related exceptions
catch (YoutubeStreamExtractor.DecryptException de) {
h.post(new Runnable() { h.post(new Runnable() {
@Override @Override
public void run() { public void run() {

View file

@ -72,7 +72,7 @@ public class SearchInfoItemFragment extends Fragment {
//noinspection ConstantConditions //noinspection ConstantConditions
inputManager.hideSoftInputFromWindow( inputManager.hideSoftInputFromWindow(
a.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); a.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
} catch(NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
ErrorActivity.reportError(a, e, null, ErrorActivity.reportError(a, e, null,
a.findViewById(android.R.id.content), a.findViewById(android.R.id.content),
@ -86,7 +86,7 @@ public class SearchInfoItemFragment extends Fragment {
// onQueryTextSubmit to trigger twice when focus is not cleared. // onQueryTextSubmit to trigger twice when focus is not cleared.
// See: http://stackoverflow.com/questions/17874951/searchview-onquerytextsubmit-runs-twice-while-i-pressed-once // See: http://stackoverflow.com/questions/17874951/searchview-onquerytextsubmit-runs-twice-while-i-pressed-once
a.getCurrentFocus().clearFocus(); a.getCurrentFocus().clearFocus();
} catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
View bg = a.findViewById(R.id.mainBG); View bg = a.findViewById(R.id.mainBG);
@ -96,7 +96,7 @@ public class SearchInfoItemFragment extends Fragment {
@Override @Override
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
if(!newText.isEmpty()) { if (!newText.isEmpty()) {
searchSuggestions(newText); searchSuggestions(newText);
} }
return true; return true;
@ -137,13 +137,13 @@ public class SearchInfoItemFragment extends Fragment {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if(savedInstanceState != null) { if (savedInstanceState != null) {
searchQuery = savedInstanceState.getString(QUERY); searchQuery = savedInstanceState.getString(QUERY);
streamingServiceId = savedInstanceState.getInt(STREAMING_SERVICE); streamingServiceId = savedInstanceState.getInt(STREAMING_SERVICE);
} else { } else {
try { try {
streamingServiceId = NewPipe.getIdOfService("Youtube"); streamingServiceId = NewPipe.getIdOfService("Youtube");
} catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
ErrorActivity.reportError(getActivity(), e, null, ErrorActivity.reportError(getActivity(), e, null,
getActivity().findViewById(android.R.id.content), getActivity().findViewById(android.R.id.content),
@ -222,14 +222,13 @@ public class SearchInfoItemFragment extends Fragment {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int pastVisiblesItems, visibleItemCount, totalItemCount; int pastVisiblesItems, visibleItemCount, totalItemCount;
super.onScrolled(recyclerView, dx, dy); super.onScrolled(recyclerView, dx, dy);
if(dy > 0) //check for scroll down if (dy > 0) //check for scroll down
{ {
visibleItemCount = streamInfoListLayoutManager.getChildCount(); visibleItemCount = streamInfoListLayoutManager.getChildCount();
totalItemCount = streamInfoListLayoutManager.getItemCount(); totalItemCount = streamInfoListLayoutManager.getItemCount();
pastVisiblesItems = streamInfoListLayoutManager.findFirstVisibleItemPosition(); pastVisiblesItems = streamInfoListLayoutManager.findFirstVisibleItemPosition();
if ( (visibleItemCount + pastVisiblesItems) >= totalItemCount && !isLoading) if ((visibleItemCount + pastVisiblesItems) >= totalItemCount && !isLoading) {
{
pageNumber++; pageNumber++;
search(searchQuery, pageNumber); search(searchQuery, pageNumber);
} }
@ -270,7 +269,7 @@ public class SearchInfoItemFragment extends Fragment {
searchView.setSuggestionsAdapter(suggestionListAdapter); searchView.setSuggestionsAdapter(suggestionListAdapter);
searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView, suggestionListAdapter)); searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView, suggestionListAdapter));
searchView.setOnQueryTextListener(new SearchQueryListener()); searchView.setOnQueryTextListener(new SearchQueryListener());
if(searchQuery != null && !searchQuery.isEmpty()) { if (searchQuery != null && !searchQuery.isEmpty()) {
searchView.setQuery(searchQuery, false); searchView.setQuery(searchQuery, false);
searchView.setIconifiedByDefault(false); searchView.setIconifiedByDefault(false);
} }