diff --git a/app/src/main/kotlin/org/equeim/tremotesf/ui/torrentslistfragment/TorrentsAdapter.kt b/app/src/main/kotlin/org/equeim/tremotesf/ui/torrentslistfragment/TorrentsAdapter.kt index db5d055b..c78710ae 100644 --- a/app/src/main/kotlin/org/equeim/tremotesf/ui/torrentslistfragment/TorrentsAdapter.kt +++ b/app/src/main/kotlin/org/equeim/tremotesf/ui/torrentslistfragment/TorrentsAdapter.kt @@ -21,6 +21,8 @@ package org.equeim.tremotesf.ui.torrentslistfragment import android.annotation.SuppressLint import android.content.Context +import android.content.res.ColorStateList +import android.os.Build import android.text.TextUtils import android.view.LayoutInflater import android.view.Menu @@ -125,7 +127,16 @@ class TorrentsAdapter(private val fragment: TorrentsListFragment) : } etaTextView.text = FormatUtils.formatDuration(context, torrent.eta) - progressBar.progress = (torrent.percentDone * 100).toInt() + val progress = (torrent.percentDone * 100).toInt() + progressBar.progress = progress + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + progressBar.progressTintList = if (progress == 100) { + ColorStateList.valueOf(context.getColor(R.color.color_downloaded_torrents)) + } else { + ColorStateList.valueOf(context.getColor(R.color.color_primary)) + } + } + downloadSpeedTextView.text = context.getString( R.string.download_speed_string, FormatUtils.formatByteSpeed( diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index c3732ca7..214dc0d2 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -8,6 +8,7 @@ #ef5350 #ffffff @color/color_background_dark + #50cf50 #80cbc4 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0f5ec70d..231e95a5 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -12,6 +12,7 @@ #ffffff #ffffff #ff202020 + #50af50 #008577