Add the string "No time remaining" when remaining time <= 0.
Bug: 70950124 Test: manual Test: make RunSettingsRoboTests Change-Id: Id8ff1dde78f3389b5ab15120a2460ab19e895c6f
This commit is contained in:
@@ -185,18 +185,18 @@ public class DataUsageSummaryPreference extends Preference {
|
||||
}
|
||||
|
||||
private void updateCycleTimeText(PreferenceViewHolder holder) {
|
||||
float daysLeft =
|
||||
((float) mCycleEndTimeMs - System.currentTimeMillis()) / MILLIS_IN_A_DAY;
|
||||
if (daysLeft < 0) {
|
||||
daysLeft = 0;
|
||||
}
|
||||
|
||||
TextView cycleTime = (TextView) holder.findViewById(R.id.cycle_left_time);
|
||||
cycleTime.setText(
|
||||
(daysLeft > 0 && daysLeft < 1)
|
||||
? getContext().getString(R.string.billing_cycle_less_than_one_day_left)
|
||||
: getContext().getResources().getQuantityString(
|
||||
R.plurals.billing_cycle_days_left, (int) daysLeft, (int) daysLeft));
|
||||
|
||||
long millisLeft = mCycleEndTimeMs - System.currentTimeMillis();
|
||||
if (millisLeft <= 0) {
|
||||
cycleTime.setText(getContext().getString(R.string.billing_cycle_none_left));
|
||||
} else {
|
||||
int daysLeft = (int)(millisLeft / MILLIS_IN_A_DAY);
|
||||
cycleTime.setText(daysLeft < 1
|
||||
? getContext().getString(R.string.billing_cycle_less_than_one_day_left)
|
||||
: getContext().getResources().getQuantityString(
|
||||
R.plurals.billing_cycle_days_left, daysLeft, daysLeft));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user