Heads up, this post is meant for platform developers and not application developers. One of the annoying thing about Android and other operation systems is having to reach out to expand and collapse the notification bar. This wasn't a problem with devices less than 4.7 inch dimensions. However, this became really annoying with Nexus 6 and its not possible to use one hand to expand the notification bar anymore (not even with large ones).
This could easily be resolved by providing a short cut in the navigation bar which can be handled one hand at all times. Wonder why Google doesn't implement something similar in stock AOSP.
Anyways, with the shortcut the usage looks something similar to this,
In this case, the recent apps button is hijacked to illustrate but the actual functionality could very well be provided with an additional button in the Navigation Bar.
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -741,10 +741,19 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
return mNaturalBarHeight;
}
+ private boolean mNotificationExpanded = false;
+
private View.OnClickListener mRecentsClickListener = new View.OnClickListener() {
public void onClick(View v) {
+ if ( mNotificationExpanded ) {
+ PhoneStatusBar.this.animateCollapsePanels();
+ } else {
+ PhoneStatusBar.this.animateExpandNotificationsPanel();
+ }
+
+ mNotificationExpanded = !mNotificationExpanded;
}
};
Note that StatusBarManager has APIs to expand and collapse panels (expandNotificationsPanel and collapsePanels) . However, the entire class is hidden from the SDK. Any attempt to use these APIs via reflection is going to fail as StatusBarManager Service enforces permission checks and that can't be bypassed.
No comments:
Post a Comment