* commit '40e262e05e55a3a611018c5912dc67be901ce6ad': Notification & settings panel help.
BIN
packages/SystemUI/res/drawable-hdpi/arrow_dashed.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
packages/SystemUI/res/drawable-hdpi/btn_cling_normal.9.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
packages/SystemUI/res/drawable-hdpi/btn_cling_pressed.9.png
Normal file
|
After Width: | Height: | Size: 467 B |
BIN
packages/SystemUI/res/drawable-mdpi/arrow_dashed.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
packages/SystemUI/res/drawable-mdpi/btn_cling_normal.9.png
Normal file
|
After Width: | Height: | Size: 245 B |
BIN
packages/SystemUI/res/drawable-mdpi/btn_cling_pressed.9.png
Normal file
|
After Width: | Height: | Size: 370 B |
BIN
packages/SystemUI/res/drawable-xhdpi/arrow_dashed.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
packages/SystemUI/res/drawable-xhdpi/btn_cling_normal.9.png
Normal file
|
After Width: | Height: | Size: 400 B |
BIN
packages/SystemUI/res/drawable-xhdpi/btn_cling_pressed.9.png
Normal file
|
After Width: | Height: | Size: 601 B |
20
packages/SystemUI/res/drawable/cling_button_bg.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2012 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true" android:drawable="@drawable/btn_cling_pressed" />
|
||||||
|
<item android:drawable="@drawable/btn_cling_normal" />
|
||||||
|
</selector>
|
||||||
71
packages/SystemUI/res/layout-land/status_bar_help.xml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
**
|
||||||
|
** Copyright 2012, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- This is the combined status bar / notification panel window. -->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/status_bar_cling"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:paddingRight="40dp"
|
||||||
|
android:background="#DD000000"
|
||||||
|
android:focusable="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="top|left"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:src="@drawable/arrow_dashed"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
style="@style/ClingTitleText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/status_bar_help_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/ClingText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="30dp"
|
||||||
|
android:text="@string/status_bar_help_text" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/ok"
|
||||||
|
style="@style/ClingButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="50dp"
|
||||||
|
android:paddingRight="50dp"
|
||||||
|
android:text="@android:string/ok" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
63
packages/SystemUI/res/layout/status_bar_help.xml
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
**
|
||||||
|
** Copyright 2012, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- This is the combined status bar / notification panel window. -->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/status_bar_cling"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:paddingRight="40dp"
|
||||||
|
android:background="#DD000000"
|
||||||
|
android:focusable="true"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="top|left"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:src="@drawable/arrow_dashed"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/ClingTitleText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/status_bar_help_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/ClingText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="30dp"
|
||||||
|
android:text="@string/status_bar_help_text" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/ok"
|
||||||
|
style="@style/ClingButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="50dp"
|
||||||
|
android:paddingRight="50dp"
|
||||||
|
android:text="@android:string/ok" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -48,4 +48,14 @@
|
|||||||
/>
|
/>
|
||||||
</com.android.systemui.statusbar.phone.PanelHolder>
|
</com.android.systemui.statusbar.phone.PanelHolder>
|
||||||
|
|
||||||
|
<ViewStub
|
||||||
|
android:layout="@layout/status_bar_help"
|
||||||
|
android:id="@+id/status_bar_cling_stub"
|
||||||
|
android:inflatedId="@+id/status_bar_cling"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="@*android:dimen/status_bar_height"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
</com.android.systemui.statusbar.phone.StatusBarWindowView>
|
</com.android.systemui.statusbar.phone.StatusBarWindowView>
|
||||||
|
|||||||
@@ -454,4 +454,9 @@
|
|||||||
<string name="quick_settings_brightness_dialog_title">Brightness</string>
|
<string name="quick_settings_brightness_dialog_title">Brightness</string>
|
||||||
<!-- QuickSettings: Brightness dialog auto brightness button [CHAR LIMIT=NONE] -->
|
<!-- QuickSettings: Brightness dialog auto brightness button [CHAR LIMIT=NONE] -->
|
||||||
<string name="quick_settings_brightness_dialog_auto_brightness_label">AUTO</string>
|
<string name="quick_settings_brightness_dialog_auto_brightness_label">AUTO</string>
|
||||||
|
|
||||||
|
<!-- Title of help text shown when the notification panel is pulled down for the very first time. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="status_bar_help_title">Notifications appear here</string>
|
||||||
|
<!-- Body of help text shown when the notification panel is pulled down for the very first time. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="status_bar_help_text">Access them anytime by swiping down.\nSwipe down again for system controls.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -137,4 +137,33 @@
|
|||||||
<item name="android:textSize">14dp</item>
|
<item name="android:textSize">14dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="ClingButton">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:paddingTop">10dp</item>
|
||||||
|
<item name="android:paddingBottom">15dp</item>
|
||||||
|
<item name="android:paddingLeft">35dp</item>
|
||||||
|
<item name="android:paddingRight">35dp</item>
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
<item name="android:background">@drawable/cling_button_bg</item>
|
||||||
|
</style>
|
||||||
|
<style name="ClingTitleText">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:layout_marginBottom">5dp</item>
|
||||||
|
<item name="android:textSize">23sp</item>
|
||||||
|
<item name="android:textColor">#49C0EC</item>
|
||||||
|
<item name="android:shadowColor">#000000</item>
|
||||||
|
<item name="android:shadowDy">2</item>
|
||||||
|
<item name="android:shadowRadius">2.0</item>
|
||||||
|
</style>
|
||||||
|
<style name="ClingText">
|
||||||
|
<item name="android:textSize">15sp</item>
|
||||||
|
<item name="android:textColor">#FFFFFF</item>
|
||||||
|
<item name="android:shadowColor">#000000</item>
|
||||||
|
<item name="android:shadowDy">2</item>
|
||||||
|
<item name="android:shadowRadius">2.0</item>
|
||||||
|
<item name="android:lineSpacingMultiplier">1.1</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class PanelView extends FrameLayout {
|
|||||||
float deltaX = event.getRawX() - event.getX();
|
float deltaX = event.getRawX() - event.getX();
|
||||||
float deltaY = event.getRawY() - event.getY();
|
float deltaY = event.getRawY() - event.getY();
|
||||||
event.offsetLocation(deltaX, deltaY);
|
event.offsetLocation(deltaX, deltaY);
|
||||||
mVelocityTracker.addMovement(event);
|
if (mVelocityTracker != null) mVelocityTracker.addMovement(event);
|
||||||
event.offsetLocation(-deltaX, -deltaY);
|
event.offsetLocation(-deltaX, -deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -60,6 +61,7 @@ import android.view.VelocityTracker;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
|
import android.view.ViewStub;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
@@ -89,6 +91,7 @@ import com.android.systemui.statusbar.policy.LocationController;
|
|||||||
import com.android.systemui.statusbar.policy.NetworkController;
|
import com.android.systemui.statusbar.policy.NetworkController;
|
||||||
import com.android.systemui.statusbar.policy.NotificationRowLayout;
|
import com.android.systemui.statusbar.policy.NotificationRowLayout;
|
||||||
import com.android.systemui.statusbar.policy.OnSizeChangedListener;
|
import com.android.systemui.statusbar.policy.OnSizeChangedListener;
|
||||||
|
import com.android.systemui.statusbar.policy.Prefs;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -101,6 +104,8 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
public static final boolean DUMPTRUCK = true; // extra dumpsys info
|
public static final boolean DUMPTRUCK = true; // extra dumpsys info
|
||||||
public static final boolean DEBUG_GESTURES = false;
|
public static final boolean DEBUG_GESTURES = false;
|
||||||
|
|
||||||
|
public static final boolean DEBUG_CLINGS = false;
|
||||||
|
|
||||||
// additional instrumentation for testing purposes; intended to be left on during development
|
// additional instrumentation for testing purposes; intended to be left on during development
|
||||||
public static final boolean CHATTY = DEBUG;
|
public static final boolean CHATTY = DEBUG;
|
||||||
|
|
||||||
@@ -223,6 +228,11 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
boolean mTracking;
|
boolean mTracking;
|
||||||
VelocityTracker mVelocityTracker;
|
VelocityTracker mVelocityTracker;
|
||||||
|
|
||||||
|
// help screen
|
||||||
|
private boolean mClingShown;
|
||||||
|
private ViewGroup mCling;
|
||||||
|
private boolean mSuppressStatusBarDrags; // while a cling is up, briefly deaden the bar to give things time to settle
|
||||||
|
|
||||||
boolean mAnimating;
|
boolean mAnimating;
|
||||||
boolean mClosing; // only valid when mAnimating; indicates the initial acceleration
|
boolean mClosing; // only valid when mAnimating; indicates the initial acceleration
|
||||||
float mAnimY;
|
float mAnimY;
|
||||||
@@ -477,6 +487,14 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
R.color.notification_panel_solid_background)));
|
R.color.notification_panel_solid_background)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mClingShown = ! (DEBUG_CLINGS
|
||||||
|
|| !Prefs.read(mContext).getBoolean(Prefs.SHOWN_QUICK_SETTINGS_HELP, false));
|
||||||
|
|
||||||
|
// robots don't need help
|
||||||
|
if (ActivityManager.isRunningInTestHarness()) {
|
||||||
|
mClingShown = true;
|
||||||
|
}
|
||||||
|
|
||||||
// final ImageView wimaxRSSI =
|
// final ImageView wimaxRSSI =
|
||||||
// (ImageView)sb.findViewById(R.id.wimax_signal);
|
// (ImageView)sb.findViewById(R.id.wimax_signal);
|
||||||
// if (wimaxRSSI != null) {
|
// if (wimaxRSSI != null) {
|
||||||
@@ -1345,7 +1363,58 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean interceptTouchEvent(MotionEvent event) {
|
public boolean isClinging() {
|
||||||
|
return mCling != null && mCling.getVisibility() == View.VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideCling() {
|
||||||
|
if (isClinging()) {
|
||||||
|
mCling.animate().alpha(0f).setDuration(250).start();
|
||||||
|
mCling.setVisibility(View.GONE);
|
||||||
|
mSuppressStatusBarDrags = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showCling() {
|
||||||
|
mSuppressStatusBarDrags = true;
|
||||||
|
|
||||||
|
mHandler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// lazily inflate this to accommodate orientation change
|
||||||
|
ViewStub stub = (ViewStub) mStatusBarWindow.findViewById(R.id.status_bar_cling_stub);
|
||||||
|
mCling = (ViewGroup) stub.inflate();
|
||||||
|
mCling.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
return true; // e eats everything
|
||||||
|
}});
|
||||||
|
mCling.findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
hideCling();
|
||||||
|
}});
|
||||||
|
|
||||||
|
mCling.setAlpha(0f);
|
||||||
|
mCling.setVisibility(View.VISIBLE);
|
||||||
|
mCling.animate().alpha(1f);
|
||||||
|
|
||||||
|
mClingShown = true;
|
||||||
|
SharedPreferences.Editor editor = Prefs.edit(mContext);
|
||||||
|
editor.putBoolean(Prefs.SHOWN_QUICK_SETTINGS_HELP, true);
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
makeExpandedVisible(true); // enforce visibility in case the shade is still animating closed
|
||||||
|
animateExpandNotificationsPanel();
|
||||||
|
|
||||||
|
mSuppressStatusBarDrags = false;
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
animateExpandNotificationsPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean interceptTouchEvent(MotionEvent event) {
|
||||||
if (SPEW) {
|
if (SPEW) {
|
||||||
Slog.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled="
|
Slog.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled="
|
||||||
+ mDisabled + " mTracking=" + mTracking);
|
+ mDisabled + " mTracking=" + mTracking);
|
||||||
@@ -1362,6 +1431,21 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
mGestureRec.add(event);
|
mGestureRec.add(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cling (first-run help) handling.
|
||||||
|
// The cling is supposed to show the first time you drag, or even tap, the status bar.
|
||||||
|
// It should show the notification panel, then fade in after half a second, giving you
|
||||||
|
// an explanation of what just happened, as well as teach you how to access quick
|
||||||
|
// settings (another drag). The user can dismiss the cling by clicking OK or by
|
||||||
|
// dragging quick settings into view.
|
||||||
|
final int act = event.getActionMasked();
|
||||||
|
if (mSuppressStatusBarDrags) {
|
||||||
|
return true;
|
||||||
|
} else if (act == MotionEvent.ACTION_UP && !mClingShown) {
|
||||||
|
showCling();
|
||||||
|
} else {
|
||||||
|
hideCling();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class Prefs {
|
|||||||
public static final boolean DO_NOT_DISTURB_DEFAULT = false;
|
public static final boolean DO_NOT_DISTURB_DEFAULT = false;
|
||||||
|
|
||||||
public static final String SHOWN_COMPAT_MODE_HELP = "shown_compat_mode_help";
|
public static final String SHOWN_COMPAT_MODE_HELP = "shown_compat_mode_help";
|
||||||
|
public static final String SHOWN_QUICK_SETTINGS_HELP = "shown_quick_settings_help";
|
||||||
|
|
||||||
public static SharedPreferences read(Context context) {
|
public static SharedPreferences read(Context context) {
|
||||||
return context.getSharedPreferences(Prefs.SHARED_PREFS_NAME, Context.MODE_PRIVATE);
|
return context.getSharedPreferences(Prefs.SHARED_PREFS_NAME, Context.MODE_PRIVATE);
|
||||||
|
|||||||