diff options
author | Jorge Ruesga <jorge@ruesga.com> | 2013-01-27 05:03:48 +0100 |
---|---|---|
committer | Jorge Ruesga <jorge@ruesga.com> | 2013-02-08 01:29:23 +0100 |
commit | 042159d9e9a129da3e290a5c6a2d4629acd56a65 (patch) | |
tree | c4bc85f8ed82ee0d66d3f304826e04d0e0525cc8 /packages/SystemUI/src/com/android/systemui/statusbar/phone | |
parent | eeb11165b6e5443be802b475017cb7aca9d6f213 (diff) | |
download | frameworks_base-042159d9e9a129da3e290a5c6a2d4629acd56a65.zip frameworks_base-042159d9e9a129da3e290a5c6a2d4629acd56a65.tar.gz frameworks_base-042159d9e9a129da3e290a5c6a2d4629acd56a65.tar.bz2 |
SystemUI: Add dock battery icon styles
Support for dock battery icon styles. This changes does a refactor of DockBatteryController to
extend BatteryController and create a new CircleDockBattery that extends CircleBattery (that listen
for dock battery events)
Patchset 2: Fully functional.
Patchset 3: Fixed min icons. Rebased.
Patchset 4: Create full device specific service in frameworks
Move dock battery stuff from the framework to a device handler.
Register/unregister DockBatteryController receivers
Remove battery views if device doesn't support dock battery
Refresh status on dock and screen on events
Rebased
Patchset 5: Transformers backwards compatibility
Better main battery status detection (use status instead of plugged type)
Fixed battery cluster space in status bar
Rebased
Patchset 6: Fix dock icons in ligths out mode
Patchset 7: Fix code style
Fix lockscreen status
Fix lights out mode (typo)
Fix images size
Rebased
Patchset 8: Fix icon images
Fix status on full charge
Rebased
TF700T implementation: http://review.cyanogenmod.org/#/c/31298/
Change-Id: I9a576d1b279f1883f736ac3bcd2435c4b95a73de
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/phone')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 74 |
1 files changed, 53 insertions, 21 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 26972c4..b7116b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.List; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -609,12 +610,18 @@ public class PhoneStatusBar extends BaseStatusBar { if (mHasDockBattery) { mDockBatteryController = new DockBatteryController(mContext); - mDockBatteryController.addIconView((ImageView)mStatusBarView.findViewById(R.id.dock_battery)); + mDockBatteryController.addIconView( + (ImageView)mStatusBarView.findViewById(R.id.dock_battery)); mDockBatteryController.addLabelView( (TextView)mStatusBarView.findViewById(R.id.dock_battery_text)); } else { - mStatusBarView.findViewById(R.id.dock_battery).setVisibility(View.GONE); - mStatusBarView.findViewById(R.id.dock_battery_text).setVisibility(View.GONE); + // Remove dock battery icons if device doesn't hava dock battery support + View v = mStatusBarView.findViewById(R.id.dock_battery); + if (v != null) mStatusBarView.removeView(v); + v = mStatusBarView.findViewById(R.id.dock_battery_text); + if (v != null) mStatusBarView.removeView(v); + v = mStatusBarView.findViewById(R.id.circle_dock_battery); + if (v != null) mStatusBarView.removeView(v); } mNetworkController = new NetworkController(mContext); @@ -2109,32 +2116,57 @@ public class PhoneStatusBar extends BaseStatusBar { final View battery = mStatusBarView.findViewById(R.id.battery); final View battery2 = mStatusBarView.findViewById(R.id.battery_text); final View battery3 = mStatusBarView.findViewById(R.id.circle_battery); + final View dockBattery = mStatusBarView.findViewById(R.id.dock_battery); + final View dockBattery2 = mStatusBarView.findViewById(R.id.dock_battery_text); + final View dockBattery3 = mStatusBarView.findViewById(R.id.circle_dock_battery); final View clock = mStatusBarView.findViewById(R.id.clock); + List<ObjectAnimator> lightsOutObjs = new ArrayList<ObjectAnimator>(); + lightsOutObjs.add(ObjectAnimator.ofFloat(notifications, View.ALPHA, 0)); + lightsOutObjs.add(ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 0)); + lightsOutObjs.add(ObjectAnimator.ofFloat(signal, View.ALPHA, 0)); + lightsOutObjs.add(ObjectAnimator.ofFloat(signal2, View.ALPHA, 0)); + lightsOutObjs.add(ObjectAnimator.ofFloat(battery, View.ALPHA, 0.5f)); + lightsOutObjs.add(ObjectAnimator.ofFloat(battery2, View.ALPHA, 0.5f)); + lightsOutObjs.add(ObjectAnimator.ofFloat(battery3, View.ALPHA, 0.5f)); + if (dockBattery != null) { + lightsOutObjs.add(ObjectAnimator.ofFloat(dockBattery, View.ALPHA, 0.5f)); + } + if (dockBattery2 != null) { + lightsOutObjs.add(ObjectAnimator.ofFloat(dockBattery2, View.ALPHA, 0.5f)); + } + if (dockBattery3 != null) { + lightsOutObjs.add(ObjectAnimator.ofFloat(dockBattery3, View.ALPHA, 0.5f)); + } + lightsOutObjs.add(ObjectAnimator.ofFloat(clock, View.ALPHA, 0.5f)); + + List<ObjectAnimator> lightsOnObjs = new ArrayList<ObjectAnimator>(); + lightsOnObjs.add(ObjectAnimator.ofFloat(notifications, View.ALPHA, 1)); + lightsOnObjs.add(ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 1)); + lightsOnObjs.add(ObjectAnimator.ofFloat(signal, View.ALPHA, 1)); + lightsOnObjs.add(ObjectAnimator.ofFloat(signal2, View.ALPHA, 1)); + lightsOnObjs.add(ObjectAnimator.ofFloat(battery, View.ALPHA, 1)); + lightsOnObjs.add(ObjectAnimator.ofFloat(battery2, View.ALPHA, 1)); + lightsOnObjs.add(ObjectAnimator.ofFloat(battery3, View.ALPHA, 1)); + if (dockBattery != null) { + lightsOnObjs.add(ObjectAnimator.ofFloat(dockBattery, View.ALPHA, 1)); + } + if (dockBattery2 != null) { + lightsOnObjs.add(ObjectAnimator.ofFloat(dockBattery2, View.ALPHA, 1)); + } + if (dockBattery3 != null) { + lightsOnObjs.add(ObjectAnimator.ofFloat(dockBattery3, View.ALPHA, 1)); + } + lightsOnObjs.add(ObjectAnimator.ofFloat(clock, View.ALPHA, 1)); + final AnimatorSet lightsOutAnim = new AnimatorSet(); lightsOutAnim.playTogether( - ObjectAnimator.ofFloat(notifications, View.ALPHA, 0), - ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 0), - ObjectAnimator.ofFloat(signal, View.ALPHA, 0), - ObjectAnimator.ofFloat(signal2, View.ALPHA, 0), - ObjectAnimator.ofFloat(battery, View.ALPHA, 0.5f), - ObjectAnimator.ofFloat(battery2, View.ALPHA, 0.5f), - ObjectAnimator.ofFloat(battery3, View.ALPHA, 0.5f), - ObjectAnimator.ofFloat(clock, View.ALPHA, 0.5f) - ); + lightsOutObjs.toArray(new ObjectAnimator[lightsOutObjs.size()])); lightsOutAnim.setDuration(750); final AnimatorSet lightsOnAnim = new AnimatorSet(); lightsOnAnim.playTogether( - ObjectAnimator.ofFloat(notifications, View.ALPHA, 1), - ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 1), - ObjectAnimator.ofFloat(signal, View.ALPHA, 1), - ObjectAnimator.ofFloat(signal2, View.ALPHA, 1), - ObjectAnimator.ofFloat(battery, View.ALPHA, 1), - ObjectAnimator.ofFloat(battery2, View.ALPHA, 1), - ObjectAnimator.ofFloat(battery3, View.ALPHA, 1), - ObjectAnimator.ofFloat(clock, View.ALPHA, 1) - ); + lightsOnObjs.toArray(new ObjectAnimator[lightsOnObjs.size()])); lightsOnAnim.setDuration(250); mLightsOutAnimation = lightsOutAnim; |