-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Download all videos together (#234)
* feat: ability to download all videos * feat: confirmation dialog for downloading videos larger than 1 GB * refactor: renamed the Video tab to Videos * refactor: hide All videos download element if there is no videos to download * fix: bug when unable to see all videos * fix: lags when updating downloading state * refactor: changed the type of allBlocks to HashMap in the BaseDownloadViewModel * feat: confirmation dialog when trying to remove all downloads * feat: show download progress on the download queue screen * feat: view downloads for subsection * refactor: changed how all modules are download * refactor: optimized way to remove models * refactor: changed the way the download progress is displayed * feat: added confirmation dialogs * feat: show Untitled title if the block has no title * refactor: removed unused logs * fix: after rebase * fix: after rebase * refactor: change the name of the Discussion tab to Discussions * fix: fixed issues after PR
- Loading branch information
Showing
63 changed files
with
1,994 additions
and
688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.openedx.core.extension | ||
|
||
import kotlin.math.log10 | ||
import kotlin.math.pow | ||
|
||
fun Long.toFileSize(round: Int = 2): String { | ||
try { | ||
if (this <= 0) return "0" | ||
val units = arrayOf("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") | ||
val digitGroups = (log10(this.toDouble()) / log10(1024.0)).toInt() | ||
return String.format( | ||
"%." + round + "f", this / 1024.0.pow(digitGroups.toDouble()) | ||
) + " " + units[digitGroups] | ||
} catch (e: Exception) { | ||
println(e.toString()) | ||
} | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.