Hide stats for profiles that have no traffic

This commit is contained in:
Mygod
2015-11-18 23:23:36 +08:00
parent c4c1682983
commit 9adf11713f
@@ -59,11 +59,13 @@ class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClickListe
def updateText() {
val builder = new SpannableStringBuilder
builder.append(item.name)
val start = builder.length
builder.append(getString(R.string.stat_profiles,
TrafficMonitor.formatTraffic(item.tx), TrafficMonitor.formatTraffic(item.rx)))
builder.setSpan(new TextAppearanceSpan(ProfileManagerActivity.this, android.R.style.TextAppearance_Small),
start + 1, builder.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
if (item.tx != 0 || item.rx != 0) {
val start = builder.length
builder.append(getString(R.string.stat_profiles,
TrafficMonitor.formatTraffic(item.tx), TrafficMonitor.formatTraffic(item.rx)))
builder.setSpan(new TextAppearanceSpan(ProfileManagerActivity.this, android.R.style.TextAppearance_Small),
start + 1, builder.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
}
text.setText(builder)
}