Loading res/layout/preference_batteryhistory.xml +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ xmlns:app="http://schemas.android.com/apk/res/com.android.settings" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="128dp" android:minHeight="@dimen/battery_history_chart_height" android:gravity="center_vertical" android:id="@+android:id/battery_history_chart" android:paddingEnd="?android:attr/scrollbarSize" Loading res/values-h480dp/dimens.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <dimen name="battery_history_chart_height">160dp</dimen> </resources> res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ <dimen name="bind_app_widget_dialog_checkbox_bottom_padding">16dip</dimen> <dimen name="installed_app_details_bullet_offset">8dip</dimen> <dimen name="battery_history_chart_height">120dp</dimen> <dimen name="data_usage_chart_height">252dip</dimen> <dimen name="data_usage_chart_optimalWidth">440dip</dimen> Loading src/com/android/settings/fuelgauge/BatteryHistoryChart.java +14 −2 Original line number Diff line number Diff line Loading @@ -661,6 +661,13 @@ public class BatteryHistoryChart extends View { return; } if (mLastWidth == 0 || mLastHeight == 0) { return; } mLastWidth = w; mLastHeight = h; int textHeight = mTextDescent - mTextAscent; int headerTextHeight = mHeaderTextDescent - mHeaderTextAscent; if (h > (textHeight*12)) { Loading Loading @@ -736,11 +743,18 @@ public class BatteryHistoryChart extends View { mCpuRunningPath.reset(); mChargingPath.reset(); mTimeLabels.clear(); mDateLabels.clear(); final long walltimeStart = mStartWallTime; final long walltimeChange = mEndWallTime-walltimeStart; long curWalltime = 0; long lastRealtime = 0; if (walltimeChange == 0) { return; } final int batLow = mBatLow; final int batChange = mBatHigh-mBatLow; Loading Loading @@ -924,7 +938,6 @@ public class BatteryHistoryChart extends View { } // Create the time labels at the bottom. mTimeLabels.clear(); boolean is24hr = is24Hour(); Calendar calStart = Calendar.getInstance(); calStart.setTimeInMillis(mStartWallTime); Loading Loading @@ -957,7 +970,6 @@ public class BatteryHistoryChart extends View { } // Create the date labels if the chart includes multiple days mDateLabels.clear(); if (calStart.get(Calendar.DAY_OF_YEAR) != calEnd.get(Calendar.DAY_OF_YEAR) || calStart.get(Calendar.YEAR) != calEnd.get(Calendar.YEAR)) { boolean isDayFirst = isDayFirst(); Loading src/com/android/settings/fuelgauge/PowerUsageSummary.java +19 −2 Original line number Diff line number Diff line Loading @@ -82,8 +82,9 @@ public class PowerUsageSummary extends PreferenceFragment { String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action) && updateBatteryStatus(intent)) { mStatsHelper.clearStats(); refreshStats(); if (!mHandler.hasMessages(MSG_REFRESH_STATS)) { mHandler.sendEmptyMessageDelayed(MSG_REFRESH_STATS, 500); } } } }; Loading @@ -110,6 +111,10 @@ public class PowerUsageSummary extends PreferenceFragment { super.onResume(); updateBatteryStatus(getActivity().registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED))); if (mHandler.hasMessages(MSG_REFRESH_STATS)) { mHandler.removeMessages(MSG_REFRESH_STATS); mStatsHelper.clearStats(); } refreshStats(); } Loading @@ -121,6 +126,12 @@ public class PowerUsageSummary extends PreferenceFragment { super.onPause(); } @Override public void onStop() { super.onStop(); mHandler.removeMessages(MSG_REFRESH_STATS); } @Override public void onDestroy() { super.onDestroy(); Loading Loading @@ -189,6 +200,7 @@ public class PowerUsageSummary extends PreferenceFragment { case MENU_STATS_REFRESH: mStatsHelper.clearStats(); refreshStats(); mHandler.removeMessages(MSG_REFRESH_STATS); return true; default: return false; Loading Loading @@ -258,6 +270,8 @@ public class PowerUsageSummary extends PreferenceFragment { BatteryEntry.startRequestQueue(); } static final int MSG_REFRESH_STATS = 100; Handler mHandler = new Handler() { @Override Loading @@ -279,6 +293,9 @@ public class PowerUsageSummary extends PreferenceFragment { activity.reportFullyDrawn(); } break; case MSG_REFRESH_STATS: mStatsHelper.clearStats(); refreshStats(); } super.handleMessage(msg); } Loading Loading
res/layout/preference_batteryhistory.xml +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ xmlns:app="http://schemas.android.com/apk/res/com.android.settings" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="128dp" android:minHeight="@dimen/battery_history_chart_height" android:gravity="center_vertical" android:id="@+android:id/battery_history_chart" android:paddingEnd="?android:attr/scrollbarSize" Loading
res/values-h480dp/dimens.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <dimen name="battery_history_chart_height">160dp</dimen> </resources>
res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ <dimen name="bind_app_widget_dialog_checkbox_bottom_padding">16dip</dimen> <dimen name="installed_app_details_bullet_offset">8dip</dimen> <dimen name="battery_history_chart_height">120dp</dimen> <dimen name="data_usage_chart_height">252dip</dimen> <dimen name="data_usage_chart_optimalWidth">440dip</dimen> Loading
src/com/android/settings/fuelgauge/BatteryHistoryChart.java +14 −2 Original line number Diff line number Diff line Loading @@ -661,6 +661,13 @@ public class BatteryHistoryChart extends View { return; } if (mLastWidth == 0 || mLastHeight == 0) { return; } mLastWidth = w; mLastHeight = h; int textHeight = mTextDescent - mTextAscent; int headerTextHeight = mHeaderTextDescent - mHeaderTextAscent; if (h > (textHeight*12)) { Loading Loading @@ -736,11 +743,18 @@ public class BatteryHistoryChart extends View { mCpuRunningPath.reset(); mChargingPath.reset(); mTimeLabels.clear(); mDateLabels.clear(); final long walltimeStart = mStartWallTime; final long walltimeChange = mEndWallTime-walltimeStart; long curWalltime = 0; long lastRealtime = 0; if (walltimeChange == 0) { return; } final int batLow = mBatLow; final int batChange = mBatHigh-mBatLow; Loading Loading @@ -924,7 +938,6 @@ public class BatteryHistoryChart extends View { } // Create the time labels at the bottom. mTimeLabels.clear(); boolean is24hr = is24Hour(); Calendar calStart = Calendar.getInstance(); calStart.setTimeInMillis(mStartWallTime); Loading Loading @@ -957,7 +970,6 @@ public class BatteryHistoryChart extends View { } // Create the date labels if the chart includes multiple days mDateLabels.clear(); if (calStart.get(Calendar.DAY_OF_YEAR) != calEnd.get(Calendar.DAY_OF_YEAR) || calStart.get(Calendar.YEAR) != calEnd.get(Calendar.YEAR)) { boolean isDayFirst = isDayFirst(); Loading
src/com/android/settings/fuelgauge/PowerUsageSummary.java +19 −2 Original line number Diff line number Diff line Loading @@ -82,8 +82,9 @@ public class PowerUsageSummary extends PreferenceFragment { String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action) && updateBatteryStatus(intent)) { mStatsHelper.clearStats(); refreshStats(); if (!mHandler.hasMessages(MSG_REFRESH_STATS)) { mHandler.sendEmptyMessageDelayed(MSG_REFRESH_STATS, 500); } } } }; Loading @@ -110,6 +111,10 @@ public class PowerUsageSummary extends PreferenceFragment { super.onResume(); updateBatteryStatus(getActivity().registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED))); if (mHandler.hasMessages(MSG_REFRESH_STATS)) { mHandler.removeMessages(MSG_REFRESH_STATS); mStatsHelper.clearStats(); } refreshStats(); } Loading @@ -121,6 +126,12 @@ public class PowerUsageSummary extends PreferenceFragment { super.onPause(); } @Override public void onStop() { super.onStop(); mHandler.removeMessages(MSG_REFRESH_STATS); } @Override public void onDestroy() { super.onDestroy(); Loading Loading @@ -189,6 +200,7 @@ public class PowerUsageSummary extends PreferenceFragment { case MENU_STATS_REFRESH: mStatsHelper.clearStats(); refreshStats(); mHandler.removeMessages(MSG_REFRESH_STATS); return true; default: return false; Loading Loading @@ -258,6 +270,8 @@ public class PowerUsageSummary extends PreferenceFragment { BatteryEntry.startRequestQueue(); } static final int MSG_REFRESH_STATS = 100; Handler mHandler = new Handler() { @Override Loading @@ -279,6 +293,9 @@ public class PowerUsageSummary extends PreferenceFragment { activity.reportFullyDrawn(); } break; case MSG_REFRESH_STATS: mStatsHelper.clearStats(); refreshStats(); } super.handleMessage(msg); } Loading