2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.settings.fuelgauge;
19 import android.app.Fragment;
20 import android.content.Intent;
21 import android.os.BatteryStats;
22 import android.os.Bundle;
23 import android.view.LayoutInflater;
24 import android.view.View;
25 import android.view.ViewGroup;
27 import com.android.internal.os.BatteryStatsHelper;
28 import com.android.settings.R;
30 public class BatteryHistoryDetail extends Fragment {
31 public static final String EXTRA_STATS = "stats";
32 public static final String EXTRA_BROADCAST = "broadcast";
34 private BatteryStats mStats;
35 private Intent mBatteryBroadcast;
38 public void onCreate(Bundle icicle) {
39 super.onCreate(icicle);
40 String histFile = getArguments().getString(EXTRA_STATS);
41 mStats = BatteryStatsHelper.statsFromFile(getActivity(), histFile);
42 mBatteryBroadcast = getArguments().getParcelable(EXTRA_BROADCAST);
46 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
47 View view = inflater.inflate(R.layout.battery_history_chart, null);
48 BatteryHistoryChart chart = (BatteryHistoryChart)view.findViewById(
49 R.id.battery_history_chart);
50 chart.setStats(mStats, mBatteryBroadcast);