diff options
5 files changed, 118 insertions, 1 deletions
diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 88b01c7..809adcd 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -31,4 +31,14 @@ android:scaleType="center" android:contentDescription="@string/accessibility_camera_button" systemui:glowBackground="@drawable/ic_sysbar_highlight_land" /> + + <com.android.systemui.statusbar.phone.KeyguardIndicationTextView + android:id="@+id/keyguard_indication_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="100dp" + android:layout_gravity="bottom|center_horizontal" + android:textStyle="italic" + android:textAppearance="?android:attr/textAppearanceMedium"/> + </com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
\ No newline at end of file diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index f3c956c..b4a13d4 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -546,4 +546,10 @@ <plurals name="keyguard_more_overflow_text"> <item quantity="other">%d more</item> </plurals> + + <!-- Shows to explain the double tap interaction with notifications: After tapping a notification on Keyguard, this will explain users to tap again to launch a notification. [CHAR LIMIT=60] --> + <string name="notification_tap_again">Tap again to open</string> + + <!-- Shows when people have pressed the unlock icon to explain how to unlock. [CHAR LIMIT=60] --> + <string name="keyguard_unlock">Swipe up to unlock</string> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java new file mode 100644 index 0000000..769b1b1 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java @@ -0,0 +1,62 @@ +/* + * 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 + */ + +package com.android.systemui.statusbar.phone; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.TextView; + +/** + * A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open"). + */ +public class KeyguardIndicationTextView extends TextView { + + public KeyguardIndicationTextView(Context context) { + super(context); + } + + public KeyguardIndicationTextView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public KeyguardIndicationTextView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public KeyguardIndicationTextView(Context context, AttributeSet attrs, int defStyleAttr, + int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + /** + * Changes the text with an animation and makes sure a single indication is shown long enough. + * + * @param text The text to show. + */ + public void switchIndication(CharSequence text) { + + // TODO: Animation, make sure that we will show one indication long enough. + setText(text); + } + + /** + * See {@link #switchIndication}. + */ + public void switchIndication(int textResId) { + switchIndication(getResources().getText(textResId)); + } +} 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 7f1ddaf..698aba4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -232,6 +232,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { View mNotificationPanelHeader; View mKeyguardStatusView; View mKeyguardBottomArea; + KeyguardIndicationTextView mKeyguardIndicationTextView; + + // TODO: Fetch phrase from search/hotword provider. + String mKeyguardHotwordPhrase = ""; int mKeyguardMaxNotificationCount; View mDateTimeView; View mClearButton; @@ -618,7 +622,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { mNotificationPanelHeader = mStatusBarWindow.findViewById(R.id.header); mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view); mKeyguardBottomArea = mStatusBarWindow.findViewById(R.id.keyguard_bottom_area); - + mKeyguardIndicationTextView = (KeyguardIndicationTextView) mStatusBarWindow.findViewById( + R.id.keyguard_indication_text); mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); mClearButton.setAlpha(0f); @@ -2942,6 +2947,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { } mKeyguardStatusView.setVisibility(View.VISIBLE); mKeyguardBottomArea.setVisibility(View.VISIBLE); + mKeyguardIndicationTextView.setVisibility(View.VISIBLE); + mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase); mNotificationPanelHeader.setVisibility(View.GONE); mKeyguardFlipper.setVisibility(View.VISIBLE); @@ -2949,6 +2956,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { } else { mKeyguardStatusView.setVisibility(View.GONE); mKeyguardBottomArea.setVisibility(View.GONE); + mKeyguardIndicationTextView.setVisibility(View.GONE); mNotificationPanelHeader.setVisibility(View.VISIBLE); mKeyguardFlipper.setVisibility(View.GONE); @@ -3004,10 +3012,29 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { @Override public void onActivated(View view) { userActivity(); + mKeyguardIndicationTextView.switchIndication(R.string.notification_tap_again); super.onActivated(view); } @Override + public void onReset(View view) { + super.onReset(view); + mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase); + } + + public void onTrackingStarted() { + if (mOnKeyguard) { + mKeyguardIndicationTextView.switchIndication(R.string.keyguard_unlock); + } + } + + public void onTrackingStopped() { + if (mOnKeyguard) { + mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase); + } + } + + @Override protected int getMaxKeyguardNotifications() { return mKeyguardMaxNotificationCount; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 6ba18b3..bf7dd5c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -160,6 +160,18 @@ public class PhoneStatusBarView extends PanelBar { } @Override + public void onTrackingStarted(PanelView panel) { + super.onTrackingStarted(panel); + mBar.onTrackingStarted(); + } + + @Override + public void onTrackingStopped(PanelView panel) { + super.onTrackingStopped(panel); + mBar.onTrackingStopped(); + } + + @Override public boolean onInterceptTouchEvent(MotionEvent event) { return mBar.interceptTouchEvent(event) || super.onInterceptTouchEvent(event); } |