diff options
author | Daniel Sandler <dsandler@google.com> | 2010-12-03 14:52:10 -0500 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-12-03 15:55:04 -0500 |
commit | 3e8f5a2c1beb4b918856063880e05125946e4347 (patch) | |
tree | 2875e2394cf6e6043323ee9c721f7baa2e364307 | |
parent | bcdf40b42fb8a4313461233d2db1eb959e2c6a70 (diff) | |
download | frameworks_base-3e8f5a2c1beb4b918856063880e05125946e4347.zip frameworks_base-3e8f5a2c1beb4b918856063880e05125946e4347.tar.gz frameworks_base-3e8f5a2c1beb4b918856063880e05125946e4347.tar.bz2 |
Hide navigation buttons and clock on lockscreen.
(This introduces a StatusBarManager disable flag to ask the
status bar to hide just the clock, which might be useful in
other situations, such as clock/dock apps.)
Bug: 3130393
Change-Id: Ia08627508518e2ed3713ffbf856e4ec42952b3a8
5 files changed, 51 insertions, 9 deletions
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index fa7f794..97e6931 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -61,10 +61,16 @@ public class StatusBarManager { /** * Flag for {@link #disable} to hide only the navigation buttons. Don't use this - * unless you're the setup wizard. + * unless you're a special part of the system UI (i.e., setup wizard, keyguard). */ public static final int DISABLE_NAVIGATION = 0x00000020; + /** + * Flag for {@link #disable} to hide only the clock. You might use this if your activity has + * its own clock making the status bar's clock redundant. + */ + public static final int DISABLE_CLOCK = 0x00000040; + /** * Re-enable all of the status bar features that you've disabled. diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index 666bfdc..cd67d1a 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -76,8 +76,23 @@ android:textColor="#2e2e2e" /> </com.android.systemui.statusbar.tablet.HoloClock> + <TextView + android:id="@+id/network_text" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginTop="12dp" + android:layout_marginRight="6dip" + android:layout_marginLeft="6dip" + android:gravity="center" + android:singleLine="true" + android:visibility="gone" + android:textSize="14dip" + android:textColor="#606060" + /> + <LinearLayout - android:layout_width="48dip" + android:id="@+id/signal_battery_cluster" + android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="center" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 563b8ef..b0f6a18 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -165,6 +165,8 @@ public class TabletStatusBar extends StatusBar { (ImageView)mNotificationPanel.findViewById(R.id.network_type)); mNetworkController.addLabelView( (TextView)mNotificationPanel.findViewById(R.id.network_text)); + mNetworkController.addLabelView( + (TextView)mBarContents.findViewById(R.id.network_text)); mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel); @@ -579,12 +581,28 @@ public class TabletStatusBar extends StatusBar { setAreThereNotifications(); } + public void showClock(boolean show) { + View clock = mBarContents.findViewById(R.id.clock); + View network_text = mBarContents.findViewById(R.id.network_text); + if (clock != null) { + clock.setVisibility(show ? View.VISIBLE : View.GONE); + } + if (network_text != null) { + network_text.setVisibility((!show) ? View.VISIBLE : View.GONE); + } + } + public void disable(int state) { int old = mDisabled; int diff = state ^ old; mDisabled = state; // act accordingly + if ((diff & StatusBarManager.DISABLE_CLOCK) != 0) { + boolean show = (state & StatusBarManager.DISABLE_CLOCK) == 0; + Slog.d(TAG, "DISABLE_CLOCK: " + (show ? "no" : "yes")); + showClock(show); + } if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) { if ((state & StatusBarManager.DISABLE_EXPAND) != 0) { Slog.d(TAG, "DISABLE_EXPAND: yes"); diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java index 72af34d..c0c3afd 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -1100,7 +1100,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback, boolean enable = !mShowing || (mHidden && !isSecure()); mStatusBarManager.disable(enable ? StatusBarManager.DISABLE_NONE : - StatusBarManager.DISABLE_EXPAND); + ( StatusBarManager.DISABLE_EXPAND + | StatusBarManager.DISABLE_NAVIGATION + | StatusBarManager.DISABLE_CLOCK)); } } diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 7e69ee4..44c7d72 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -173,22 +173,23 @@ public class StatusBarTest extends TestActivity mStatusBarManager.disable(StatusBarManager.DISABLE_NAVIGATION); } }, + new Test("Disable Clock") { + public void run() { + mStatusBarManager.disable(StatusBarManager.DISABLE_CLOCK); + } + }, new Test("Disable everything in 3 sec") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND - | StatusBarManager.DISABLE_NOTIFICATION_ICONS - | StatusBarManager.DISABLE_NOTIFICATION_ALERTS - | StatusBarManager.DISABLE_SYSTEM_INFO - | StatusBarManager.DISABLE_NAVIGATION); + mStatusBarManager.disable(~StatusBarManager.DISABLE_NONE); } }, 3000); } }, new Test("Enable everything") { public void run() { - mStatusBarManager.disable(0); + mStatusBarManager.disable(StatusBarManager.DISABLE_NONE); } }, new Test("Enable everything in 3 sec.") { |