Commit Graph

30 Commits

Author SHA1 Message Date
CloudyRowly 2e318b8b03
Added "free memory" check before downloading [Android N / API 24+] (#10505)
Added "free space" check before downloading eliminating bugs related to out-of-memory on Android N / API 24+
2024-03-21 09:18:55 +01:00
ThetaDev fb00ee8cf9
[YouTube] Improve download speed (#9948) 2023-05-01 19:26:42 +02:00
Stypox 9c4d5526f4
Merge pull request #8810 from Isira-Seneviratne/Math_floorDiv
Use Math.floorDiv().
2022-12-04 18:08:12 +01:00
Isira Seneviratne feb03f7e30 Use Math.floorDiv(). 2022-11-09 20:01:40 +05:30
AudricV 7b7ab3f419
Remove Utility.copyToClipboard and use ShareUtils.copyToClipboard instead
This method is not needed anymore, as ShareUtils.copyToClipboard does
almost the same thing (no label is set on the ClipData used to copy text,
contrary to what Utility did, but using "text" as a ClipData label doesn't seem
useful).

It was used in MissionAdapter.handlePopupItem to copy the SHA1 or the MD5 of a
file.
2022-11-08 20:47:51 +01:00
Isira Seneviratne 697b8411df Use Okio's ByteString. 2022-08-13 08:27:55 +05:30
wb9688 1164ea52f9
Move Stored(File|Directory)Helper into NewPipe 2021-06-08 10:40:44 +02:00
krlvm fd14c8cdce
Fix Dark elements in Light Theme 2021-03-27 17:46:05 +03:00
Isira Seneviratne 95333d37c8 Use try-with-resources. 2020-11-21 13:47:13 +05:30
Isira Seneviratne 58b720b004 Use ContextCompat.getSystemService() and the Context.getSystemService() extension function. 2020-10-09 08:52:05 +05:30
Stypox ea43b28f74
Use vector drawables instead of PNGs for material icons
For all manually-created images PNG have been kept.
- rename all icon attrs to have a `ic_` prefix
- always use `_24dp` icons, because there is no real difference, since they are vector drawables
- always use the original name found on material.io for icon drawables, as to not create confusion and possibly duplicates. Icon names can still be different from real drawable names, though I have made some of them compliant to this or maybe more meaningul.
- remove duplicate `getIconByAttr()` in ThemeHelper (use `resolveResourceIdFromAttr()`
- use standard icons for `expand_more` and `expand_less` instead of triangles
- use `play_button_outline` instead of custom PNG as play button in VideoDetailFragment (questionable, as there is no shadow anymore)
2020-05-21 15:39:35 +02:00
kapodamy e6d9d8e26d code cleanup
* migrate few annotations to androidx
* mission recovery: better error handling (except StreamExtractor.getErrorMessage() method always returns an error)
* post-processing: more detailed progress

[file specific changes]

DownloadMission.java
* remove redundant/boilerplate code (again)
* make few variables volatile
* better file "length" approximation
* use "done" variable to count the amount of bytes downloaded (simplify percent calc in UI code)

Postprocessing.java
* if case of error use "ERROR_POSTPROCESSING" instead of "ERROR_UNKNOWN_EXCEPTION"
* simplify source stream init

DownloadManager.java
* move all "service message sending" code to DownloadMission
* remove not implemented method "notifyUserPendingDownloads()" also his unused strings

DownloadManagerService.java
* use START_STICKY instead of START_NOT_STICKY
* simplify addMissionEventListener()/removeMissionEventListener() methods (always are called from the main thread)

Deleter.java
* better method definition

MissionAdapter.java
* better method definition
* code cleanup
* the UI is now refreshed every 750ms
* simplify download progress calculation
* indicates if the download is actually recovering
* smooth download speed measure
* show estimated remain time

MainFragment.java:
* check if viewPager is null (issued by "Apply changes" feature of Android Studio)
2019-11-26 10:46:31 -03:00
Robin bf2a3ca043 Migrate to AndroidX 2019-10-04 14:59:08 +02:00
kapodamy 7b948f83c3 Space reserving tweaks for huge video resolutions
* improve space reserving, allows write better 4K/8K video data
* do not use cache dirs in the muxers, Android can force close NewPipe if the device is running out of storage. Is a aggressive cache cleaning >:/
* (for devs) webm & mkv are the same thing
* calculate the final file size inside of the mission, instead getting from the UI
* simplify ps algorithms constructors
* [missing old commit message] simplify the loading of pending downloads
2019-06-03 18:26:26 -03:00
kapodamy d00dc798f4 more SAF implementation
* full support for Directory API (Android Lollipop or later)
* best effort to handle any kind errors (missing file, revoked permissions, etc) and recover the download
* implemented directory choosing
* fix download database version upgrading
* misc. cleanup
* do not release permission on the old save path (if the user change the download directory) under SAF api
2019-06-03 18:18:20 -03:00
kapodamy f6b32823ba Implement Storage Access Framework
* re-work finished mission database
* re-work DownloadMission and bump it Serializable version
* keep the classic Java IO API
* SAF Tree API support on Android Lollipop or higher
* add wrapper for SAF stream opening
* implement Closeable in SharpStream to replace the dispose() method

* do required changes for this API:
** remove any file creation logic from DownloadInitializer
** make PostProcessing Serializable and reduce the number of iterations
** update all strings.xml files
** storage helpers: StoredDirectoryHelper & StoredFileHelper
** best effort to handle any kind of SAF errors/exceptions
2019-06-03 18:16:41 -03:00
kapodamy f3d4d4747a 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
2018-11-24 20:13:18 -03:00
kapodamy eb1f56488f resbase (08/11/2018) 2018-11-08 22:00:13 -03:00
kapodamy 5825843f68 main commit
Post-processing infrastructure
* remove interfaces with one implementation
* fix download resources with unknow length
* marquee style for ProgressDrawable
* "view details" option in mission context menu
* notification for finished downloads
* postprocessing infrastructure: sub-missions, circular file, layers for layers of abstractions for Java IO streams
* Mp4 muxing (only DASH brand)
* WebM muxing
* Captions downloading
* alert dialog for overwrite existing downloads finished or not.

Misc changes
* delete SQLiteDownloadDataSource.java
* delete DownloadMissionSQLiteHelper.java
* implement Localization from #114

Misc fixes (this branch)
* restore old mission listeners variables. Prevents registered listeners get de-referenced on low-end devices
* DownloadManagerService.checkForRunningMission() now return false if the mission has a error.
* use Intent.FLAG_ACTIVITY_NEW_TASK when launching an activity from gigaget threads (apparently it is required in old versions of android)

More changes
* proper error handling "infrastructure"
* queue instead of multiple downloads
* move serialized pending downloads (.giga files) to app data
* stop downloads when swicthing to mobile network (never works, see 2nd point)
* save the thread count for next downloads
* a lot of incoherences fixed
* delete DownloadManagerTest.java (too many changes to keep this file updated)
2018-11-08 19:00:44 -03:00
BO41 802b26e870 error handling + imports + unboxing 2018-09-11 19:18:50 +02:00
DafabHoid ae8121b680 Utility: Buffer the output to files when serializing 2018-05-18 18:23:32 +02:00
Andrei.Rosca b494b2ea39 Remove GSON lib 2018-04-29 01:06:34 +02:00
Coffeemakr b03723c3fb Code improvements
* Replace unchecked casts with checked casts
 * remove Utility.finViewById
 * Fix return activity checking
 * Create UserAction enum
 * Fix typos
 * Add instrumented test for error info
 * ErrorInfo make fields final
 * Log exception using logger
 * Add inherited annotations
 * Resolve deprecation warnings
 * Remove unused methods from utility
 * Reformat code
 * Remove unused methods from Utility and improve getFileExt
 * Create OnScrollBelowItemsListener
2017-06-28 18:56:05 +02:00
Christian Schabesberger f9ac199c1f fixed .webm download locatiion issue 2016-09-27 21:33:26 +02:00
Christian Schabesberger 8107337566 restructure ui 2016-08-02 21:17:54 +02:00
Christian Schabesberger f23ae091cc add icons for progress tiles 2016-05-25 23:35:27 +02:00
Christian Schabesberger 39c2f31a22 changed color of download blocks 2016-05-25 22:59:32 +02:00
David 730de4061f deleted some unused code and assets 2016-05-02 10:47:18 -03:00
David 6940021293 Fixed dir settings 2016-05-02 10:47:18 -03:00
David 4bae12aa55 Embedded GigaGet download manager. First try. 2016-05-02 10:47:18 -03:00