Improved graphics for the intruder alert.
Change-Id: I9aa6c8995da39f332b724fabe67ed5efe584552f
This commit is contained in:
14
core/res/res/anim/priority_alert_enter.xml
Normal file
14
core/res/res/anim/priority_alert_enter.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<scale
|
||||
android:interpolator="@android:anim/overshoot_interpolator"
|
||||
android:fromXScale="0.7" android:toXScale="1.0"
|
||||
android:fromYScale="0.7" android:toYScale="1.0"
|
||||
android:pivotX="50%" android:pivotY="50%"
|
||||
android:duration="@android:integer/config_shortAnimTime" />
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:duration="@android:integer/config_shortAnimTime" />
|
||||
</set>
|
14
core/res/res/anim/priority_alert_exit.xml
Normal file
14
core/res/res/anim/priority_alert_exit.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<scale
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:fromXScale="1.0" android:toXScale="0.7"
|
||||
android:fromYScale="1.0" android:toYScale="0.7"
|
||||
android:pivotX="50%" android:pivotY="50%"
|
||||
android:duration="@android:integer/config_shortAnimTime" />
|
||||
<alpha
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:fromAlpha="1.0" android:toAlpha="0.0"
|
||||
android:duration="@android:integer/config_shortAnimTime" />
|
||||
</set>
|
@ -88,6 +88,13 @@
|
||||
<item name="windowExitAnimation">@anim/status_bar_exit</item>
|
||||
</style>
|
||||
|
||||
<!-- {@hide} -->
|
||||
<style name="Animation.StatusBar.IntruderAlert"
|
||||
parent="@android:style/Animation.StatusBar">
|
||||
<item name="android:windowEnterAnimation">@anim/priority_alert_enter</item>
|
||||
<item name="android:windowExitAnimation">@anim/priority_alert_exit</item>
|
||||
</style>
|
||||
|
||||
<!-- Standard animations for a translucent window or activity. This
|
||||
style is <em>not<em> used by default for the translucent theme
|
||||
(since translucent activities are a special case that have no
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
23
packages/SystemUI/res/drawable/alert_bar_background.xml
Normal file
23
packages/SystemUI/res/drawable/alert_bar_background.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2008 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/alert_bar_background_pressed" />
|
||||
<item
|
||||
android:drawable="@drawable/alert_bar_background_normal" />
|
||||
</selector>
|
||||
|
@ -21,29 +21,35 @@
|
||||
<!-- android:background="@drawable/status_bar_closed_default_background" -->
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:background="@drawable/alert_bar_background"
|
||||
android:orientation="horizontal"
|
||||
android:focusable="true"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
android:layout_height="32dip"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingLeft="8dip"
|
||||
android:paddingRight="8dip"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/intruder_alert_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="6dip"
|
||||
android:gravity="center"
|
||||
android:animationCache="false"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/alert_bar_background"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/alertIcon"
|
||||
android:layout_width="25dip"
|
||||
android:layout_height="25dip"
|
||||
android:paddingLeft="6dip"
|
||||
android:layout_marginRight="8dip"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/alertText"
|
||||
android:textAppearance="@*android:style/TextAppearance.StatusBar.EventContent"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.IntruderAlert"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
|
@ -22,6 +22,7 @@
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="TextAppearance.StatusBar.IntruderAlert"
|
||||
parent="@android:style/TextAppearance.StatusBar">
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -357,7 +357,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
|
||||
|
||||
lp = new WindowManager.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
height,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
@ -366,9 +366,9 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
|
||||
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
|
||||
PixelFormat.TRANSLUCENT);
|
||||
lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
|
||||
lp.y += height * 1.5; // for now
|
||||
lp.y += height * 1.5; // FIXME
|
||||
lp.setTitle("IntruderAlert");
|
||||
lp.windowAnimations = android.R.style.Animation_Dialog;
|
||||
lp.windowAnimations = com.android.internal.R.style.Animation_StatusBar_IntruderAlert;
|
||||
|
||||
WindowManagerImpl.getDefault().addView(mIntruderAlertView, lp);
|
||||
}
|
||||
@ -417,7 +417,8 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
|
||||
iconView.getStatusBarIcon()));
|
||||
alertText.setText(notification.notification.tickerText);
|
||||
|
||||
mIntruderAlertView.setOnClickListener(
|
||||
View button = mIntruderAlertView.findViewById(R.id.intruder_alert_content);
|
||||
button.setOnClickListener(
|
||||
new Launcher(notification.notification.contentIntent,
|
||||
notification.pkg, notification.tag, notification.id));
|
||||
|
||||
|
Reference in New Issue
Block a user