2016-04-22 01:28:01 +02:00
|
|
|
package us.shandian.giga.ui.adapter;
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
import android.annotation.SuppressLint;
|
2016-04-22 01:28:01 +02:00
|
|
|
import android.app.ProgressDialog;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2020-01-05 14:01:54 +01:00
|
|
|
import android.graphics.Color;
|
2016-04-22 01:28:01 +02:00
|
|
|
import android.net.Uri;
|
2017-01-10 11:41:24 +01:00
|
|
|
import android.os.Build;
|
2018-09-23 20:12:23 +02:00
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Message;
|
2017-01-10 11:41:24 +01:00
|
|
|
import android.util.Log;
|
2018-09-23 20:12:23 +02:00
|
|
|
import android.util.SparseArray;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
import android.view.HapticFeedbackConstants;
|
2016-04-22 01:28:01 +02:00
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.webkit.MimeTypeMap;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.PopupMenu;
|
|
|
|
import android.widget.TextView;
|
2018-04-17 19:47:17 +02:00
|
|
|
import android.widget.Toast;
|
2016-04-22 01:28:01 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.StringRes;
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
|
|
|
import androidx.core.content.FileProvider;
|
|
|
|
import androidx.core.view.ViewCompat;
|
|
|
|
import androidx.recyclerview.widget.DiffUtil;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView.Adapter;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
|
|
|
|
2020-01-05 14:01:54 +01:00
|
|
|
import com.google.android.material.snackbar.Snackbar;
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
import org.schabi.newpipe.BuildConfig;
|
2017-06-28 07:27:32 +02:00
|
|
|
import org.schabi.newpipe.R;
|
2019-10-01 04:52:49 +02:00
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
import org.schabi.newpipe.report.ErrorActivity;
|
|
|
|
import org.schabi.newpipe.report.UserAction;
|
2018-09-23 20:12:23 +02:00
|
|
|
import org.schabi.newpipe.util.NavigationHelper;
|
2016-04-22 01:28:01 +02:00
|
|
|
|
2019-04-09 23:38:34 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.net.URI;
|
2018-06-11 14:44:00 +02:00
|
|
|
import java.util.ArrayList;
|
2020-08-27 22:56:58 +02:00
|
|
|
import java.util.Arrays;
|
2020-01-05 14:01:54 +01:00
|
|
|
import java.util.Iterator;
|
2016-04-22 01:28:01 +02:00
|
|
|
|
2020-10-12 09:26:16 +02:00
|
|
|
import io.reactivex.Observable;
|
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
|
import io.reactivex.disposables.CompositeDisposable;
|
|
|
|
import io.reactivex.schedulers.Schedulers;
|
2016-04-22 01:28:01 +02:00
|
|
|
import us.shandian.giga.get.DownloadMission;
|
2018-09-23 20:12:23 +02:00
|
|
|
import us.shandian.giga.get.FinishedMission;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
import us.shandian.giga.get.Mission;
|
2019-10-01 04:52:49 +02:00
|
|
|
import us.shandian.giga.get.MissionRecoveryInfo;
|
2019-04-05 19:45:39 +02:00
|
|
|
import us.shandian.giga.io.StoredFileHelper;
|
2018-09-23 20:12:23 +02:00
|
|
|
import us.shandian.giga.service.DownloadManager;
|
2016-04-22 01:28:01 +02:00
|
|
|
import us.shandian.giga.service.DownloadManagerService;
|
2018-09-23 20:12:23 +02:00
|
|
|
import us.shandian.giga.ui.common.Deleter;
|
2016-04-22 01:28:01 +02:00
|
|
|
import us.shandian.giga.ui.common.ProgressDrawable;
|
|
|
|
import us.shandian.giga.util.Utility;
|
|
|
|
|
2019-01-29 13:23:39 +01:00
|
|
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
2017-01-10 11:41:24 +01:00
|
|
|
import static android.content.Intent.FLAG_GRANT_PREFIX_URI_PERMISSION;
|
|
|
|
import static android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION;
|
2018-12-02 02:05:09 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_CONNECT_HOST;
|
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_FILE_CREATION;
|
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_HTTP_NO_CONTENT;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_INSUFFICIENT_STORAGE;
|
2018-12-02 02:05:09 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_NOTHING;
|
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_PATH_CREATION;
|
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_PERMISSION_DENIED;
|
2019-01-21 05:30:03 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_POSTPROCESSING;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_POSTPROCESSING_HOLD;
|
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_POSTPROCESSING_STOPPED;
|
2019-04-05 19:45:39 +02:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_PROGRESS_LOST;
|
2019-09-28 23:11:05 +02:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_RESOURCE_GONE;
|
2018-12-02 02:05:09 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_SSL_EXCEPTION;
|
2019-04-17 23:17:24 +02:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_TIMEOUT;
|
2018-12-02 02:05:09 +01:00
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_UNKNOWN_EXCEPTION;
|
|
|
|
import static us.shandian.giga.get.DownloadMission.ERROR_UNKNOWN_HOST;
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2019-09-01 23:17:54 +02:00
|
|
|
public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callback {
|
2018-09-23 20:12:23 +02:00
|
|
|
private static final SparseArray<String> ALGORITHMS = new SparseArray<>();
|
2017-06-28 07:27:32 +02:00
|
|
|
private static final String TAG = "MissionAdapter";
|
2019-01-21 05:30:03 +01:00
|
|
|
private static final String UNDEFINED_PROGRESS = "--.-%";
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
private static final String DEFAULT_MIME_TYPE = "*/*";
|
2019-10-10 04:49:23 +02:00
|
|
|
private static final String UNDEFINED_ETA = "--:--";
|
2019-01-21 05:30:03 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
|
|
|
|
static {
|
|
|
|
ALGORITHMS.put(R.id.md5, "MD5");
|
|
|
|
ALGORITHMS.put(R.id.sha1, "SHA1");
|
|
|
|
}
|
|
|
|
|
2020-11-18 23:50:00 +01:00
|
|
|
private final Context mContext;
|
|
|
|
private final LayoutInflater mInflater;
|
|
|
|
private final DownloadManager mDownloadManager;
|
|
|
|
private final Deleter mDeleter;
|
2017-06-28 07:27:32 +02:00
|
|
|
private int mLayout;
|
2020-11-18 23:50:00 +01:00
|
|
|
private final DownloadManager.MissionIterator mIterator;
|
|
|
|
private final ArrayList<ViewHolderItem> mPendingDownloadsItems = new ArrayList<>();
|
|
|
|
private final Handler mHandler;
|
2018-09-23 20:12:23 +02:00
|
|
|
private MenuItem mClear;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
private MenuItem mStartButton;
|
|
|
|
private MenuItem mPauseButton;
|
2020-11-18 23:50:00 +01:00
|
|
|
private final View mEmptyMessage;
|
2019-04-05 19:45:39 +02:00
|
|
|
private RecoverHelper mRecover;
|
2020-11-18 23:50:00 +01:00
|
|
|
private final View mView;
|
|
|
|
private final ArrayList<Mission> mHidden;
|
2020-01-05 14:01:54 +01:00
|
|
|
private Snackbar mSnackbar;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
private final Runnable rUpdater = this::updater;
|
2020-01-05 14:01:54 +01:00
|
|
|
private final Runnable rDelete = this::deleteFinishedDownloads;
|
2019-10-10 04:49:23 +02:00
|
|
|
|
2020-10-12 09:26:16 +02:00
|
|
|
private final CompositeDisposable compositeDisposable = new CompositeDisposable();
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
public MissionAdapter(Context context, @NonNull DownloadManager downloadManager, View emptyMessage, View root) {
|
2017-06-28 07:27:32 +02:00
|
|
|
mContext = context;
|
2018-06-11 14:44:00 +02:00
|
|
|
mDownloadManager = downloadManager;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2020-10-31 20:54:19 +01:00
|
|
|
mInflater = LayoutInflater.from(mContext);
|
2018-09-23 20:12:23 +02:00
|
|
|
mLayout = R.layout.mission_item;
|
2018-06-11 14:44:00 +02:00
|
|
|
|
2019-09-01 23:17:54 +02:00
|
|
|
mHandler = new Handler(context.getMainLooper());
|
2018-06-11 14:44:00 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
mEmptyMessage = emptyMessage;
|
2018-06-11 14:44:00 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
mIterator = downloadManager.getIterator();
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
mDeleter = new Deleter(root, mContext, this, mDownloadManager, mIterator, mHandler);
|
|
|
|
|
2020-01-05 14:01:54 +01:00
|
|
|
mView = root;
|
|
|
|
|
|
|
|
mHidden = new ArrayList<>();
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
checkEmptyMessageVisibility();
|
2019-10-10 04:49:23 +02:00
|
|
|
onResume();
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-23 20:12:23 +02:00
|
|
|
@NonNull
|
|
|
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
|
|
switch (viewType) {
|
|
|
|
case DownloadManager.SPECIAL_PENDING:
|
|
|
|
case DownloadManager.SPECIAL_FINISHED:
|
|
|
|
return new ViewHolderHeader(mInflater.inflate(R.layout.missions_header, parent, false));
|
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
return new ViewHolderItem(mInflater.inflate(mLayout, parent, false));
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-23 20:12:23 +02:00
|
|
|
public void onViewRecycled(@NonNull ViewHolder view) {
|
|
|
|
super.onViewRecycled(view);
|
|
|
|
|
|
|
|
if (view instanceof ViewHolderHeader) return;
|
|
|
|
ViewHolderItem h = (ViewHolderItem) view;
|
|
|
|
|
2018-11-26 04:20:25 +01:00
|
|
|
if (h.item.mission instanceof DownloadMission) {
|
|
|
|
mPendingDownloadsItems.remove(h);
|
2019-04-05 19:45:39 +02:00
|
|
|
if (mPendingDownloadsItems.size() < 1) {
|
2019-08-01 23:58:25 +02:00
|
|
|
checkMasterButtonsVisibility();
|
2019-04-05 19:45:39 +02:00
|
|
|
}
|
2018-11-26 04:20:25 +01:00
|
|
|
}
|
2018-09-23 20:12:23 +02:00
|
|
|
|
|
|
|
h.popupMenu.dismiss();
|
|
|
|
h.item = null;
|
2019-10-10 04:49:23 +02:00
|
|
|
h.resetSpeedMeasure();
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-23 20:12:23 +02:00
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
|
public void onBindViewHolder(@NonNull ViewHolder view, @SuppressLint("RecyclerView") int pos) {
|
|
|
|
DownloadManager.MissionItem item = mIterator.getItem(pos);
|
|
|
|
|
|
|
|
if (view instanceof ViewHolderHeader) {
|
|
|
|
if (item.special == DownloadManager.SPECIAL_NOTHING) return;
|
|
|
|
int str;
|
|
|
|
if (item.special == DownloadManager.SPECIAL_PENDING) {
|
|
|
|
str = R.string.missions_header_pending;
|
|
|
|
} else {
|
|
|
|
str = R.string.missions_header_finished;
|
2019-01-25 03:23:30 +01:00
|
|
|
if (mClear != null) mClear.setVisible(true);
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
((ViewHolderHeader) view).header.setText(str);
|
|
|
|
return;
|
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
ViewHolderItem h = (ViewHolderItem) view;
|
|
|
|
h.item = item;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-04-05 19:45:39 +02:00
|
|
|
Utility.FileType type = Utility.getFileType(item.mission.kind, item.mission.storage.getName());
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
h.icon.setImageResource(Utility.getIconForFileType(type));
|
2019-04-05 19:45:39 +02:00
|
|
|
h.name.setText(item.mission.storage.getName());
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
h.progress.setColors(Utility.getBackgroundForFileType(mContext, type), Utility.getForegroundForFileType(mContext, type));
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
if (h.item.mission instanceof DownloadMission) {
|
|
|
|
DownloadMission mission = (DownloadMission) item.mission;
|
2018-12-02 02:05:09 +01:00
|
|
|
String length = Utility.formatBytes(mission.getLength());
|
2019-01-21 05:30:03 +01:00
|
|
|
if (mission.running && !mission.isPsRunning()) length += " --.- kB/s";
|
2018-12-02 02:05:09 +01:00
|
|
|
|
|
|
|
h.size.setText(length);
|
2018-09-23 20:12:23 +02:00
|
|
|
h.pause.setTitle(mission.unknownLength ? R.string.stop : R.string.pause);
|
2018-12-02 02:05:09 +01:00
|
|
|
updateProgress(h);
|
2018-09-23 20:12:23 +02:00
|
|
|
mPendingDownloadsItems.add(h);
|
|
|
|
} else {
|
|
|
|
h.progress.setMarquee(false);
|
|
|
|
h.status.setText("100%");
|
2020-06-27 05:25:50 +02:00
|
|
|
h.progress.setProgress(1.0f);
|
2018-12-02 02:05:09 +01:00
|
|
|
h.size.setText(Utility.formatBytes(item.mission.length));
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getItemCount() {
|
2018-09-23 20:12:23 +02:00
|
|
|
return mIterator.getOldListSize();
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-09-23 20:12:23 +02:00
|
|
|
public int getItemViewType(int position) {
|
|
|
|
return mIterator.getSpecialAtItem(position);
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2018-11-24 04:14:37 +01:00
|
|
|
@SuppressLint("DefaultLocale")
|
2018-09-23 20:12:23 +02:00
|
|
|
private void updateProgress(ViewHolderItem h) {
|
|
|
|
if (h == null || h.item == null || h.item.mission instanceof FinishedMission) return;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-11-26 04:20:25 +01:00
|
|
|
DownloadMission mission = (DownloadMission) h.item.mission;
|
2019-10-10 04:49:23 +02:00
|
|
|
double done = mission.done;
|
|
|
|
long length = mission.getLength();
|
|
|
|
long now = System.currentTimeMillis();
|
2018-12-02 02:05:09 +01:00
|
|
|
boolean hasError = mission.errCode != ERROR_NOTHING;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
// hide on error
|
|
|
|
// show if current resource length is not fetched
|
|
|
|
// show if length is unknown
|
2019-10-01 04:52:49 +02:00
|
|
|
h.progress.setMarquee(mission.isRecovering() || !hasError && (!mission.isInitialized() || mission.unknownLength));
|
2018-09-23 20:12:23 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
double progress;
|
2018-11-26 04:20:25 +01:00
|
|
|
if (mission.unknownLength) {
|
2019-10-10 04:49:23 +02:00
|
|
|
progress = Double.NaN;
|
2020-06-27 05:25:50 +02:00
|
|
|
h.progress.setProgress(0.0f);
|
2018-11-26 04:20:25 +01:00
|
|
|
} else {
|
2019-10-10 04:49:23 +02:00
|
|
|
progress = done / length;
|
2018-11-26 04:20:25 +01:00
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-11-26 04:20:25 +01:00
|
|
|
if (hasError) {
|
2019-10-10 04:49:23 +02:00
|
|
|
h.progress.setProgress(isNotFinite(progress) ? 1d : progress);
|
2018-11-26 04:20:25 +01:00
|
|
|
h.status.setText(R.string.msg_error);
|
2019-01-21 05:30:03 +01:00
|
|
|
} else if (isNotFinite(progress)) {
|
|
|
|
h.status.setText(UNDEFINED_PROGRESS);
|
2018-11-26 04:20:25 +01:00
|
|
|
} else {
|
|
|
|
h.status.setText(String.format("%.2f%%", progress * 100));
|
|
|
|
h.progress.setProgress(progress);
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
@StringRes int state;
|
|
|
|
String sizeStr = Utility.formatBytes(length).concat(" ");
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-04-05 19:45:39 +02:00
|
|
|
if (mission.isPsFailed() || mission.errCode == ERROR_POSTPROCESSING_HOLD) {
|
2019-10-10 04:49:23 +02:00
|
|
|
h.size.setText(sizeStr);
|
|
|
|
return;
|
2018-12-02 02:05:09 +01:00
|
|
|
} else if (!mission.running) {
|
2019-10-10 04:49:23 +02:00
|
|
|
state = mission.enqueued ? R.string.queued : R.string.paused;
|
2019-01-21 05:30:03 +01:00
|
|
|
} else if (mission.isPsRunning()) {
|
2019-10-10 04:49:23 +02:00
|
|
|
state = R.string.post_processing;
|
|
|
|
} else if (mission.isRecovering()) {
|
|
|
|
state = R.string.recovering;
|
2018-11-26 04:20:25 +01:00
|
|
|
} else {
|
|
|
|
state = 0;
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
if (state != 0) {
|
2018-11-26 04:20:25 +01:00
|
|
|
// update state without download speed
|
2019-10-10 04:49:23 +02:00
|
|
|
h.size.setText(sizeStr.concat("(").concat(mContext.getString(state)).concat(")"));
|
|
|
|
h.resetSpeedMeasure();
|
|
|
|
return;
|
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
if (h.lastTimestamp < 0) {
|
|
|
|
h.size.setText(sizeStr);
|
|
|
|
h.lastTimestamp = now;
|
|
|
|
h.lastDone = done;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
long deltaTime = now - h.lastTimestamp;
|
|
|
|
double deltaDone = done - h.lastDone;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
if (h.lastDone > done) {
|
|
|
|
h.lastDone = done;
|
|
|
|
h.size.setText(sizeStr);
|
2018-09-23 20:12:23 +02:00
|
|
|
return;
|
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-11-26 04:20:25 +01:00
|
|
|
if (deltaDone > 0 && deltaTime > 0) {
|
2019-10-10 04:49:23 +02:00
|
|
|
float speed = (float) ((deltaDone * 1000d) / deltaTime);
|
|
|
|
float averageSpeed = speed;
|
2018-11-20 23:10:50 +01:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
if (h.lastSpeedIdx < 0) {
|
2020-08-27 22:56:58 +02:00
|
|
|
Arrays.fill(h.lastSpeed, speed);
|
2019-10-10 04:49:23 +02:00
|
|
|
h.lastSpeedIdx = 0;
|
|
|
|
} else {
|
|
|
|
for (int i = 0; i < h.lastSpeed.length; i++) {
|
|
|
|
averageSpeed += h.lastSpeed[i];
|
|
|
|
}
|
2020-06-27 05:25:50 +02:00
|
|
|
averageSpeed /= h.lastSpeed.length + 1.0f;
|
2019-10-10 04:49:23 +02:00
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
String speedStr = Utility.formatSpeed(averageSpeed);
|
|
|
|
String etaStr;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
if (mission.unknownLength) {
|
|
|
|
etaStr = "";
|
|
|
|
} else {
|
|
|
|
long eta = (long) Math.ceil((length - done) / averageSpeed);
|
2019-11-26 17:41:16 +01:00
|
|
|
etaStr = Utility.formatBytes((long) done) + "/" + Utility.stringifySeconds(eta) + " ";
|
2019-10-10 04:49:23 +02:00
|
|
|
}
|
|
|
|
|
2019-11-26 17:41:16 +01:00
|
|
|
h.size.setText(sizeStr.concat(etaStr).concat(speedStr));
|
2019-10-10 04:49:23 +02:00
|
|
|
|
|
|
|
h.lastTimestamp = now;
|
|
|
|
h.lastDone = done;
|
|
|
|
h.lastSpeed[h.lastSpeedIdx++] = speed;
|
|
|
|
|
|
|
|
if (h.lastSpeedIdx >= h.lastSpeed.length) h.lastSpeedIdx = 0;
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
private void viewWithFileProvider(Mission mission) {
|
|
|
|
if (checkInvalidFile(mission)) return;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
String mimeType = resolveMimeType(mission);
|
2018-09-23 20:12:23 +02:00
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
if (BuildConfig.DEBUG)
|
|
|
|
Log.v(TAG, "Mime: " + mimeType + " package: " + BuildConfig.APPLICATION_ID + ".provider");
|
2018-09-23 20:12:23 +02:00
|
|
|
|
2020-02-03 10:35:50 +01:00
|
|
|
Uri uri = resolveShareableUri(mission);
|
2018-11-20 23:10:50 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setAction(Intent.ACTION_VIEW);
|
2018-09-23 20:12:23 +02:00
|
|
|
intent.setDataAndType(uri, mimeType);
|
2017-06-28 07:27:32 +02:00
|
|
|
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
|
intent.addFlags(FLAG_GRANT_PREFIX_URI_PERMISSION);
|
|
|
|
}
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
2019-01-29 13:23:39 +01:00
|
|
|
intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
}
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
//mContext.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
2018-04-17 19:47:17 +02:00
|
|
|
if (intent.resolveActivity(mContext.getPackageManager()) != null) {
|
|
|
|
mContext.startActivity(intent);
|
|
|
|
} else {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
Toast.makeText(mContext, R.string.toast_no_player, Toast.LENGTH_LONG).show();
|
2018-04-17 19:47:17 +02:00
|
|
|
}
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void shareFile(Mission mission) {
|
|
|
|
if (checkInvalidFile(mission)) return;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
|
|
intent.setType(resolveMimeType(mission));
|
2020-02-03 10:35:50 +01:00
|
|
|
intent.putExtra(Intent.EXTRA_STREAM, resolveShareableUri(mission));
|
|
|
|
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
|
|
|
mContext.startActivity(Intent.createChooser(intent, null));
|
|
|
|
}
|
|
|
|
|
2020-02-03 10:35:50 +01:00
|
|
|
/**
|
|
|
|
* Returns an Uri which can be shared to other applications.
|
|
|
|
*
|
|
|
|
* @see <a href="https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed">
|
|
|
|
* https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed</a>
|
|
|
|
*/
|
|
|
|
private Uri resolveShareableUri(Mission mission) {
|
|
|
|
if (mission.storage.isDirect()) {
|
|
|
|
return FileProvider.getUriForFile(
|
|
|
|
mContext,
|
|
|
|
BuildConfig.APPLICATION_ID + ".provider",
|
|
|
|
new File(URI.create(mission.storage.getUri().toString()))
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return mission.storage.getUri();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
private static String resolveMimeType(@NonNull Mission mission) {
|
2019-04-09 23:38:34 +02:00
|
|
|
String mimeType;
|
|
|
|
|
|
|
|
if (!mission.storage.isInvalid()) {
|
|
|
|
mimeType = mission.storage.getType();
|
|
|
|
if (mimeType != null && mimeType.length() > 0 && !mimeType.equals(StoredFileHelper.DEFAULT_MIME))
|
|
|
|
return mimeType;
|
|
|
|
}
|
|
|
|
|
2019-04-05 19:45:39 +02:00
|
|
|
String ext = Utility.getFileExt(mission.storage.getName());
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
if (ext == null) return DEFAULT_MIME_TYPE;
|
|
|
|
|
2019-04-09 23:38:34 +02:00
|
|
|
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.substring(1));
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
|
|
|
return mimeType == null ? DEFAULT_MIME_TYPE : mimeType;
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean checkInvalidFile(@NonNull Mission mission) {
|
2019-04-05 19:45:39 +02:00
|
|
|
if (mission.storage.existsAsFile()) return false;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
|
|
|
Toast.makeText(mContext, R.string.missing_file, Toast.LENGTH_SHORT).show();
|
2018-09-23 20:12:23 +02:00
|
|
|
return true;
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
private ViewHolderItem getViewHolder(Object mission) {
|
|
|
|
for (ViewHolderItem h : mPendingDownloadsItems) {
|
|
|
|
if (h.item.mission == mission) return h;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-09-01 23:17:54 +02:00
|
|
|
@Override
|
|
|
|
public boolean handleMessage(@NonNull Message msg) {
|
|
|
|
if (mStartButton != null && mPauseButton != null) {
|
|
|
|
checkMasterButtonsVisibility();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (msg.what) {
|
|
|
|
case DownloadManagerService.MESSAGE_ERROR:
|
|
|
|
case DownloadManagerService.MESSAGE_FINISHED:
|
2019-10-10 04:49:23 +02:00
|
|
|
case DownloadManagerService.MESSAGE_DELETED:
|
|
|
|
case DownloadManagerService.MESSAGE_PAUSED:
|
2019-09-01 23:17:54 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2018-09-23 20:12:23 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
ViewHolderItem h = getViewHolder(msg.obj);
|
|
|
|
if (h == null) return false;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
switch (msg.what) {
|
|
|
|
case DownloadManagerService.MESSAGE_FINISHED:
|
|
|
|
case DownloadManagerService.MESSAGE_DELETED:
|
2018-09-23 20:12:23 +02:00
|
|
|
// DownloadManager should mark the download as finished
|
|
|
|
applyChanges();
|
2019-09-01 23:17:54 +02:00
|
|
|
return true;
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
2019-09-01 23:17:54 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
updateProgress(h);
|
|
|
|
return true;
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
private void showError(@NonNull DownloadMission mission) {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
@StringRes int msg = R.string.general_error;
|
|
|
|
String msgEx = null;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
|
|
|
switch (mission.errCode) {
|
|
|
|
case 416:
|
2019-09-28 23:11:05 +02:00
|
|
|
msg = R.string.error_http_unsupported_range;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
|
|
|
case 404:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_http_not_found;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_NOTHING:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
return;// this never should happen
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_FILE_CREATION:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_file_creation;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_HTTP_NO_CONTENT:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_http_no_content;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_PATH_CREATION:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_path_creation;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_PERMISSION_DENIED:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.permission_denied;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_SSL_EXCEPTION:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_ssl_exception;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_UNKNOWN_HOST:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_unknown_host;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2018-12-02 02:05:09 +01:00
|
|
|
case ERROR_CONNECT_HOST:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msg = R.string.error_connect_host;
|
|
|
|
break;
|
|
|
|
case ERROR_POSTPROCESSING_STOPPED:
|
|
|
|
msg = R.string.error_postprocessing_stopped;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
2019-01-21 05:30:03 +01:00
|
|
|
case ERROR_POSTPROCESSING:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
case ERROR_POSTPROCESSING_HOLD:
|
2019-10-01 04:52:49 +02:00
|
|
|
showError(mission, UserAction.DOWNLOAD_POSTPROCESSING, R.string.error_postprocessing_failed);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
return;
|
|
|
|
case ERROR_INSUFFICIENT_STORAGE:
|
|
|
|
msg = R.string.error_insufficient_storage;
|
2018-09-23 20:12:23 +02:00
|
|
|
break;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
case ERROR_UNKNOWN_EXCEPTION:
|
2019-10-10 04:49:23 +02:00
|
|
|
if (mission.errObject != null) {
|
|
|
|
showError(mission, UserAction.DOWNLOAD_FAILED, R.string.general_error);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
msg = R.string.msg_error;
|
|
|
|
break;
|
|
|
|
}
|
2019-04-05 19:45:39 +02:00
|
|
|
case ERROR_PROGRESS_LOST:
|
|
|
|
msg = R.string.error_progress_lost;
|
2019-04-09 23:38:34 +02:00
|
|
|
break;
|
2019-04-17 23:17:24 +02:00
|
|
|
case ERROR_TIMEOUT:
|
|
|
|
msg = R.string.error_timeout;
|
|
|
|
break;
|
2019-09-28 23:11:05 +02:00
|
|
|
case ERROR_RESOURCE_GONE:
|
|
|
|
msg = R.string.error_download_resource_gone;
|
|
|
|
break;
|
2018-09-23 20:12:23 +02:00
|
|
|
default:
|
|
|
|
if (mission.errCode >= 100 && mission.errCode < 600) {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msgEx = "HTTP " + mission.errCode;
|
2018-09-23 20:12:23 +02:00
|
|
|
} else if (mission.errObject == null) {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
msgEx = "(not_decelerated_error_code)";
|
|
|
|
} else {
|
2019-10-01 04:52:49 +02:00
|
|
|
showError(mission, UserAction.DOWNLOAD_FAILED, msg);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
return;
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
|
|
|
|
|
|
|
if (msgEx != null)
|
|
|
|
builder.setMessage(msgEx);
|
|
|
|
else
|
|
|
|
builder.setMessage(msg);
|
|
|
|
|
|
|
|
// add report button for non-HTTP errors (range 100-599)
|
|
|
|
if (mission.errObject != null && (mission.errCode < 100 || mission.errCode >= 600)) {
|
|
|
|
@StringRes final int mMsg = msg;
|
|
|
|
builder.setPositiveButton(R.string.error_report_title, (dialog, which) ->
|
2019-10-01 04:52:49 +02:00
|
|
|
showError(mission, UserAction.DOWNLOAD_FAILED, mMsg)
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
);
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2020-01-31 22:49:43 +01:00
|
|
|
builder.setNegativeButton(R.string.finish, (dialog, which) -> dialog.cancel())
|
2019-04-05 19:45:39 +02:00
|
|
|
.setTitle(mission.storage.getName())
|
2018-09-23 20:12:23 +02:00
|
|
|
.create()
|
|
|
|
.show();
|
|
|
|
}
|
|
|
|
|
2019-10-01 04:52:49 +02:00
|
|
|
private void showError(DownloadMission mission, UserAction action, @StringRes int reason) {
|
|
|
|
StringBuilder request = new StringBuilder(256);
|
|
|
|
request.append(mission.source);
|
|
|
|
|
|
|
|
request.append(" [");
|
|
|
|
if (mission.recoveryInfo != null) {
|
|
|
|
for (MissionRecoveryInfo recovery : mission.recoveryInfo)
|
2019-10-10 04:49:23 +02:00
|
|
|
request.append(' ')
|
|
|
|
.append(recovery.toString())
|
|
|
|
.append(' ');
|
2019-10-01 04:52:49 +02:00
|
|
|
}
|
|
|
|
request.append("]");
|
|
|
|
|
|
|
|
String service;
|
|
|
|
try {
|
|
|
|
service = NewPipe.getServiceByUrl(mission.source).getServiceInfo().getName();
|
|
|
|
} catch (Exception e) {
|
|
|
|
service = "-";
|
|
|
|
}
|
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
ErrorActivity.reportError(
|
|
|
|
mContext,
|
2019-10-01 04:52:49 +02:00
|
|
|
mission.errObject,
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
null,
|
|
|
|
null,
|
2019-10-01 04:52:49 +02:00
|
|
|
ErrorActivity.ErrorInfo.make(action, service, request.toString(), reason)
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-10-11 15:07:51 +02:00
|
|
|
public void clearFinishedDownloads(boolean delete) {
|
2020-01-05 14:01:54 +01:00
|
|
|
if (delete && mIterator.hasFinishedMissions() && mHidden.isEmpty()) {
|
2019-12-11 15:56:04 +01:00
|
|
|
for (int i = 0; i < mIterator.getOldListSize(); i++) {
|
2019-10-11 15:07:51 +02:00
|
|
|
FinishedMission mission = mIterator.getItem(i).mission instanceof FinishedMission ? (FinishedMission) mIterator.getItem(i).mission : null;
|
|
|
|
if (mission != null) {
|
2020-01-05 14:01:54 +01:00
|
|
|
mIterator.hide(mission);
|
|
|
|
mHidden.add(mission);
|
2019-10-11 15:07:51 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-05 14:01:54 +01:00
|
|
|
applyChanges();
|
|
|
|
|
2020-01-13 20:25:32 +01:00
|
|
|
String msg = String.format(mContext.getString(R.string.deleted_downloads), mHidden.size());
|
2020-01-05 14:01:54 +01:00
|
|
|
mSnackbar = Snackbar.make(mView, msg, Snackbar.LENGTH_INDEFINITE);
|
|
|
|
mSnackbar.setAction(R.string.undo, s -> {
|
|
|
|
Iterator<Mission> i = mHidden.iterator();
|
|
|
|
while (i.hasNext()) {
|
|
|
|
mIterator.unHide(i.next());
|
|
|
|
i.remove();
|
|
|
|
}
|
|
|
|
applyChanges();
|
|
|
|
mHandler.removeCallbacks(rDelete);
|
|
|
|
});
|
|
|
|
mSnackbar.setActionTextColor(Color.YELLOW);
|
|
|
|
mSnackbar.show();
|
|
|
|
|
2020-01-11 15:19:24 +01:00
|
|
|
mHandler.postDelayed(rDelete, 5000);
|
2019-10-11 16:36:47 +02:00
|
|
|
} else if (!delete) {
|
|
|
|
mDownloadManager.forgetFinishedDownloads();
|
2020-01-05 14:01:54 +01:00
|
|
|
applyChanges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void deleteFinishedDownloads() {
|
2020-01-11 15:19:24 +01:00
|
|
|
if (mSnackbar != null) mSnackbar.dismiss();
|
2020-01-05 14:01:54 +01:00
|
|
|
|
|
|
|
Iterator<Mission> i = mHidden.iterator();
|
|
|
|
while (i.hasNext()) {
|
|
|
|
Mission mission = i.next();
|
|
|
|
if (mission != null) {
|
|
|
|
mDownloadManager.deleteMission(mission);
|
|
|
|
mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, mission.storage.getUri()));
|
|
|
|
}
|
|
|
|
i.remove();
|
2019-10-11 15:07:51 +02:00
|
|
|
}
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private boolean handlePopupItem(@NonNull ViewHolderItem h, @NonNull MenuItem option) {
|
2019-07-03 02:07:21 +02:00
|
|
|
if (h.item == null) return true;
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
int id = option.getItemId();
|
|
|
|
DownloadMission mission = h.item.mission instanceof DownloadMission ? (DownloadMission) h.item.mission : null;
|
|
|
|
|
|
|
|
if (mission != null) {
|
|
|
|
switch (id) {
|
|
|
|
case R.id.start:
|
2019-01-21 05:30:03 +01:00
|
|
|
h.status.setText(UNDEFINED_PROGRESS);
|
2018-09-23 20:12:23 +02:00
|
|
|
mDownloadManager.resumeMission(mission);
|
|
|
|
return true;
|
|
|
|
case R.id.pause:
|
|
|
|
mDownloadManager.pauseMission(mission);
|
|
|
|
return true;
|
|
|
|
case R.id.error_message_view:
|
|
|
|
showError(mission);
|
|
|
|
return true;
|
|
|
|
case R.id.queue:
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
boolean flag = !h.queue.isChecked();
|
|
|
|
h.queue.setChecked(flag);
|
|
|
|
mission.setEnqueued(flag);
|
2018-09-23 20:12:23 +02:00
|
|
|
updateProgress(h);
|
|
|
|
return true;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
case R.id.retry:
|
2019-09-01 23:17:54 +02:00
|
|
|
if (mission.isPsRunning()) {
|
|
|
|
mission.psContinue(true);
|
|
|
|
} else {
|
2019-04-09 23:38:34 +02:00
|
|
|
mDownloadManager.tryRecover(mission);
|
|
|
|
if (mission.storage.isInvalid())
|
|
|
|
mRecover.tryRecover(mission);
|
|
|
|
else
|
|
|
|
recoverMission(mission);
|
2019-04-05 19:45:39 +02:00
|
|
|
}
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
return true;
|
|
|
|
case R.id.cancel:
|
|
|
|
mission.psContinue(false);
|
|
|
|
return false;
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
switch (id) {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
case R.id.menu_item_share:
|
|
|
|
shareFile(h.item.mission);
|
|
|
|
return true;
|
2018-09-23 20:12:23 +02:00
|
|
|
case R.id.delete:
|
2019-10-10 04:49:23 +02:00
|
|
|
mDeleter.append(h.item.mission);
|
2018-09-23 20:12:23 +02:00
|
|
|
applyChanges();
|
2019-10-10 04:49:23 +02:00
|
|
|
checkMasterButtonsVisibility();
|
2018-09-23 20:12:23 +02:00
|
|
|
return true;
|
|
|
|
case R.id.md5:
|
|
|
|
case R.id.sha1:
|
2020-10-12 09:26:16 +02:00
|
|
|
ProgressDialog progressDialog = null;
|
|
|
|
if (mContext != null) {
|
|
|
|
// Create dialog
|
|
|
|
progressDialog = new ProgressDialog(mContext);
|
|
|
|
progressDialog.setCancelable(false);
|
|
|
|
progressDialog.setMessage(mContext.getString(R.string.msg_wait));
|
|
|
|
progressDialog.show();
|
|
|
|
}
|
|
|
|
final ProgressDialog finalProgressDialog = progressDialog;
|
|
|
|
final StoredFileHelper storage = h.item.mission.storage;
|
|
|
|
compositeDisposable.add(
|
|
|
|
Observable.fromCallable(() -> Utility.checksum(storage, ALGORITHMS.get(id)))
|
|
|
|
.subscribeOn(Schedulers.computation())
|
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
|
.subscribe(result -> {
|
|
|
|
if (finalProgressDialog != null) {
|
|
|
|
Utility.copyToClipboard(finalProgressDialog.getContext(),
|
|
|
|
result);
|
|
|
|
if (mContext != null) {
|
|
|
|
finalProgressDialog.dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
2018-09-23 20:12:23 +02:00
|
|
|
return true;
|
|
|
|
case R.id.source:
|
2018-11-20 23:10:50 +01:00
|
|
|
/*Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(h.item.mission.source));
|
|
|
|
mContext.startActivity(intent);*/
|
2018-09-23 20:12:23 +02:00
|
|
|
try {
|
|
|
|
Intent intent = NavigationHelper.getIntentByLink(mContext, h.item.mission.source);
|
2018-11-20 23:10:50 +01:00
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
|
2018-09-23 20:12:23 +02:00
|
|
|
mContext.startActivity(intent);
|
|
|
|
} catch (Exception e) {
|
|
|
|
Log.w(TAG, "Selected item has a invalid source", e);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void applyChanges() {
|
|
|
|
mIterator.start();
|
|
|
|
DiffUtil.calculateDiff(mIterator, true).dispatchUpdatesTo(this);
|
|
|
|
mIterator.end();
|
|
|
|
|
|
|
|
checkEmptyMessageVisibility();
|
2019-01-25 03:23:30 +01:00
|
|
|
if (mClear != null) mClear.setVisible(mIterator.hasFinishedMissions());
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void forceUpdate() {
|
|
|
|
mIterator.start();
|
|
|
|
mIterator.end();
|
|
|
|
|
2018-11-24 04:14:37 +01:00
|
|
|
for (ViewHolderItem item : mPendingDownloadsItems) {
|
2019-10-10 04:49:23 +02:00
|
|
|
item.resetSpeedMeasure();
|
2018-11-20 23:10:50 +01:00
|
|
|
}
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLinear(boolean isLinear) {
|
|
|
|
mLayout = isLinear ? R.layout.mission_item_linear : R.layout.mission_item;
|
|
|
|
}
|
|
|
|
|
2018-11-20 23:10:50 +01:00
|
|
|
public void setClearButton(MenuItem clearButton) {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
if (mClear == null)
|
|
|
|
clearButton.setVisible(mIterator.hasFinishedMissions());
|
|
|
|
|
2018-11-20 23:10:50 +01:00
|
|
|
mClear = clearButton;
|
|
|
|
}
|
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
public void setMasterButtons(MenuItem startButton, MenuItem pauseButton) {
|
|
|
|
boolean init = mStartButton == null || mPauseButton == null;
|
|
|
|
|
|
|
|
mStartButton = startButton;
|
|
|
|
mPauseButton = pauseButton;
|
|
|
|
|
|
|
|
if (init) checkMasterButtonsVisibility();
|
|
|
|
}
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
private void checkEmptyMessageVisibility() {
|
|
|
|
int flag = mIterator.getOldListSize() > 0 ? View.GONE : View.VISIBLE;
|
|
|
|
if (mEmptyMessage.getVisibility() != flag) mEmptyMessage.setVisibility(flag);
|
|
|
|
}
|
|
|
|
|
2019-08-01 23:58:25 +02:00
|
|
|
public void checkMasterButtonsVisibility() {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
boolean[] state = mIterator.hasValidPendingMissions();
|
2019-10-10 04:49:23 +02:00
|
|
|
Log.d(TAG, "checkMasterButtonsVisibility() running=" + state[0] + " paused=" + state[1]);
|
2019-09-01 23:17:54 +02:00
|
|
|
setButtonVisible(mPauseButton, state[0]);
|
|
|
|
setButtonVisible(mStartButton, state[1]);
|
|
|
|
}
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
|
2019-09-01 23:17:54 +02:00
|
|
|
private static void setButtonVisible(MenuItem button, boolean visible) {
|
|
|
|
if (button.isVisible() != visible)
|
|
|
|
button.setVisible(visible);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
public void refreshMissionItems() {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
for (ViewHolderItem h : mPendingDownloadsItems) {
|
|
|
|
if (((DownloadMission) h.item.mission).running) continue;
|
|
|
|
updateProgress(h);
|
2019-10-10 04:49:23 +02:00
|
|
|
h.resetSpeedMeasure();
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
public void onDestroy() {
|
2020-10-12 09:26:16 +02:00
|
|
|
compositeDisposable.dispose();
|
2019-10-10 04:49:23 +02:00
|
|
|
mDeleter.dispose();
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
public void onResume() {
|
|
|
|
mDeleter.resume();
|
|
|
|
mHandler.post(rUpdater);
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
public void onPaused() {
|
|
|
|
mDeleter.pause();
|
|
|
|
mHandler.removeCallbacks(rUpdater);
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
2019-04-05 19:45:39 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
public void recoverMission(DownloadMission mission) {
|
|
|
|
ViewHolderItem h = getViewHolder(mission);
|
|
|
|
if (h == null) return;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
mission.errObject = null;
|
|
|
|
mission.resetState(true, false, DownloadMission.ERROR_NOTHING);
|
2018-11-26 04:20:25 +01:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
h.status.setText(UNDEFINED_PROGRESS);
|
|
|
|
h.size.setText(Utility.formatBytes(mission.getLength()));
|
|
|
|
h.progress.setMarquee(true);
|
2018-11-26 04:20:25 +01:00
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
mDownloadManager.resumeMission(mission);
|
2018-11-26 04:20:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updater() {
|
|
|
|
for (ViewHolderItem h : mPendingDownloadsItems) {
|
|
|
|
// check if the mission is running first
|
|
|
|
if (!((DownloadMission) h.item.mission).running) continue;
|
|
|
|
|
|
|
|
updateProgress(h);
|
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
mHandler.postDelayed(rUpdater, 1000);
|
2018-11-26 04:20:25 +01:00
|
|
|
}
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
private boolean isNotFinite(double value) {
|
|
|
|
return Double.isNaN(value) || Double.isInfinite(value);
|
2019-01-21 05:30:03 +01:00
|
|
|
}
|
|
|
|
|
2019-04-05 19:45:39 +02:00
|
|
|
public void setRecover(@NonNull RecoverHelper callback) {
|
|
|
|
mRecover = callback;
|
|
|
|
}
|
|
|
|
|
2018-11-26 04:20:25 +01:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
class ViewHolderItem extends RecyclerView.ViewHolder {
|
|
|
|
DownloadManager.MissionItem item;
|
|
|
|
|
|
|
|
TextView status;
|
|
|
|
ImageView icon;
|
|
|
|
TextView name;
|
|
|
|
TextView size;
|
|
|
|
ProgressDrawable progress;
|
|
|
|
|
|
|
|
PopupMenu popupMenu;
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
MenuItem retry;
|
|
|
|
MenuItem cancel;
|
2018-09-23 20:12:23 +02:00
|
|
|
MenuItem start;
|
|
|
|
MenuItem pause;
|
|
|
|
MenuItem open;
|
|
|
|
MenuItem queue;
|
|
|
|
MenuItem showError;
|
|
|
|
MenuItem delete;
|
|
|
|
MenuItem source;
|
|
|
|
MenuItem checksum;
|
|
|
|
|
2019-10-10 04:49:23 +02:00
|
|
|
long lastTimestamp = -1;
|
|
|
|
double lastDone;
|
|
|
|
int lastSpeedIdx;
|
|
|
|
float[] lastSpeed = new float[3];
|
|
|
|
String estimatedTimeArrival = UNDEFINED_ETA;
|
2018-09-23 20:12:23 +02:00
|
|
|
|
|
|
|
ViewHolderItem(View view) {
|
|
|
|
super(view);
|
|
|
|
|
|
|
|
progress = new ProgressDrawable();
|
|
|
|
ViewCompat.setBackground(itemView.findViewById(R.id.item_bkg), progress);
|
|
|
|
|
|
|
|
status = itemView.findViewById(R.id.item_status);
|
|
|
|
name = itemView.findViewById(R.id.item_name);
|
|
|
|
icon = itemView.findViewById(R.id.item_icon);
|
|
|
|
size = itemView.findViewById(R.id.item_size);
|
|
|
|
|
|
|
|
name.setSelected(true);
|
|
|
|
|
|
|
|
ImageView button = itemView.findViewById(R.id.item_more);
|
|
|
|
popupMenu = buildPopup(button);
|
|
|
|
button.setOnClickListener(v -> showPopupMenu());
|
|
|
|
|
|
|
|
Menu menu = popupMenu.getMenu();
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
retry = menu.findItem(R.id.retry);
|
|
|
|
cancel = menu.findItem(R.id.cancel);
|
2018-09-23 20:12:23 +02:00
|
|
|
start = menu.findItem(R.id.start);
|
|
|
|
pause = menu.findItem(R.id.pause);
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
open = menu.findItem(R.id.menu_item_share);
|
2018-09-23 20:12:23 +02:00
|
|
|
queue = menu.findItem(R.id.queue);
|
|
|
|
showError = menu.findItem(R.id.error_message_view);
|
|
|
|
delete = menu.findItem(R.id.delete);
|
|
|
|
source = menu.findItem(R.id.source);
|
|
|
|
checksum = menu.findItem(R.id.checksum);
|
|
|
|
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
itemView.setHapticFeedbackEnabled(true);
|
|
|
|
|
|
|
|
itemView.setOnClickListener(v -> {
|
2018-11-24 04:14:37 +01:00
|
|
|
if (item.mission instanceof FinishedMission)
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
viewWithFileProvider(item.mission);
|
|
|
|
});
|
|
|
|
|
|
|
|
itemView.setOnLongClickListener(v -> {
|
|
|
|
v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
|
|
|
showPopupMenu();
|
|
|
|
return true;
|
2018-11-16 00:53:30 +01:00
|
|
|
});
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void showPopupMenu() {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
retry.setVisible(false);
|
|
|
|
cancel.setVisible(false);
|
2018-09-23 20:12:23 +02:00
|
|
|
start.setVisible(false);
|
|
|
|
pause.setVisible(false);
|
|
|
|
open.setVisible(false);
|
|
|
|
queue.setVisible(false);
|
|
|
|
showError.setVisible(false);
|
|
|
|
delete.setVisible(false);
|
|
|
|
source.setVisible(false);
|
|
|
|
checksum.setVisible(false);
|
|
|
|
|
|
|
|
DownloadMission mission = item.mission instanceof DownloadMission ? (DownloadMission) item.mission : null;
|
|
|
|
|
|
|
|
if (mission != null) {
|
2019-04-05 19:45:39 +02:00
|
|
|
if (mission.hasInvalidStorage()) {
|
2019-04-09 23:38:34 +02:00
|
|
|
retry.setVisible(true);
|
|
|
|
delete.setVisible(true);
|
|
|
|
showError.setVisible(true);
|
2019-04-05 19:45:39 +02:00
|
|
|
} else if (mission.isPsRunning()) {
|
New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers
Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time
Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown
New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)
Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-03-23 02:54:07 +01:00
|
|
|
switch (mission.errCode) {
|
|
|
|
case ERROR_INSUFFICIENT_STORAGE:
|
|
|
|
case ERROR_POSTPROCESSING_HOLD:
|
|
|
|
retry.setVisible(true);
|
|
|
|
cancel.setVisible(true);
|
|
|
|
showError.setVisible(true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2018-09-23 20:12:23 +02:00
|
|
|
if (mission.running) {
|
|
|
|
pause.setVisible(true);
|
|
|
|
} else {
|
2018-12-02 02:05:09 +01:00
|
|
|
if (mission.errCode != ERROR_NOTHING) {
|
2018-09-23 20:12:23 +02:00
|
|
|
showError.setVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
queue.setChecked(mission.enqueued);
|
|
|
|
|
|
|
|
delete.setVisible(true);
|
2019-01-21 05:30:03 +01:00
|
|
|
|
2019-09-28 23:11:05 +02:00
|
|
|
boolean flag = !mission.isPsFailed() && mission.urls.length > 0;
|
2019-01-21 05:30:03 +01:00
|
|
|
start.setVisible(flag);
|
|
|
|
queue.setVisible(flag);
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
open.setVisible(true);
|
|
|
|
delete.setVisible(true);
|
|
|
|
checksum.setVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.mission.source != null && !item.mission.source.isEmpty()) {
|
|
|
|
source.setVisible(true);
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
2018-09-23 20:12:23 +02:00
|
|
|
|
|
|
|
popupMenu.show();
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
private PopupMenu buildPopup(final View button) {
|
|
|
|
PopupMenu popup = new PopupMenu(mContext, button);
|
|
|
|
popup.inflate(R.menu.mission);
|
|
|
|
popup.setOnMenuItemClickListener(option -> handlePopupItem(this, option));
|
|
|
|
|
|
|
|
return popup;
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
2019-10-10 04:49:23 +02:00
|
|
|
|
|
|
|
private void resetSpeedMeasure() {
|
|
|
|
estimatedTimeArrival = UNDEFINED_ETA;
|
|
|
|
lastTimestamp = -1;
|
|
|
|
lastSpeedIdx = -1;
|
|
|
|
}
|
2018-09-23 20:12:23 +02:00
|
|
|
}
|
|
|
|
|
2020-11-19 00:02:33 +01:00
|
|
|
static class ViewHolderHeader extends RecyclerView.ViewHolder {
|
2018-09-23 20:12:23 +02:00
|
|
|
TextView header;
|
2017-06-28 07:27:32 +02:00
|
|
|
|
2018-09-23 20:12:23 +02:00
|
|
|
ViewHolderHeader(View view) {
|
|
|
|
super(view);
|
|
|
|
header = itemView.findViewById(R.id.item_name);
|
|
|
|
}
|
2017-06-28 07:27:32 +02:00
|
|
|
}
|
|
|
|
|
2019-04-05 19:45:39 +02:00
|
|
|
public interface RecoverHelper {
|
|
|
|
void tryRecover(DownloadMission mission);
|
|
|
|
}
|
2016-04-22 01:28:01 +02:00
|
|
|
}
|