Merge "Hide empty data usage cycles." into mnc-dr-dev am: 2fcbdb7bb6
am: 82839c8073
* commit '82839c8073ff358e036c7ae54e52041e4a51738e':
Hide empty data usage cycles.
This commit is contained in:
@@ -1164,6 +1164,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
mCycleAdapter.clear();
|
mCycleAdapter.clear();
|
||||||
|
|
||||||
final Context context = mCycleSpinner.getContext();
|
final Context context = mCycleSpinner.getContext();
|
||||||
|
NetworkStatsHistory.Entry entry = null;
|
||||||
|
|
||||||
long historyStart = Long.MAX_VALUE;
|
long historyStart = Long.MAX_VALUE;
|
||||||
long historyEnd = Long.MIN_VALUE;
|
long historyEnd = Long.MIN_VALUE;
|
||||||
@@ -1186,10 +1187,21 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
final long cycleStart = computeLastCycleBoundary(cycleEnd, policy);
|
final long cycleStart = computeLastCycleBoundary(cycleEnd, policy);
|
||||||
Log.d(TAG, "generating cs=" + cycleStart + " to ce=" + cycleEnd + " waiting for hs="
|
Log.d(TAG, "generating cs=" + cycleStart + " to ce=" + cycleEnd + " waiting for hs="
|
||||||
+ historyStart);
|
+ historyStart);
|
||||||
|
|
||||||
|
final boolean includeCycle;
|
||||||
|
if (mChartData != null) {
|
||||||
|
entry = mChartData.network.getValues(cycleStart, cycleEnd, entry);
|
||||||
|
includeCycle = (entry.rxBytes + entry.txBytes) > 0;
|
||||||
|
} else {
|
||||||
|
includeCycle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includeCycle) {
|
||||||
mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
|
mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
|
||||||
cycleEnd = cycleStart;
|
|
||||||
hasCycles = true;
|
hasCycles = true;
|
||||||
}
|
}
|
||||||
|
cycleEnd = cycleStart;
|
||||||
|
}
|
||||||
|
|
||||||
// one last cycle entry to modify policy cycle day
|
// one last cycle entry to modify policy cycle day
|
||||||
mCycleAdapter.setChangePossible(isNetworkPolicyModifiable(policy));
|
mCycleAdapter.setChangePossible(isNetworkPolicyModifiable(policy));
|
||||||
@@ -1200,7 +1212,18 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
long cycleEnd = historyEnd;
|
long cycleEnd = historyEnd;
|
||||||
while (cycleEnd > historyStart) {
|
while (cycleEnd > historyStart) {
|
||||||
final long cycleStart = cycleEnd - (DateUtils.WEEK_IN_MILLIS * 4);
|
final long cycleStart = cycleEnd - (DateUtils.WEEK_IN_MILLIS * 4);
|
||||||
|
|
||||||
|
final boolean includeCycle;
|
||||||
|
if (mChartData != null) {
|
||||||
|
entry = mChartData.network.getValues(cycleStart, cycleEnd, entry);
|
||||||
|
includeCycle = (entry.rxBytes + entry.txBytes) > 0;
|
||||||
|
} else {
|
||||||
|
includeCycle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (includeCycle) {
|
||||||
mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
|
mCycleAdapter.add(new CycleItem(context, cycleStart, cycleEnd));
|
||||||
|
}
|
||||||
cycleEnd = cycleStart;
|
cycleEnd = cycleStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user