Show size of app backups in Backup Status screen
This commit is contained in:
parent
c362da8220
commit
599240c79f
2 changed files with 11 additions and 1 deletions
|
@ -38,6 +38,7 @@ data class AppStatus(
|
||||||
val icon: Drawable,
|
val icon: Drawable,
|
||||||
val name: String,
|
val name: String,
|
||||||
val time: Long,
|
val time: Long,
|
||||||
|
val size: Long?,
|
||||||
val status: AppBackupState,
|
val status: AppBackupState,
|
||||||
val isSpecial: Boolean = false,
|
val isSpecial: Boolean = false,
|
||||||
) : AppListItem()
|
) : AppListItem()
|
||||||
|
@ -87,6 +88,7 @@ internal class AppListRetriever(
|
||||||
icon = getIcon(packageName),
|
icon = getIcon(packageName),
|
||||||
name = context.getString(stringId),
|
name = context.getString(stringId),
|
||||||
time = metadata?.time ?: 0,
|
time = metadata?.time ?: 0,
|
||||||
|
size = metadata?.size,
|
||||||
status = status,
|
status = status,
|
||||||
isSpecial = true
|
isSpecial = true
|
||||||
)
|
)
|
||||||
|
@ -111,6 +113,7 @@ internal class AppListRetriever(
|
||||||
icon = getIcon(it.packageName),
|
icon = getIcon(it.packageName),
|
||||||
name = getAppName(context, it.packageName).toString(),
|
name = getAppName(context, it.packageName).toString(),
|
||||||
time = time,
|
time = time,
|
||||||
|
size = metadata?.size,
|
||||||
status = status
|
status = status
|
||||||
)
|
)
|
||||||
}.sortedBy { it.name.lowercase(locale) }
|
}.sortedBy { it.name.lowercase(locale) }
|
||||||
|
@ -125,6 +128,7 @@ internal class AppListRetriever(
|
||||||
icon = getIcon(it.packageName),
|
icon = getIcon(it.packageName),
|
||||||
name = getAppName(context, it.packageName).toString(),
|
name = getAppName(context, it.packageName).toString(),
|
||||||
time = 0,
|
time = 0,
|
||||||
|
size = null,
|
||||||
status = FAILED_NOT_ALLOWED
|
status = FAILED_NOT_ALLOWED
|
||||||
)
|
)
|
||||||
}.sortedBy { it.name.lowercase(locale) }
|
}.sortedBy { it.name.lowercase(locale) }
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.stevesoltys.seedvault.settings
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS
|
import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS
|
||||||
|
import android.text.format.Formatter.formatShortFileSize
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
|
@ -116,7 +117,12 @@ internal class AppStatusAdapter(private val toggleListener: AppStatusToggleListe
|
||||||
setState(item.status, false)
|
setState(item.status, false)
|
||||||
}
|
}
|
||||||
if (item.status == SUCCEEDED) {
|
if (item.status == SUCCEEDED) {
|
||||||
appInfo.text = item.time.toRelativeTime(context)
|
appInfo.text = if (item.size == null) {
|
||||||
|
item.time.toRelativeTime(context)
|
||||||
|
} else {
|
||||||
|
item.time.toRelativeTime(context).toString() +
|
||||||
|
" (${formatShortFileSize(v.context, item.size)})"
|
||||||
|
}
|
||||||
appInfo.visibility = VISIBLE
|
appInfo.visibility = VISIBLE
|
||||||
}
|
}
|
||||||
switchView.visibility = INVISIBLE
|
switchView.visibility = INVISIBLE
|
||||||
|
|
Loading…
Reference in a new issue