and more fixes

* fix content length reading
* use float overflow. Expensive, double is used instead
* fix invalid cast after click the mission body
* use a list for maximum attemps (downloads)
* minor clean up (DownloadManager.java)
* dont pass SharedPreferences instace to DownloadManager
* use a switch instead of checkbox for cross_network_downloads
* notify media scanner after deleting a finished download
This commit is contained in:
kapodamy 2018-11-24 00:14:37 -03:00
parent 3357fc0f17
commit 6d4e97a877
12 changed files with 111 additions and 52 deletions

View file

@ -124,7 +124,7 @@ public class DownloadMission extends Mission {
@SuppressWarnings("UseSparseArrays")// LongSparseArray is not serializable
private final HashMap<Long, Boolean> blockState = new HashMap<>();
final List<Long> threadBlockPositions = new ArrayList<>();
final List<Integer> threadBytePositions = new ArrayList<>();
final List<Long> threadBytePositions = new ArrayList<>();
private transient boolean deleted;
int currentThreadCount;
@ -216,7 +216,7 @@ public class DownloadMission extends Mission {
* @param threadId the identifier of the thread
* @param position the relative position in bytes or zero
*/
void setThreadBytePosition(int threadId, int position) {
void setThreadBytePosition(int threadId, long position) {
threadBytePositions.set(threadId, position);
}
@ -226,7 +226,7 @@ public class DownloadMission extends Mission {
* @param threadId the identifier of the thread
* @return the relative position in bytes or zero
*/
int getBlockBytePosition(int threadId) {
long getBlockBytePosition(int threadId) {
return threadBytePositions.get(threadId);
}