Merge "Add text view for double-tap and unlock hint on Keyguard."
This commit is contained in:
@@ -31,4 +31,14 @@
|
|||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:contentDescription="@string/accessibility_camera_button"
|
android:contentDescription="@string/accessibility_camera_button"
|
||||||
systemui:glowBackground="@drawable/ic_sysbar_highlight_land" />
|
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>
|
</com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
|
||||||
@@ -546,4 +546,10 @@
|
|||||||
<plurals name="keyguard_more_overflow_text">
|
<plurals name="keyguard_more_overflow_text">
|
||||||
<item quantity="other">%d more</item>
|
<item quantity="other">%d more</item>
|
||||||
</plurals>
|
</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>
|
</resources>
|
||||||
|
|||||||
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -232,6 +232,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
View mNotificationPanelHeader;
|
View mNotificationPanelHeader;
|
||||||
View mKeyguardStatusView;
|
View mKeyguardStatusView;
|
||||||
View mKeyguardBottomArea;
|
View mKeyguardBottomArea;
|
||||||
|
KeyguardIndicationTextView mKeyguardIndicationTextView;
|
||||||
|
|
||||||
|
// TODO: Fetch phrase from search/hotword provider.
|
||||||
|
String mKeyguardHotwordPhrase = "";
|
||||||
int mKeyguardMaxNotificationCount;
|
int mKeyguardMaxNotificationCount;
|
||||||
View mDateTimeView;
|
View mDateTimeView;
|
||||||
View mClearButton;
|
View mClearButton;
|
||||||
@@ -618,7 +622,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
mNotificationPanelHeader = mStatusBarWindow.findViewById(R.id.header);
|
mNotificationPanelHeader = mStatusBarWindow.findViewById(R.id.header);
|
||||||
mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view);
|
mKeyguardStatusView = mStatusBarWindow.findViewById(R.id.keyguard_status_view);
|
||||||
mKeyguardBottomArea = mStatusBarWindow.findViewById(R.id.keyguard_bottom_area);
|
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 = mStatusBarWindow.findViewById(R.id.clear_all_button);
|
||||||
mClearButton.setOnClickListener(mClearButtonListener);
|
mClearButton.setOnClickListener(mClearButtonListener);
|
||||||
mClearButton.setAlpha(0f);
|
mClearButton.setAlpha(0f);
|
||||||
@@ -2942,6 +2947,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
}
|
}
|
||||||
mKeyguardStatusView.setVisibility(View.VISIBLE);
|
mKeyguardStatusView.setVisibility(View.VISIBLE);
|
||||||
mKeyguardBottomArea.setVisibility(View.VISIBLE);
|
mKeyguardBottomArea.setVisibility(View.VISIBLE);
|
||||||
|
mKeyguardIndicationTextView.setVisibility(View.VISIBLE);
|
||||||
|
mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase);
|
||||||
mNotificationPanelHeader.setVisibility(View.GONE);
|
mNotificationPanelHeader.setVisibility(View.GONE);
|
||||||
|
|
||||||
mKeyguardFlipper.setVisibility(View.VISIBLE);
|
mKeyguardFlipper.setVisibility(View.VISIBLE);
|
||||||
@@ -2949,6 +2956,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
} else {
|
} else {
|
||||||
mKeyguardStatusView.setVisibility(View.GONE);
|
mKeyguardStatusView.setVisibility(View.GONE);
|
||||||
mKeyguardBottomArea.setVisibility(View.GONE);
|
mKeyguardBottomArea.setVisibility(View.GONE);
|
||||||
|
mKeyguardIndicationTextView.setVisibility(View.GONE);
|
||||||
mNotificationPanelHeader.setVisibility(View.VISIBLE);
|
mNotificationPanelHeader.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
mKeyguardFlipper.setVisibility(View.GONE);
|
mKeyguardFlipper.setVisibility(View.GONE);
|
||||||
@@ -3004,9 +3012,28 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivated(View view) {
|
public void onActivated(View view) {
|
||||||
userActivity();
|
userActivity();
|
||||||
|
mKeyguardIndicationTextView.switchIndication(R.string.notification_tap_again);
|
||||||
super.onActivated(view);
|
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
|
@Override
|
||||||
protected int getMaxKeyguardNotifications() {
|
protected int getMaxKeyguardNotifications() {
|
||||||
return mKeyguardMaxNotificationCount;
|
return mKeyguardMaxNotificationCount;
|
||||||
|
|||||||
@@ -159,6 +159,18 @@ public class PhoneStatusBarView extends PanelBar {
|
|||||||
return barConsumedEvent || super.onTouchEvent(event);
|
return barConsumedEvent || super.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrackingStarted(PanelView panel) {
|
||||||
|
super.onTrackingStarted(panel);
|
||||||
|
mBar.onTrackingStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrackingStopped(PanelView panel) {
|
||||||
|
super.onTrackingStopped(panel);
|
||||||
|
mBar.onTrackingStopped();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||||
return mBar.interceptTouchEvent(event) || super.onInterceptTouchEvent(event);
|
return mBar.interceptTouchEvent(event) || super.onInterceptTouchEvent(event);
|
||||||
|
|||||||
Reference in New Issue
Block a user