tremotesf-android
tremotesf-android copied to clipboard
Feature request: seed progress bar
This is my attempt
diff --git a/app/src/main/kotlin/org/equeim/tremotesf/TorrentData.kt b/app/src/main/kotlin/org/equeim/tremotesf/TorrentData.kt
index 1da98f2..13c2624 100644
--- a/app/src/main/kotlin/org/equeim/tremotesf/TorrentData.kt
+++ b/app/src/main/kotlin/org/equeim/tremotesf/TorrentData.kt
@@ -87,6 +87,10 @@ class TorrentData(val torrent: Torrent, private val context: Context) {
private set
var totalUploaded = torrent.totalUploaded()
private set
+ var ratioLimitMode = torrent.ratioLimitMode()
+ private set
+ var ratioLimit = torrent.ratioLimit()
+ private set
var ratio = torrent.ratio()
private set
diff --git a/app/src/main/kotlin/org/equeim/tremotesf/mainactivity/TorrentsAdapter.kt b/app/src/main/kotlin/org/equeim/tremotesf/mainactivity/TorrentsAdapter.kt
index c8fbf09..6372a3f 100644
--- a/app/src/main/kotlin/org/equeim/tremotesf/mainactivity/TorrentsAdapter.kt
+++ b/app/src/main/kotlin/org/equeim/tremotesf/mainactivity/TorrentsAdapter.kt
@@ -333,7 +333,15 @@ class TorrentsAdapter(private val activity: MainActivity) : RecyclerView.Adapter
}
etaTextView.text = Utils.formatDuration(activity, torrent.eta)
- progressBar.progress = (torrent.percentDone * 100).toInt()
+ if ((torrent.status == Torrent.Status.Seeding || torrent.status == Torrent.Status.StalledSeeding)
+ && torrent.ratioLimitMode != Torrent.RatioLimitMode.UnlimitedRatio) {
+ progressBar.progress = (torrent.ratio / torrent.ratioLimit * 100).toInt()
+ progressBar.secondaryProgress = 100
+ } else {
+ progressBar.progress = (torrent.percentDone * 100).toInt()
+ progressBar.secondaryProgress = 0
+ }
+
downloadSpeedTextView.text = activity.getString(R.string.download_speed_string,
Utils.formatByteSpeed(activity,
torrent.downloadSpeed))
Either this progress bar or a seed ratio on the torrent list page would be nice.