1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settingslib.net; 18 19 import java.util.List; 20 import java.util.concurrent.TimeUnit; 21 22 /** 23 * Usage data in a billing cycle with bucketized data for plotting the usage chart. 24 */ 25 public class NetworkCycleChartData extends NetworkCycleData { 26 public static final long BUCKET_DURATION_MS = TimeUnit.DAYS.toMillis(1); 27 28 private List<NetworkCycleData> mUsageBuckets; 29 NetworkCycleChartData()30 private NetworkCycleChartData() { 31 } 32 getUsageBuckets()33 public List<NetworkCycleData> getUsageBuckets() { 34 return mUsageBuckets; 35 } 36 37 public static class Builder extends NetworkCycleData.Builder { 38 private NetworkCycleChartData mObject = new NetworkCycleChartData(); 39 setUsageBuckets(List<NetworkCycleData> buckets)40 public Builder setUsageBuckets(List<NetworkCycleData> buckets) { 41 getObject().mUsageBuckets = buckets; 42 return this; 43 } 44 45 @Override getObject()46 protected NetworkCycleChartData getObject() { 47 return mObject; 48 } 49 50 @Override build()51 public NetworkCycleChartData build() { 52 return getObject(); 53 } 54 } 55 56 } 57