From 80c9dbf180f3f4864c4406b1fa2a8f698bd8e0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= Date: Tue, 3 Jan 2017 14:28:11 +0100 Subject: [PATCH] Cosmetic --- .../schabi/newpipe/detail/StreamInfoWorker.java | 5 ++--- .../search_fragment/SearchInfoItemFragment.java | 17 ++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java b/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java index df2f8454d..dd1ae9f5a 100644 --- a/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java +++ b/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java @@ -123,9 +123,8 @@ public class StreamInfoWorker { } }); e.printStackTrace(); - } - // custom service related exceptions - catch (YoutubeStreamExtractor.DecryptException de) { + } catch (YoutubeStreamExtractor.DecryptException de) { + // custom service related exceptions h.post(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/org/schabi/newpipe/search_fragment/SearchInfoItemFragment.java b/app/src/main/java/org/schabi/newpipe/search_fragment/SearchInfoItemFragment.java index 9d3d7b839..57b63c209 100644 --- a/app/src/main/java/org/schabi/newpipe/search_fragment/SearchInfoItemFragment.java +++ b/app/src/main/java/org/schabi/newpipe/search_fragment/SearchInfoItemFragment.java @@ -72,7 +72,7 @@ public class SearchInfoItemFragment extends Fragment { //noinspection ConstantConditions inputManager.hideSoftInputFromWindow( a.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); - } catch(NullPointerException e) { + } catch (NullPointerException e) { e.printStackTrace(); ErrorActivity.reportError(a, e, null, a.findViewById(android.R.id.content), @@ -86,7 +86,7 @@ public class SearchInfoItemFragment extends Fragment { // onQueryTextSubmit to trigger twice when focus is not cleared. // See: http://stackoverflow.com/questions/17874951/searchview-onquerytextsubmit-runs-twice-while-i-pressed-once a.getCurrentFocus().clearFocus(); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } View bg = a.findViewById(R.id.mainBG); @@ -96,7 +96,7 @@ public class SearchInfoItemFragment extends Fragment { @Override public boolean onQueryTextChange(String newText) { - if(!newText.isEmpty()) { + if (!newText.isEmpty()) { searchSuggestions(newText); } return true; @@ -137,13 +137,13 @@ public class SearchInfoItemFragment extends Fragment { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if(savedInstanceState != null) { + if (savedInstanceState != null) { searchQuery = savedInstanceState.getString(QUERY); streamingServiceId = savedInstanceState.getInt(STREAMING_SERVICE); } else { try { streamingServiceId = NewPipe.getIdOfService("Youtube"); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); ErrorActivity.reportError(getActivity(), e, null, getActivity().findViewById(android.R.id.content), @@ -222,14 +222,13 @@ public class SearchInfoItemFragment extends Fragment { public void onScrolled(RecyclerView recyclerView, int dx, int dy) { int pastVisiblesItems, visibleItemCount, totalItemCount; super.onScrolled(recyclerView, dx, dy); - if(dy > 0) //check for scroll down + if (dy > 0) //check for scroll down { visibleItemCount = streamInfoListLayoutManager.getChildCount(); totalItemCount = streamInfoListLayoutManager.getItemCount(); pastVisiblesItems = streamInfoListLayoutManager.findFirstVisibleItemPosition(); - if ( (visibleItemCount + pastVisiblesItems) >= totalItemCount && !isLoading) - { + if ((visibleItemCount + pastVisiblesItems) >= totalItemCount && !isLoading) { pageNumber++; search(searchQuery, pageNumber); } @@ -270,7 +269,7 @@ public class SearchInfoItemFragment extends Fragment { searchView.setSuggestionsAdapter(suggestionListAdapter); searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView, suggestionListAdapter)); searchView.setOnQueryTextListener(new SearchQueryListener()); - if(searchQuery != null && !searchQuery.isEmpty()) { + if (searchQuery != null && !searchQuery.isEmpty()) { searchView.setQuery(searchQuery, false); searchView.setIconifiedByDefault(false); }