made clicked results cancellable
This commit is contained in:
parent
b5119e8b4e
commit
b93ed7309e
16 changed files with 308 additions and 50 deletions
|
|
@ -320,7 +320,7 @@
|
|||
<PersistentState>
|
||||
<option name="values">
|
||||
<map>
|
||||
<entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialicons/filter_list/baseline_filter_list_24.xml" />
|
||||
<entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialicons/cancel/baseline_cancel_24.xml" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
|
|
@ -331,7 +331,7 @@
|
|||
<option name="values">
|
||||
<map>
|
||||
<entry key="color" value="00a6ff" />
|
||||
<entry key="outputName" value="ic_filter" />
|
||||
<entry key="outputName" value="ic_cancel" />
|
||||
<entry key="sourceFile" value="C:\Users\denis\Desktop\adaptiveproduct_youtube_foreground_color_108 (1).svg" />
|
||||
</map>
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_app_icon.xml" value="0.1965" />
|
||||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_back.xml" value="0.109" />
|
||||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_baseline_keyboard_arrow_right_24.xml" value="0.109" />
|
||||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_cancel.xml" value="0.2395" />
|
||||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_chapters.xml" value="0.109" />
|
||||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_cloud_download.xml" value="0.1275" />
|
||||
<entry key="..\:/Users/denis/Documents/GitHub/ytdlnis/app/src/main/res/drawable/ic_code.xml" value="0.1275" />
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@ public class DownloaderService extends Service {
|
|||
callback.onDownloadProgress(downloadInfo);
|
||||
});
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}catch (Exception ignored){}
|
||||
};
|
||||
|
||||
@Override
|
||||
|
|
@ -149,17 +147,38 @@ public class DownloaderService extends Service {
|
|||
|
||||
public void updateQueue(ArrayList<Video> queue){
|
||||
downloadQueue.addAll(queue);
|
||||
if (downloadQueue.size() == queue.size()){
|
||||
downloadInfo.setDownloadQueue(downloadQueue);
|
||||
startDownload(downloadQueue);
|
||||
}else{
|
||||
downloadInfo.setDownloadQueue(downloadQueue);
|
||||
Toast.makeText(context, getString(R.string.added_to_queue), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelDownload(){
|
||||
try{
|
||||
YoutubeDL.getInstance().destroyProcessById(downloadProcessID);
|
||||
compositeDisposable.clear();
|
||||
//stopForeground(true);
|
||||
onDownloadEnd();
|
||||
}catch(Exception err){
|
||||
Log.e(TAG, err.getMessage());
|
||||
}
|
||||
compositeDisposable.clear();
|
||||
}
|
||||
|
||||
public void removeItemFromDownloadQueue(Video video){
|
||||
//if its the same video with the same download type as the current downloading one
|
||||
if (downloadInfo.getVideo().getURL().equals(video.getURL()) && downloadInfo.getVideo().getDownloadedType().equals(video.getDownloadedType())){
|
||||
cancelDownload();
|
||||
downloadQueue.pop();
|
||||
downloadInfo.setDownloadQueue(downloadQueue);
|
||||
startDownload(downloadQueue);
|
||||
}else {
|
||||
downloadQueue.remove(video);
|
||||
}
|
||||
Toast.makeText(context, video.getTitle() + " " + getString(R.string.removed_from_queue), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void finishService(){
|
||||
|
|
@ -175,7 +194,18 @@ public class DownloaderService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void onDownloadEnd(){
|
||||
try{
|
||||
for (Activity activity: activities.keySet()){
|
||||
activity.runOnUiThread(() -> {
|
||||
IDownloaderListener callback = activities.get(activity);
|
||||
callback.onDownloadEnd(downloadInfo);
|
||||
});
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void startDownload(LinkedList<Video> videos) {
|
||||
Video video;
|
||||
|
|
@ -216,7 +246,7 @@ public class DownloaderService extends Service {
|
|||
request.addOption("--external-downloader-args", "aria2c:\"--summary-interval=1\"");
|
||||
}else{
|
||||
int concurrentFragments = sharedPreferences.getInt("concurrent_fragments", 1);
|
||||
request.addOption("-N", concurrentFragments);
|
||||
if (concurrentFragments > 1) request.addOption("-N", concurrentFragments);
|
||||
}
|
||||
|
||||
String limitRate = sharedPreferences.getString("limit_rate", "");
|
||||
|
|
@ -284,7 +314,6 @@ public class DownloaderService extends Service {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(youtubeDLResponse -> {
|
||||
downloadInfo.setDownloadPath(youtubeDLDir.getAbsolutePath());
|
||||
|
||||
try{
|
||||
for (Activity activity: activities.keySet()){
|
||||
activity.runOnUiThread(() -> {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class MainActivity extends AppCompatActivity{
|
|||
|
||||
private boolean isDownloadServiceRunning = false;
|
||||
public DownloaderService downloaderService;
|
||||
private IDownloaderListener listener = null;
|
||||
private ArrayList<IDownloaderListener> listeners = null;
|
||||
private IDownloaderService iDownloaderService;
|
||||
|
||||
private final ServiceConnection serviceConnection = new ServiceConnection() {
|
||||
|
|
@ -54,8 +54,11 @@ public class MainActivity extends AppCompatActivity{
|
|||
iDownloaderService = (IDownloaderService) service;
|
||||
isDownloadServiceRunning = true;
|
||||
try{
|
||||
iDownloaderService.addActivity(MainActivity.this, listener);
|
||||
listener.onDownloadStart(iDownloaderService.getDownloadInfo());
|
||||
for (int i = 0; i < listeners.size(); i++){
|
||||
IDownloaderListener listener = listeners.get(i);
|
||||
iDownloaderService.addActivity(MainActivity.this, listener);
|
||||
listener.onDownloadStart(iDownloaderService.getDownloadInfo());
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -87,8 +90,6 @@ public class MainActivity extends AppCompatActivity{
|
|||
historyFragment = new HistoryFragment();
|
||||
moreFragment = new MoreFragment();
|
||||
|
||||
listener = homeFragment.listener;
|
||||
|
||||
initFragments();
|
||||
|
||||
binding.bottomNavigationView.setOnItemSelectedListener(item -> {
|
||||
|
|
@ -152,6 +153,10 @@ public class MainActivity extends AppCompatActivity{
|
|||
.commit();
|
||||
|
||||
lastFragment = homeFragment;
|
||||
|
||||
listeners = new ArrayList<>();
|
||||
listeners.add(homeFragment.listener);
|
||||
listeners.add(historyFragment.listener);
|
||||
}
|
||||
|
||||
private void replaceFragment(Fragment f){
|
||||
|
|
@ -162,10 +167,9 @@ public class MainActivity extends AppCompatActivity{
|
|||
public void startDownloadService(ArrayList<Video> downloadQueue, IDownloaderListener awaitingListener){
|
||||
if(isDownloadServiceRunning){
|
||||
iDownloaderService.updateQueue(downloadQueue);
|
||||
Toast.makeText(context, getString(R.string.added_to_queue), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
listener = awaitingListener;
|
||||
if(!listeners.contains(awaitingListener)) listeners.add(awaitingListener);
|
||||
Intent serviceIntent = new Intent(context, DownloaderService.class);
|
||||
serviceIntent.putParcelableArrayListExtra("queue", downloadQueue);
|
||||
context.getApplicationContext().bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
|
||||
|
|
@ -186,6 +190,10 @@ public class MainActivity extends AppCompatActivity{
|
|||
stopDownloadService();
|
||||
}
|
||||
|
||||
public void removeItemFromDownloadQueue(Video video){
|
||||
iDownloaderService.removeItemFromDownloadQueue(video);
|
||||
}
|
||||
|
||||
public boolean isDownloadServiceRunning() {
|
||||
ActivityManager.RunningServiceInfo service = getService(DownloaderService.class);
|
||||
if(service != null){
|
||||
|
|
|
|||
|
|
@ -106,18 +106,13 @@ public class HistoryRecyclerViewAdapter extends RecyclerView.Adapter<HistoryRecy
|
|||
// BUTTON ----------------------------------
|
||||
LinearLayout buttonLayout = card.findViewById(R.id.history_download_button_layout);
|
||||
MaterialButton btn = buttonLayout.findViewById(R.id.history_download_button_type);
|
||||
|
||||
if(video.getDownloadedType().equals("audio")){
|
||||
if (filePresent) btn.setIcon(ContextCompat.getDrawable(context, R.drawable.ic_music_downloaded));
|
||||
else {
|
||||
btn.setIcon(ContextCompat.getDrawable(context, R.drawable.ic_music));
|
||||
btn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#707a7e")));
|
||||
}
|
||||
else btn.setIcon(ContextCompat.getDrawable(context, R.drawable.ic_music));
|
||||
}else{
|
||||
if (filePresent) btn.setIcon(ContextCompat.getDrawable(context, R.drawable.ic_video_downloaded));
|
||||
else {
|
||||
btn.setIcon(ContextCompat.getDrawable(context, R.drawable.ic_video));
|
||||
btn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#707a7e")));
|
||||
}
|
||||
else btn.setIcon(ContextCompat.getDrawable(context, R.drawable.ic_video));
|
||||
}
|
||||
|
||||
card.setOnClickListener(view -> onItemClickListener.onCardClick(position));
|
||||
|
|
|
|||
|
|
@ -222,4 +222,24 @@ public class Video implements Parcelable {
|
|||
parcel.writeString(website);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Video{" +
|
||||
"id=" + id +
|
||||
", videoId='" + videoId + '\'' +
|
||||
", title='" + title + '\'' +
|
||||
", author='" + author + '\'' +
|
||||
", duration='" + duration + '\'' +
|
||||
", thumb='" + thumb + '\'' +
|
||||
", url='" + url + '\'' +
|
||||
", downloadedType='" + downloadedType + '\'' +
|
||||
", downloadedAudio=" + downloadedAudio +
|
||||
", downloadedVideo=" + downloadedVideo +
|
||||
", downloadedTime='" + downloadedTime + '\'' +
|
||||
", isPlaylistItem=" + isPlaylistItem +
|
||||
", downloadPath='" + downloadPath + '\'' +
|
||||
", website='" + website + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
package com.deniscerri.ytdlnis.page;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
|
@ -28,13 +31,18 @@ import com.deniscerri.ytdlnis.R;
|
|||
import com.deniscerri.ytdlnis.adapter.HistoryRecyclerViewAdapter;
|
||||
import com.deniscerri.ytdlnis.database.DBManager;
|
||||
import com.deniscerri.ytdlnis.database.Video;
|
||||
import com.deniscerri.ytdlnis.service.DownloadInfo;
|
||||
import com.deniscerri.ytdlnis.service.IDownloaderListener;
|
||||
import com.facebook.shimmer.ShimmerFrameLayout;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.MaterialToolbar;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* A fragment representing a list of Items.
|
||||
|
|
@ -44,6 +52,7 @@ public class HistoryFragment extends Fragment implements HistoryRecyclerViewAdap
|
|||
private View fragmentView;
|
||||
private DBManager dbManager;
|
||||
Context context;
|
||||
Activity activity;
|
||||
Context fragmentContext;
|
||||
private LayoutInflater layoutinflater;
|
||||
private ShimmerFrameLayout shimmerCards;
|
||||
|
|
@ -56,6 +65,39 @@ public class HistoryFragment extends Fragment implements HistoryRecyclerViewAdap
|
|||
private ArrayList<Video> historyObjects;
|
||||
private static final String TAG = "HistoryFragment";
|
||||
|
||||
|
||||
public IDownloaderListener listener = new IDownloaderListener() {
|
||||
|
||||
public void onDownloadStart(DownloadInfo downloadInfo) {
|
||||
try{
|
||||
|
||||
}catch(Exception ignored){}
|
||||
}
|
||||
|
||||
public void onDownloadProgress(DownloadInfo info) {
|
||||
activity.runOnUiThread(() -> {
|
||||
try{
|
||||
|
||||
}catch(Exception ignored){}
|
||||
});
|
||||
}
|
||||
|
||||
public void onDownloadError(DownloadInfo info){
|
||||
try{
|
||||
|
||||
}catch(Exception ignored){}
|
||||
}
|
||||
|
||||
public void onDownloadEnd(DownloadInfo downloadInfo) {
|
||||
try{
|
||||
|
||||
}catch(Exception ignored){}
|
||||
}
|
||||
|
||||
public void onDownloadServiceEnd() {}
|
||||
};
|
||||
|
||||
|
||||
public HistoryFragment() {
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +121,7 @@ public class HistoryFragment extends Fragment implements HistoryRecyclerViewAdap
|
|||
|
||||
fragmentView = inflater.inflate(R.layout.fragment_history, container, false);
|
||||
context = fragmentView.getContext().getApplicationContext();
|
||||
activity = getActivity();
|
||||
fragmentContext = fragmentView.getContext();
|
||||
layoutinflater = LayoutInflater.from(context);
|
||||
shimmerCards = fragmentView.findViewById(R.id.shimmer_history_framelayout);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
|
|
@ -42,13 +41,13 @@ import com.google.android.material.floatingactionbutton.ExtendedFloatingActionBu
|
|||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.progressindicator.LinearProgressIndicator;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -79,57 +78,75 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
|||
private InfoUtil infoUtil;
|
||||
private ArrayList<Video> downloadQueue;
|
||||
MainActivity mainActivity;
|
||||
private DownloadInfo downloadInfo;
|
||||
|
||||
public IDownloaderListener listener = new IDownloaderListener() {
|
||||
|
||||
public void onDownloadStart(DownloadInfo downloadInfo) {
|
||||
public void onDownloadStart(DownloadInfo info) {
|
||||
downloadInfo = info;
|
||||
try{
|
||||
if(downloadInfo != null){
|
||||
String id = downloadInfo.getVideo().getVideoId();
|
||||
String type = downloadInfo.getVideo().getDownloadedType();
|
||||
|
||||
recyclerView.smoothScrollToPosition(resultObjects.indexOf(findVideo(id)));
|
||||
MaterialButton clickedButton = recyclerView.findViewWithTag(id + "##"+type);
|
||||
MaterialButton clickedButton = recyclerView.findViewWithTag(id +"##"+type);
|
||||
progressBar = recyclerView.findViewWithTag(id + "##progress");
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
downloading = true;
|
||||
topAppBar.getMenu().findItem(R.id.cancel_download).setVisible(true);
|
||||
|
||||
if (clickedButton != null) {
|
||||
if (type.equals("audio")) {
|
||||
clickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_music));
|
||||
} else {
|
||||
clickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_video));
|
||||
}
|
||||
}
|
||||
clickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_cancel));
|
||||
clickedButton.setTag(R.id.cancelDownload, "true");
|
||||
}
|
||||
}catch(Exception ignored){}
|
||||
}
|
||||
|
||||
public void onDownloadProgress(DownloadInfo info) {
|
||||
downloadInfo = info;
|
||||
downloading = true;
|
||||
activity.runOnUiThread(() -> {
|
||||
try{
|
||||
int progress = info.getProgress();
|
||||
int progress = downloadInfo.getProgress();
|
||||
if (progress > 0) {
|
||||
progressBar = fragmentView.findViewWithTag(info.getVideo().getVideoId()+"##progress");
|
||||
progressBar = fragmentView.findViewWithTag(downloadInfo.getVideo().getVideoId()+"##progress");
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setProgressCompat(progress, true);
|
||||
}
|
||||
|
||||
String id = downloadInfo.getVideo().getVideoId();
|
||||
String type = downloadInfo.getVideo().getDownloadedType();
|
||||
MaterialButton clickedButton = recyclerView.findViewWithTag(id + "##"+type);
|
||||
clickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_cancel));
|
||||
clickedButton.setTag(R.id.cancelDownload, "true");
|
||||
}catch(Exception ignored){}
|
||||
});
|
||||
}
|
||||
|
||||
public void onDownloadError(DownloadInfo info){
|
||||
downloadInfo = info;
|
||||
try{
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
downloading = false;
|
||||
topAppBar.getMenu().findItem(R.id.cancel_download).setVisible(false);
|
||||
|
||||
Video item = downloadInfo.getVideo();
|
||||
String id = item.getVideoId();
|
||||
String type = item.getDownloadedType();
|
||||
MaterialButton theClickedButton = recyclerView.findViewWithTag(id + "##"+type);
|
||||
if (theClickedButton != null) {
|
||||
if (type.equals("audio")) {
|
||||
theClickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_music_downloaded));
|
||||
} else {
|
||||
theClickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_video_downloaded));
|
||||
}
|
||||
theClickedButton.setTag(R.id.cancelDownload, "false");
|
||||
}
|
||||
}catch(Exception ignored){}
|
||||
}
|
||||
|
||||
public void onDownloadEnd(DownloadInfo downloadInfo) {
|
||||
public void onDownloadEnd(DownloadInfo info) {
|
||||
downloadInfo = info;
|
||||
try{
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
|
@ -146,6 +163,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
|||
} else {
|
||||
theClickedButton.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_video_downloaded));
|
||||
}
|
||||
theClickedButton.setTag(R.id.cancelDownload, "false");
|
||||
}
|
||||
|
||||
downloading = false;
|
||||
|
|
@ -180,7 +198,6 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
public HomeFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
|
@ -344,6 +361,7 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
|||
downloading = false;
|
||||
|
||||
String id = progressBar.getTag().toString().split("##progress")[0];
|
||||
progressBar.setVisibility(View.GONE);
|
||||
String type = findVideo(id).getDownloadedType();
|
||||
MaterialButton theClickedButton = recyclerView.findViewWithTag(id + "##"+type);
|
||||
|
||||
|
|
@ -568,13 +586,21 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
|||
Log.e(TAG, type);
|
||||
Video vid = resultObjects.get(position);
|
||||
vid.setDownloadedType(type);
|
||||
|
||||
downloadQueue.add(vid);
|
||||
|
||||
if (downloading) {
|
||||
Toast.makeText(context, R.string.added_to_queue, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
MaterialButton btn = recyclerView.findViewWithTag(vid.getVideoId()+"##"+type);
|
||||
if (downloading){
|
||||
try {
|
||||
if (btn.getTag(R.id.cancelDownload).equals("true")){
|
||||
mainActivity.removeItemFromDownloadQueue(vid);
|
||||
int icon = (type.equals("audio")) ? R.drawable.ic_music : R.drawable.ic_video;
|
||||
btn.setIcon(ContextCompat.getDrawable(activity, icon));
|
||||
btn.setTag(R.id.cancelDownload, "false");
|
||||
return;
|
||||
}
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
downloadQueue.add(vid);
|
||||
btn.setTag(R.id.cancelDownload, "true");
|
||||
btn.setIcon(ContextCompat.getDrawable(activity, R.drawable.ic_cancel));
|
||||
if (isStoragePermissionGranted()){
|
||||
mainActivity.startDownloadService(downloadQueue, listener);
|
||||
downloadQueue.clear();
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@ public interface IDownloaderService {
|
|||
void removeActivity(Activity activity);
|
||||
void updateQueue(ArrayList<Video> queue);
|
||||
void cancelDownload();
|
||||
void removeItemFromDownloadQueue(Video video);
|
||||
}
|
||||
|
|
|
|||
5
app/src/main/res/drawable/ic_cancel.xml
Normal file
5
app/src/main/res/drawable/ic_cancel.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="?attr/colorAccent" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>
|
||||
</vector>
|
||||
|
|
@ -19,7 +19,6 @@
|
|||
android:id="@+id/bottomNavigationView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/transparent_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
|
|
|
|||
16
app/src/main/res/layout/filter_chip.xml
Normal file
16
app/src/main/res/layout/filter_chip.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
style="@style/Widget.Material3.Chip.Filter"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:checked="true"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
112
app/src/main/res/layout/history_filter_sheet.xml
Normal file
112
app/src/main/res/layout/history_filter_sheet.xml
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout android:id="@+id/history_element_bottom_sheet"
|
||||
style="@style/Widget.Material3.BottomSheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:layout_gravity="center"
|
||||
>
|
||||
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:layout_width="wrap_content"
|
||||
app:singleLine="true"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/test1"
|
||||
style="@style/Widget.Material3.Chip.Filter"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:checked="true"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/test2"
|
||||
style="@style/Widget.Material3.Chip.Filter"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:checked="true"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/test3"
|
||||
style="@style/Widget.Material3.Chip.Filter"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:checked="true"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/test5"
|
||||
style="@style/Widget.Material3.Chip.Filter"
|
||||
android:layout_width="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:checked="true"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
</com.google.android.material.chip.ChipGroup>
|
||||
|
||||
</HorizontalScrollView>
|
||||
|
||||
<Button
|
||||
style="@style/Widget.Material3.Button.TextButton.Icon"
|
||||
android:id="@+id/bottom_sheet_link"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:layout_gravity="center"
|
||||
app:icon="@drawable/ic_link"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="right"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
|
||||
android:id="@+id/bottomsheet_remove_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
app:icon="@drawable/ic_baseline_delete_outline_24"
|
||||
android:text="@string/Remove" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.Material3.Button.TonalButton.Icon"
|
||||
android:id="@+id/bottomsheet_open_link_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/Open_Link"
|
||||
app:icon="@drawable/ic_baseline_open_in_new_24"
|
||||
android:autoLink="all"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -97,4 +97,5 @@
|
|||
<string name="update_app_summary">Njoftohu kur një përditësim është i vlefshëm</string>
|
||||
<string name="downloads">Shkarkimet</string>
|
||||
<string name="filter_history">Filtro Historinë</string>
|
||||
<string name="removed_from_queue">u hoq nga rradha!</string>
|
||||
</resources>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<string name="download_notification_channel_name">File Downloads</string>
|
||||
<string name="download_notification_channel_description">Notification that shows the download progress of audio and video files</string>
|
||||
<string name="failed_making_directory">Failed to create the new Directory! :(</string>
|
||||
<string name="added_to_queue">Item added to the Queue!</string>
|
||||
<string name="added_to_queue">Added to the Queue!</string>
|
||||
<string name="you_are_in_latest_version">You are at the latest version</string>
|
||||
<string name="ytld_update_success">Updated Succesfully</string>
|
||||
<string name="ytdl_update_failed">Failed Updating</string>
|
||||
|
|
@ -100,4 +100,6 @@
|
|||
<string name="update_app_summary">Let you know when updates are available right when you open the application</string>
|
||||
<string name="downloads">Downloads</string>
|
||||
<string name="filter_history">Filter History</string>
|
||||
<string name="removed_from_queue">removed from queue!</string>
|
||||
<item type="id" name="cancelDownload" />
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ buildscript {
|
|||
}
|
||||
|
||||
def versionMajor = 1
|
||||
def versionMinor = 2
|
||||
def versionPatch = 1
|
||||
def versionMinor = 3
|
||||
def versionPatch = 2
|
||||
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
|
||||
|
||||
ext {
|
||||
|
|
|
|||
Loading…
Reference in a new issue