even more fixes

This commit is contained in:
Denis Çerri 2022-10-21 16:11:12 +02:00
parent 4edd72f627
commit 4a387ea0cf
No known key found for this signature in database
GPG key ID: 3F50F14A8E7F7A13
4 changed files with 15 additions and 11 deletions

View file

@ -111,6 +111,7 @@ public class HomeRecyclerViewAdapter extends RecyclerView.Adapter<HomeRecyclerVi
if (video.isDownloading()){ if (video.isDownloading()){
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
}else { }else {
progressBar.setProgress(0);
progressBar.setIndeterminate(true); progressBar.setIndeterminate(true);
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
} }

View file

@ -680,7 +680,6 @@ public class DownloadsFragment extends Fragment implements DownloadsRecyclerView
Intent i = new Intent(Intent.ACTION_VIEW); Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(uri, mime); i.setDataAndType(uri, mime);
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if(bottomSheet != null) bottomSheet.hide();
startActivity(i); startActivity(i);
} }

View file

@ -438,7 +438,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
public void scrollToTop() { public void scrollToTop() {
recyclerView.scrollToPosition(0); recyclerView.scrollToPosition(0);
new Handler(Looper.getMainLooper()).post(() -> ((AppBarLayout) topAppBar.getParent()).setExpanded(true, true)); ((AppBarLayout) topAppBar.getParent()).setExpanded(true, true);
} }
private void parseQuery(boolean resetResults) { private void parseQuery(boolean resetResults) {
@ -523,7 +523,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
resultObjects.addAll(tmp_vids); resultObjects.addAll(tmp_vids);
new Handler(Looper.getMainLooper()).post(() -> { new Handler(Looper.getMainLooper()).post(() -> {
dbManager.addToResults(tmp_vids); dbManager.addToResults(tmp_vids);
homeRecyclerViewAdapter.setVideoList(tmp_vids, false); homeRecyclerViewAdapter.setVideoList(resultObjects, true);
shimmerCards.stopShimmer(); shimmerCards.stopShimmer();
shimmerCards.setVisibility(View.GONE); shimmerCards.setVisibility(View.GONE);
}); });
@ -855,6 +855,8 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
return; return;
} }
bottomSheet.cancel(); bottomSheet.cancel();
start--;
end--;
if (start <= 1) start = 0; if (start <= 1) start = 0;
SharedPreferences sharedPreferences = context.getSharedPreferences("root_preferences", Activity.MODE_PRIVATE); 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); TextInputLayout audioFormat = downloadTypeBottomSheet.findViewById(R.id.audio_format);
int finalStart = start; int finalStart = start;
int finalEnd = end;
((AutoCompleteTextView)audioFormat.getEditText()).setOnItemClickListener((adapterView, view, index, l) -> { ((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()); Video vid = findVideo(resultObjects.get(i).getURL());
vid.setAudioFormat(audioFormats[index]); vid.setAudioFormat(audioFormats[index]);
} }
@ -904,8 +907,9 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
TextInputLayout videoFormat = downloadTypeBottomSheet.findViewById(R.id.video_format); TextInputLayout videoFormat = downloadTypeBottomSheet.findViewById(R.id.video_format);
int finalStart1 = start; int finalStart1 = start;
int finalEnd1 = end;
((AutoCompleteTextView)videoFormat.getEditText()).setOnItemClickListener((adapterView, view, index, l) -> { ((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()); Video vid = findVideo(resultObjects.get(i).getURL());
vid.setVideoFormat(videoFormats[index]); vid.setVideoFormat(videoFormats[index]);
} }
@ -915,7 +919,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
TextInputLayout videoQuality = downloadTypeBottomSheet.findViewById(R.id.video_quality); TextInputLayout videoQuality = downloadTypeBottomSheet.findViewById(R.id.video_quality);
((AutoCompleteTextView)videoQuality.getEditText()).setOnItemClickListener((adapterView, view, index, l) -> { ((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()); Video vid = findVideo(resultObjects.get(i).getURL());
vid.setVideoQuality(videoQualities[index]); 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); Button download = downloadTypeBottomSheet.findViewById(R.id.bottomsheet_download_button);
int finalStart2 = start; int finalStart2 = start;
int finalEnd2 = end;
download.setOnClickListener(view -> { download.setOnClickListener(view -> {
for (int i = finalStart2; i < end; i++){ for (int i = finalStart2; i <= finalEnd2; i++){
Video vid = findVideo(resultObjects.get(i).getURL()); Video vid = findVideo(resultObjects.get(i).getURL());
vid.setDownloadedType(type); vid.setDownloadedType(type);
updateDownloadingStatusOnResult(vid, type, true); updateDownloadingStatusOnResult(vid, type, true);
@ -982,7 +987,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
downloadTypeBottomSheet.show(); downloadTypeBottomSheet.show();
downloadTypeBottomSheet.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); downloadTypeBottomSheet.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
}else{ }else{
for (int i = start; i < end; i++){ for (int i = start; i <= end; i++){
Video vid = findVideo(resultObjects.get(i).getURL()); Video vid = findVideo(resultObjects.get(i).getURL());
vid.setDownloadedType(type); vid.setDownloadedType(type);
updateDownloadingStatusOnResult(vid, type, true); updateDownloadingStatusOnResult(vid, type, true);

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<paths> <paths>
<external-path <external-path name="external_files" path="."/>
name="external_files" <root-path name="external_files" path="/storage/" />
path="." />
<cache-path <cache-path
name="cache" name="cache"
path="." /> path="." />