diff --git a/app/src/main/java/com/deniscerri/ytdlnis/adapter/HomeRecyclerViewAdapter.java b/app/src/main/java/com/deniscerri/ytdlnis/adapter/HomeRecyclerViewAdapter.java index cb461429..7e0e7383 100644 --- a/app/src/main/java/com/deniscerri/ytdlnis/adapter/HomeRecyclerViewAdapter.java +++ b/app/src/main/java/com/deniscerri/ytdlnis/adapter/HomeRecyclerViewAdapter.java @@ -111,6 +111,7 @@ public class HomeRecyclerViewAdapter extends RecyclerView.Adapter ((AppBarLayout) topAppBar.getParent()).setExpanded(true, true)); + ((AppBarLayout) topAppBar.getParent()).setExpanded(true, true); } private void parseQuery(boolean resetResults) { @@ -523,7 +523,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On resultObjects.addAll(tmp_vids); new Handler(Looper.getMainLooper()).post(() -> { dbManager.addToResults(tmp_vids); - homeRecyclerViewAdapter.setVideoList(tmp_vids, false); + homeRecyclerViewAdapter.setVideoList(resultObjects, true); shimmerCards.stopShimmer(); shimmerCards.setVisibility(View.GONE); }); @@ -855,6 +855,8 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On return; } bottomSheet.cancel(); + start--; + end--; if (start <= 1) start = 0; SharedPreferences sharedPreferences = context.getSharedPreferences("root_preferences", Activity.MODE_PRIVATE); @@ -882,8 +884,9 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On TextInputLayout audioFormat = downloadTypeBottomSheet.findViewById(R.id.audio_format); int finalStart = start; + int finalEnd = end; ((AutoCompleteTextView)audioFormat.getEditText()).setOnItemClickListener((adapterView, view, index, l) -> { - for (int i = finalStart; i < end; i++){ + for (int i = finalStart; i <= finalEnd; i++){ Video vid = findVideo(resultObjects.get(i).getURL()); vid.setAudioFormat(audioFormats[index]); } @@ -904,8 +907,9 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On TextInputLayout videoFormat = downloadTypeBottomSheet.findViewById(R.id.video_format); int finalStart1 = start; + int finalEnd1 = end; ((AutoCompleteTextView)videoFormat.getEditText()).setOnItemClickListener((adapterView, view, index, l) -> { - for (int i = finalStart1; i < end; i++){ + for (int i = finalStart1; i <= finalEnd1; i++){ Video vid = findVideo(resultObjects.get(i).getURL()); vid.setVideoFormat(videoFormats[index]); } @@ -915,7 +919,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On TextInputLayout videoQuality = downloadTypeBottomSheet.findViewById(R.id.video_quality); ((AutoCompleteTextView)videoQuality.getEditText()).setOnItemClickListener((adapterView, view, index, l) -> { - for (int i = finalStart1; i < end; i++){ + for (int i = finalStart1; i <= finalEnd1; i++){ Video vid = findVideo(resultObjects.get(i).getURL()); vid.setVideoQuality(videoQualities[index]); } @@ -964,8 +968,9 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On Button download = downloadTypeBottomSheet.findViewById(R.id.bottomsheet_download_button); int finalStart2 = start; + int finalEnd2 = end; download.setOnClickListener(view -> { - for (int i = finalStart2; i < end; i++){ + for (int i = finalStart2; i <= finalEnd2; i++){ Video vid = findVideo(resultObjects.get(i).getURL()); vid.setDownloadedType(type); updateDownloadingStatusOnResult(vid, type, true); @@ -982,7 +987,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On downloadTypeBottomSheet.show(); downloadTypeBottomSheet.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); }else{ - for (int i = start; i < end; i++){ + for (int i = start; i <= end; i++){ Video vid = findVideo(resultObjects.get(i).getURL()); vid.setDownloadedType(type); updateDownloadingStatusOnResult(vid, type, true); diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml index e541afd3..20151e82 100644 --- a/app/src/main/res/xml/provider_paths.xml +++ b/app/src/main/res/xml/provider_paths.xml @@ -1,8 +1,7 @@ - + +