am 503007dd: Checkpoint status bar factoring. Now it builds and doesn\'t crash at boot.
@@ -1567,23 +1567,6 @@
|
||||
<!-- A format string for 12-hour time of day, just the hour, not the minute, with capital "AM" or "PM" (example: "3PM"). -->
|
||||
<string name="hour_cap_ampm">"<xliff:g id="hour" example="3">%-l</xliff:g><xliff:g id="ampm" example="PM">%p</xliff:g>"</string>
|
||||
|
||||
<!-- The text for the button in the notification window-shade that clears
|
||||
all of the currently visible notifications. -->
|
||||
<string name="status_bar_clear_all_button">Clear</string>
|
||||
|
||||
<!-- The label in the bar at the top of the status bar when there are no notifications
|
||||
showing. -->
|
||||
<string name="status_bar_no_notifications_title">No notifications</string>
|
||||
|
||||
<!-- The label for the group of notifications for ongoing events in the opened version of
|
||||
the status bar. An ongoing call is the prime example of this. The MP3 music player
|
||||
might be another example. -->
|
||||
<string name="status_bar_ongoing_events_title">Ongoing</string>
|
||||
|
||||
<!-- The label for the group of notifications for recent events in the opened version of
|
||||
the status bar. Recently received text messsages (SMS), emails, calendar alerts, etc. -->
|
||||
<string name="status_bar_latest_events_title">Notifications</string>
|
||||
|
||||
<!-- The big percent text in the middle of the battery icon that appears when you plug in
|
||||
the charger. -->
|
||||
<string name="battery_status_text_percent_format"><xliff:g id="number" example="50">%d</xliff:g><xliff:g id="percent" example="%">%%</xliff:g></string>
|
||||
|
||||
|
After Width: | Height: | Size: 894 B |
|
After Width: | Height: | Size: 541 B |
|
After Width: | Height: | Size: 830 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
BIN
packages/StatusBarPhone/res/drawable-hdpi/stat_notify_more.png
Executable file
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 945 B |
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 215 B |
|
After Width: | Height: | Size: 215 B |
BIN
packages/StatusBarPhone/res/drawable-hdpi/title_bar_shadow.9.png
Normal file
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 679 B |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 648 B |
|
After Width: | Height: | Size: 936 B |
|
After Width: | Height: | Size: 964 B |
BIN
packages/StatusBarPhone/res/drawable-mdpi/stat_notify_more.png
Normal file
|
After Width: | Height: | Size: 786 B |
|
After Width: | Height: | Size: 646 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 202 B |
BIN
packages/StatusBarPhone/res/drawable-mdpi/title_bar_shadow.9.png
Normal file
|
After Width: | Height: | Size: 173 B |
33
packages/StatusBarPhone/res/drawable/btn_default_small.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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_window_focused="false" android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_default_small_normal" />
|
||||
<item android:state_window_focused="false" android:state_enabled="false"
|
||||
android:drawable="@drawable/btn_default_small_normal_disable" />
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/btn_default_small_pressed" />
|
||||
<item android:state_focused="true" android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_default_small_selected" />
|
||||
<item android:state_enabled="true"
|
||||
android:drawable="@drawable/btn_default_small_normal" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/btn_default_small_normal_disable_focused" />
|
||||
<item
|
||||
android:drawable="@drawable/btn_default_small_normal_disable" />
|
||||
</selector>
|
||||
|
||||
144
packages/StatusBarPhone/res/layout/status_bar_expanded.xml
Normal file
@@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* apps/common/assets/default/default/skins/StatusBar.xml
|
||||
**
|
||||
** Copyright 2006, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<com.android.server.status.ExpandedView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingRight="3dp"
|
||||
android:background="@drawable/status_bar_header_background"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingBottom="1dp"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView android:id="@+id/plmnLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorSecondaryInverse"
|
||||
android:paddingLeft="4dp"
|
||||
/>
|
||||
<TextView android:id="@+id/spnLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorSecondaryInverse"
|
||||
android:paddingLeft="4dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView android:id="@+id/clear_all_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#ff000000"
|
||||
android:text="@string/status_bar_clear_all_button"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:background="@drawable/btn_default_small"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
<ScrollView
|
||||
android:id="@+id/scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fadingEdge="none"
|
||||
>
|
||||
<com.android.server.status.NotificationLinearLayout
|
||||
android:id="@+id/notificationLinearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<TextView android:id="@+id/noNotificationsTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/title_bar_portrait"
|
||||
android:paddingLeft="5dp"
|
||||
android:textAppearance="@style/TextAppearance.StatusBarTitle"
|
||||
android:text="@string/status_bar_no_notifications_title"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/ongoingTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/title_bar_portrait"
|
||||
android:paddingLeft="5dp"
|
||||
android:textAppearance="@style/TextAppearance.StatusBarTitle"
|
||||
android:text="@string/status_bar_ongoing_events_title"
|
||||
/>
|
||||
<LinearLayout android:id="@+id/ongoingItems"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/latestTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/title_bar_portrait"
|
||||
android:paddingLeft="5dp"
|
||||
android:textAppearance="@style/TextAppearance.StatusBarTitle"
|
||||
android:text="@string/status_bar_latest_events_title"
|
||||
/>
|
||||
<LinearLayout android:id="@+id/latestItems"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
/>
|
||||
</com.android.server.status.NotificationLinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/title_bar_shadow"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
</com.android.server.status.ExpandedView>
|
||||
48
packages/StatusBarPhone/res/layout/status_bar_tracking.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<com.android.server.status.TrackingView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:focusable="true"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
android:paddingBottom="0px"
|
||||
android:paddingLeft="0px"
|
||||
android:paddingRight="0px"
|
||||
>
|
||||
|
||||
<com.android.server.status.TrackingPatternView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<com.android.server.status.CloseDragHandle android:id="@+id/close"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/status_bar_close_on"/>
|
||||
|
||||
</com.android.server.status.CloseDragHandle>
|
||||
|
||||
</com.android.server.status.TrackingView>
|
||||
46
packages/StatusBarPhone/res/values/arrays.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* //device/apps/common/assets/res/any/colors.xml
|
||||
**
|
||||
** Copyright 2006, 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.
|
||||
*/
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Do not translate. Defines the slots for the right-hand side icons. That is to say, the
|
||||
icons in the status bar that are not notifications. -->
|
||||
<string-array name="status_bar_icon_order">
|
||||
<item><xliff:g id="id">clock</xliff:g></item>
|
||||
<item><xliff:g id="id">secure</xliff:g></item>
|
||||
<item><xliff:g id="id">alarm_clock</xliff:g></item>
|
||||
<item><xliff:g id="id">battery</xliff:g></item>
|
||||
<item><xliff:g id="id">phone_signal</xliff:g></item>
|
||||
<item><xliff:g id="id">phone_evdo_signal</xliff:g></item>
|
||||
<item><xliff:g id="id">data_connection</xliff:g></item>
|
||||
<item><xliff:g id="id">cdma_eri</xliff:g></item>
|
||||
<item><xliff:g id="id">tty</xliff:g></item>
|
||||
<item><xliff:g id="id">volume</xliff:g></item>
|
||||
<item><xliff:g id="id">mute</xliff:g></item>
|
||||
<item><xliff:g id="id">speakerphone</xliff:g></item>
|
||||
<item><xliff:g id="id">wifi</xliff:g></item>
|
||||
<item><xliff:g id="id">tty</xliff:g></item>
|
||||
<item><xliff:g id="id">bluetooth</xliff:g></item>
|
||||
<item><xliff:g id="id">gps</xliff:g></item>
|
||||
<item><xliff:g id="id">sync_active</xliff:g></item>
|
||||
<item><xliff:g id="id">sync_failing</xliff:g></item>
|
||||
<item><xliff:g id="id">ime</xliff:g></item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
22
packages/StatusBarPhone/res/values/dimens.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
* Copyright (c) 2006, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
|
||||
<dimen name="status_bar_edge_ignore">5dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -19,4 +19,22 @@
|
||||
<resources>
|
||||
<!-- Name of the status bar as seen in the applications info settings page. -->
|
||||
<string name="app_label">Status Bar</string>
|
||||
|
||||
<!-- The text for the button in the notification window-shade that clears
|
||||
all of the currently visible notifications. -->
|
||||
<string name="status_bar_clear_all_button">Clear</string>
|
||||
|
||||
<!-- The label in the bar at the top of the status bar when there are no notifications
|
||||
showing. -->
|
||||
<string name="status_bar_no_notifications_title">No notifications</string>
|
||||
|
||||
<!-- The label for the group of notifications for ongoing events in the opened version of
|
||||
the status bar. An ongoing call is the prime example of this. The MP3 music player
|
||||
might be another example. -->
|
||||
<string name="status_bar_ongoing_events_title">Ongoing</string>
|
||||
|
||||
<!-- The label for the group of notifications for recent events in the opened version of
|
||||
the status bar. Recently received text messsages (SMS), emails, calendar alerts, etc. -->
|
||||
<string name="status_bar_latest_events_title">Notifications</string>
|
||||
|
||||
</resources>
|
||||
|
||||
27
packages/StatusBarPhone/res/values/styles.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2006 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.
|
||||
-->
|
||||
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<style name="TextAppearance.StatusBarTitle" parent="@android:style/TextAppearance">
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RemoteViews.RemoteView;
|
||||
|
||||
@RemoteView
|
||||
public class AnimatedImageView extends ImageView {
|
||||
AnimationDrawable mAnim;
|
||||
boolean mAttached;
|
||||
|
||||
public AnimatedImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AnimatedImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
private void updateAnim() {
|
||||
Drawable drawable = getDrawable();
|
||||
if (mAttached && mAnim != null) {
|
||||
mAnim.stop();
|
||||
}
|
||||
if (drawable instanceof AnimationDrawable) {
|
||||
mAnim = (AnimationDrawable)drawable;
|
||||
if (mAttached) {
|
||||
mAnim.start();
|
||||
}
|
||||
} else {
|
||||
mAnim = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
super.setImageDrawable(drawable);
|
||||
updateAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
@android.view.RemotableViewMethod
|
||||
public void setImageResource(int resid) {
|
||||
super.setImageResource(resid);
|
||||
updateAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (mAnim != null) {
|
||||
mAnim.start();
|
||||
}
|
||||
mAttached = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (mAnim != null) {
|
||||
mAnim.stop();
|
||||
}
|
||||
mAttached = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
||||
public class CloseDragHandle extends LinearLayout {
|
||||
PhoneStatusBarService mService;
|
||||
|
||||
public CloseDragHandle(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that, if there is no target under us to receive the touch,
|
||||
* that we process it ourself. This makes sure that onInterceptTouchEvent()
|
||||
* is always called for the entire gesture.
|
||||
*/
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() != MotionEvent.ACTION_DOWN) {
|
||||
mService.interceptTouchEvent(event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
return mService.interceptTouchEvent(event)
|
||||
? true : super.onInterceptTouchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Slog;
|
||||
import android.widget.TextView;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public final class DateView extends TextView {
|
||||
private static final String TAG = "DateView";
|
||||
|
||||
private boolean mUpdating = false;
|
||||
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (action.equals(Intent.ACTION_TIME_TICK)
|
||||
|| action.equals(Intent.ACTION_TIMEZONE_CHANGED)) {
|
||||
updateClock();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public DateView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
setUpdates(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSuggestedMinimumWidth() {
|
||||
// makes the large background bitmap not force us to full width
|
||||
return 0;
|
||||
}
|
||||
|
||||
private final void updateClock() {
|
||||
Date now = new Date();
|
||||
setText(DateFormat.getDateInstance(DateFormat.LONG).format(now));
|
||||
}
|
||||
|
||||
void setUpdates(boolean update) {
|
||||
if (update != mUpdating) {
|
||||
mUpdating = update;
|
||||
if (update) {
|
||||
// Register for Intent broadcasts for the clock and battery
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_TIME_TICK);
|
||||
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
||||
mContext.registerReceiver(mIntentReceiver, filter, null, null);
|
||||
updateClock();
|
||||
} else {
|
||||
mContext.unregisterReceiver(mIntentReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.util.Slog;
|
||||
|
||||
|
||||
public class ExpandedView extends LinearLayout {
|
||||
PhoneStatusBarService mService;
|
||||
int mPrevHeight = -1;
|
||||
|
||||
public ExpandedView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
}
|
||||
|
||||
/** We want to shrink down to 0, and ignore the background. */
|
||||
@Override
|
||||
public int getSuggestedMinimumHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
int height = bottom - top;
|
||||
if (height != mPrevHeight) {
|
||||
//Slog.d(PhoneStatusBarService.TAG, "height changed old=" + mPrevHeight
|
||||
// + " new=" + height);
|
||||
mPrevHeight = height;
|
||||
mService.updateExpandedViewPos(PhoneStatusBarService.EXPANDED_LEAVE_ALONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Slog;
|
||||
|
||||
class FixedSizeDrawable extends Drawable {
|
||||
Drawable mDrawable;
|
||||
int mLeft;
|
||||
int mTop;
|
||||
int mRight;
|
||||
int mBottom;
|
||||
|
||||
FixedSizeDrawable(Drawable that) {
|
||||
mDrawable = that;
|
||||
}
|
||||
|
||||
public void setFixedBounds(int l, int t, int r, int b) {
|
||||
mLeft = l;
|
||||
mTop = t;
|
||||
mRight = r;
|
||||
mBottom = b;
|
||||
}
|
||||
|
||||
public void setBounds(Rect bounds) {
|
||||
mDrawable.setBounds(mLeft, mTop, mRight, mBottom);
|
||||
}
|
||||
|
||||
public void setBounds(int l, int t, int r, int b) {
|
||||
mDrawable.setBounds(mLeft, mTop, mRight, mBottom);
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas) {
|
||||
mDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
public int getOpacity() {
|
||||
return mDrawable.getOpacity();
|
||||
}
|
||||
|
||||
public void setAlpha(int alpha) {
|
||||
mDrawable.setAlpha(alpha);
|
||||
}
|
||||
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
mDrawable.setColorFilter(cf);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.util.Slog;
|
||||
|
||||
public class IconData {
|
||||
/**
|
||||
* Indicates ths item represents a piece of text.
|
||||
*/
|
||||
public static final int TEXT = 1;
|
||||
|
||||
/**
|
||||
* Indicates ths item represents an icon.
|
||||
*/
|
||||
public static final int ICON = 2;
|
||||
|
||||
/**
|
||||
* The type of this item. One of TEXT, ICON, or LEVEL_ICON.
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* The slot that this icon will be in if it is not a notification
|
||||
*/
|
||||
public String slot;
|
||||
|
||||
/**
|
||||
* The package containting the icon to draw for this item. Valid if this is
|
||||
* an ICON type.
|
||||
*/
|
||||
public String iconPackage;
|
||||
|
||||
/**
|
||||
* The icon to draw for this item. Valid if this is an ICON type.
|
||||
*/
|
||||
public int iconId;
|
||||
|
||||
/**
|
||||
* The level associated with the icon. Valid if this is a LEVEL_ICON type.
|
||||
*/
|
||||
public int iconLevel;
|
||||
|
||||
/**
|
||||
* The "count" number.
|
||||
*/
|
||||
public int number;
|
||||
|
||||
/**
|
||||
* The text associated with the icon. Valid if this is a TEXT type.
|
||||
*/
|
||||
public CharSequence text;
|
||||
|
||||
private IconData() {
|
||||
}
|
||||
|
||||
public static IconData makeIcon(String slot,
|
||||
String iconPackage, int iconId, int iconLevel, int number) {
|
||||
IconData data = new IconData();
|
||||
data.type = ICON;
|
||||
data.slot = slot;
|
||||
data.iconPackage = iconPackage;
|
||||
data.iconId = iconId;
|
||||
data.iconLevel = iconLevel;
|
||||
data.number = number;
|
||||
return data;
|
||||
}
|
||||
|
||||
public static IconData makeText(String slot, CharSequence text) {
|
||||
IconData data = new IconData();
|
||||
data.type = TEXT;
|
||||
data.slot = slot;
|
||||
data.text = text;
|
||||
return data;
|
||||
}
|
||||
|
||||
public void copyFrom(IconData that) {
|
||||
this.type = that.type;
|
||||
this.slot = that.slot;
|
||||
this.iconPackage = that.iconPackage;
|
||||
this.iconId = that.iconId;
|
||||
this.iconLevel = that.iconLevel;
|
||||
this.number = that.number;
|
||||
this.text = that.text; // should we clone this?
|
||||
}
|
||||
|
||||
public IconData clone() {
|
||||
IconData that = new IconData();
|
||||
that.copyFrom(this);
|
||||
return that;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (this.type == TEXT) {
|
||||
return "IconData(slot=" + (this.slot != null ? "'" + this.slot + "'" : "null")
|
||||
+ " text='" + this.text + "')";
|
||||
}
|
||||
else if (this.type == ICON) {
|
||||
return "IconData(slot=" + (this.slot != null ? "'" + this.slot + "'" : "null")
|
||||
+ " package=" + this.iconPackage
|
||||
+ " iconId=" + Integer.toHexString(this.iconId)
|
||||
+ " iconLevel=" + this.iconLevel + ")";
|
||||
}
|
||||
else {
|
||||
return "IconData(type=" + type + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
public class IconMerger extends LinearLayout {
|
||||
PhoneStatusBarService service;
|
||||
StatusBarIcon moreIcon;
|
||||
|
||||
public IconMerger(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
|
||||
final int maxWidth = r - l;
|
||||
final int N = getChildCount();
|
||||
int i;
|
||||
|
||||
// get the rightmost one, and see if we even need to do anything
|
||||
int fitRight = -1;
|
||||
for (i=N-1; i>=0; i--) {
|
||||
final View child = getChildAt(i);
|
||||
if (child.getVisibility() != GONE) {
|
||||
fitRight = child.getRight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// find the first visible one that isn't the more icon
|
||||
View moreView = null;
|
||||
int fitLeft = -1;
|
||||
int startIndex = -1;
|
||||
for (i=0; i<N; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (com.android.internal.R.drawable.stat_notify_more == child.getId()) {
|
||||
moreView = child;
|
||||
startIndex = i+1;
|
||||
}
|
||||
else if (child.getVisibility() != GONE) {
|
||||
fitLeft = child.getLeft();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (moreView == null || startIndex < 0) {
|
||||
throw new RuntimeException("Status Bar / IconMerger moreView == null");
|
||||
}
|
||||
|
||||
// if it fits without the more icon, then hide the more icon and update fitLeft
|
||||
// so everything gets pushed left
|
||||
int adjust = 0;
|
||||
if (fitRight - fitLeft <= maxWidth) {
|
||||
adjust = fitLeft - moreView.getLeft();
|
||||
fitLeft -= adjust;
|
||||
fitRight -= adjust;
|
||||
moreView.layout(0, moreView.getTop(), 0, moreView.getBottom());
|
||||
}
|
||||
int extra = fitRight - r;
|
||||
int shift = -1;
|
||||
|
||||
int breakingPoint = fitLeft + extra + adjust;
|
||||
int number = 0;
|
||||
for (i=startIndex; i<N; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (child.getVisibility() != GONE) {
|
||||
int childLeft = child.getLeft();
|
||||
int childRight = child.getRight();
|
||||
if (childLeft < breakingPoint) {
|
||||
// hide this one
|
||||
child.layout(0, child.getTop(), 0, child.getBottom());
|
||||
int n = this.service.getIconNumberForView(child);
|
||||
if (n == 0) {
|
||||
number += 1;
|
||||
} else if (n > 0) {
|
||||
number += n;
|
||||
}
|
||||
} else {
|
||||
// decide how much to shift by
|
||||
if (shift < 0) {
|
||||
shift = childLeft - fitLeft;
|
||||
}
|
||||
// shift this left by shift
|
||||
child.layout(childLeft-shift, child.getTop(),
|
||||
childRight-shift, child.getBottom());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BUG: Updating the text during the layout here doesn't seem to cause
|
||||
// the view to be redrawn fully. The text view gets resized correctly, but the
|
||||
// text contents aren't drawn properly. To work around this, we post a message
|
||||
// and provide the value later. We're the only one changing this value show it
|
||||
// should be ordered correctly.
|
||||
if (false) {
|
||||
this.moreIcon.update(number);
|
||||
} else {
|
||||
mBugWorkaroundNumber = number;
|
||||
mBugWorkaroundHandler.post(mBugWorkaroundRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
private int mBugWorkaroundNumber;
|
||||
private Handler mBugWorkaroundHandler = new Handler();
|
||||
private Runnable mBugWorkaroundRunnable = new Runnable() {
|
||||
public void run() {
|
||||
IconMerger.this.moreIcon.update(mBugWorkaroundNumber);
|
||||
IconMerger.this.moreIcon.view.invalidate();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Slog;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
public class LatestItemView extends FrameLayout {
|
||||
|
||||
public LatestItemView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
return onTouchEvent(ev);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
public class NotificationData {
|
||||
public String pkg;
|
||||
public String tag;
|
||||
public int id;
|
||||
public CharSequence tickerText;
|
||||
|
||||
public long when;
|
||||
public boolean ongoingEvent;
|
||||
public boolean clearable;
|
||||
|
||||
public RemoteViews contentView;
|
||||
public PendingIntent contentIntent;
|
||||
|
||||
public PendingIntent deleteIntent;
|
||||
|
||||
public String toString() {
|
||||
return "NotificationData(package=" + pkg + " id=" + id + " tickerText=" + tickerText
|
||||
+ " ongoingEvent=" + ongoingEvent + " contentIntent=" + contentIntent
|
||||
+ " deleteIntent=" + deleteIntent
|
||||
+ " clearable=" + clearable
|
||||
+ " contentView=" + contentView + " when=" + when + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
||||
public class NotificationLinearLayout extends LinearLayout {
|
||||
public NotificationLinearLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.util.Slog;
|
||||
import android.view.View;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class NotificationViewList {
|
||||
private ArrayList<StatusBarNotification> mOngoing = new ArrayList();
|
||||
private ArrayList<StatusBarNotification> mLatest = new ArrayList();
|
||||
|
||||
public NotificationViewList() {
|
||||
}
|
||||
|
||||
private static final int indexInList(ArrayList<StatusBarNotification> list, NotificationData n){
|
||||
final int N = list.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
StatusBarNotification that = list.get(i);
|
||||
if (that.data == n) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int getIconIndex(NotificationData n) {
|
||||
final int ongoingSize = mOngoing.size();
|
||||
final int latestSize = mLatest.size();
|
||||
if (n.ongoingEvent) {
|
||||
int index = indexInList(mOngoing, n);
|
||||
if (index >= 0) {
|
||||
return latestSize + index + 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return indexInList(mLatest, n) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void remove(StatusBarNotification notification) {
|
||||
NotificationData n = notification.data;
|
||||
int index;
|
||||
index = indexInList(mOngoing, n);
|
||||
if (index >= 0) {
|
||||
mOngoing.remove(index);
|
||||
return;
|
||||
}
|
||||
index = indexInList(mLatest, n);
|
||||
if (index >= 0) {
|
||||
mLatest.remove(index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<StatusBarNotification> notificationsForPackage(String packageName) {
|
||||
ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>();
|
||||
int N = mOngoing.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
if (matchPackage(mOngoing.get(i), packageName)) {
|
||||
list.add(mOngoing.get(i));
|
||||
}
|
||||
}
|
||||
N = mLatest.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
if (matchPackage(mLatest.get(i), packageName)) {
|
||||
list.add(mLatest.get(i));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private final boolean matchPackage(StatusBarNotification snb, String packageName) {
|
||||
if (snb.data.contentIntent != null) {
|
||||
if (snb.data.contentIntent.getTargetPackage().equals(packageName)) {
|
||||
return true;
|
||||
}
|
||||
} else if (snb.data.pkg != null && snb.data.pkg.equals(packageName)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final int indexForKey(ArrayList<StatusBarNotification> list, IBinder key) {
|
||||
final int N = list.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
if (list.get(i).key == key) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
StatusBarNotification get(IBinder key) {
|
||||
int index;
|
||||
index = indexForKey(mOngoing, key);
|
||||
if (index >= 0) {
|
||||
return mOngoing.get(index);
|
||||
}
|
||||
index = indexForKey(mLatest, key);
|
||||
if (index >= 0) {
|
||||
return mLatest.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// gets the index of the notification's view in its expanded parent view
|
||||
int getExpandedIndex(StatusBarNotification notification) {
|
||||
ArrayList<StatusBarNotification> list = notification.data.ongoingEvent ? mOngoing : mLatest;
|
||||
final IBinder key = notification.key;
|
||||
int index = 0;
|
||||
// (the view order is backwards from this list order)
|
||||
for (int i=list.size()-1; i>=0; i--) {
|
||||
StatusBarNotification item = list.get(i);
|
||||
if (item.key == key) {
|
||||
return index;
|
||||
}
|
||||
if (item.view != null) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
Slog.e(PhoneStatusBarService.TAG, "Couldn't find notification in NotificationViewList.");
|
||||
Slog.e(PhoneStatusBarService.TAG, "notification=" + notification);
|
||||
dump(notification);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void clearViews() {
|
||||
int N = mOngoing.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
mOngoing.get(i).view = null;
|
||||
}
|
||||
N = mLatest.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
mLatest.get(i).view = null;
|
||||
}
|
||||
}
|
||||
|
||||
int ongoingCount() {
|
||||
return mOngoing.size();
|
||||
}
|
||||
|
||||
int latestCount() {
|
||||
return mLatest.size();
|
||||
}
|
||||
|
||||
StatusBarNotification getOngoing(int index) {
|
||||
return mOngoing.get(index);
|
||||
}
|
||||
|
||||
StatusBarNotification getLatest(int index) {
|
||||
return mLatest.get(index);
|
||||
}
|
||||
|
||||
int size() {
|
||||
return mOngoing.size() + mLatest.size();
|
||||
}
|
||||
|
||||
void add(StatusBarNotification notification) {
|
||||
if (PhoneStatusBarService.SPEW) {
|
||||
Slog.d(PhoneStatusBarService.TAG, "before add NotificationViewList"
|
||||
+ " notification.data.ongoingEvent=" + notification.data.ongoingEvent);
|
||||
dump(notification);
|
||||
}
|
||||
|
||||
ArrayList<StatusBarNotification> list = notification.data.ongoingEvent ? mOngoing : mLatest;
|
||||
long when = notification.data.when;
|
||||
final int N = list.size();
|
||||
int index = N;
|
||||
for (int i=0; i<N; i++) {
|
||||
StatusBarNotification that = list.get(i);
|
||||
if (that.data.when > when) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
list.add(index, notification);
|
||||
|
||||
if (PhoneStatusBarService.SPEW) {
|
||||
Slog.d(PhoneStatusBarService.TAG, "after add NotificationViewList index=" + index);
|
||||
dump(notification);
|
||||
}
|
||||
}
|
||||
|
||||
void dump(StatusBarNotification notification) {
|
||||
if (PhoneStatusBarService.SPEW) {
|
||||
boolean showTime = false;
|
||||
String s = "";
|
||||
for (int i=0; i<mOngoing.size(); i++) {
|
||||
StatusBarNotification that = mOngoing.get(i);
|
||||
if (that.key == notification.key) {
|
||||
s += "[";
|
||||
}
|
||||
if (showTime) {
|
||||
s += that.data.when;
|
||||
} else {
|
||||
s += that.data.pkg + "/" + that.data.id + "/" + that.view;
|
||||
}
|
||||
if (that.key == notification.key) {
|
||||
s += "]";
|
||||
}
|
||||
s += " ";
|
||||
}
|
||||
Slog.d(PhoneStatusBarService.TAG, "NotificationViewList ongoing: " + s);
|
||||
|
||||
s = "";
|
||||
for (int i=0; i<mLatest.size(); i++) {
|
||||
StatusBarNotification that = mLatest.get(i);
|
||||
if (that.key == notification.key) {
|
||||
s += "[";
|
||||
}
|
||||
if (showTime) {
|
||||
s += that.data.when;
|
||||
} else {
|
||||
s += that.data.pkg + "/" + that.data.id + "/" + that.view;
|
||||
}
|
||||
if (that.key == notification.key) {
|
||||
s += "]";
|
||||
}
|
||||
s += " ";
|
||||
}
|
||||
Slog.d(PhoneStatusBarService.TAG, "NotificationViewList latest: " + s);
|
||||
}
|
||||
}
|
||||
|
||||
StatusBarNotification get(View view) {
|
||||
int N = mOngoing.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
StatusBarNotification notification = mOngoing.get(i);
|
||||
View v = notification.view;
|
||||
if (v == view) {
|
||||
return notification;
|
||||
}
|
||||
}
|
||||
N = mLatest.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
StatusBarNotification notification = mLatest.get(i);
|
||||
View v = notification.view;
|
||||
if (v == view) {
|
||||
return notification;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void update(StatusBarNotification notification) {
|
||||
remove(notification);
|
||||
add(notification);
|
||||
}
|
||||
|
||||
boolean hasClearableItems() {
|
||||
int N = mLatest.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
if (mLatest.get(i).data.clearable) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
public class StatusBarException extends RuntimeException {
|
||||
StatusBarException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Slog;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class StatusBarIcon {
|
||||
// TODO: get this from a resource
|
||||
private static final int ICON_GAP = 8;
|
||||
private static final int ICON_WIDTH = 25;
|
||||
private static final int ICON_HEIGHT = 25;
|
||||
|
||||
public View view;
|
||||
|
||||
IconData mData;
|
||||
|
||||
private TextView mTextView;
|
||||
private AnimatedImageView mImageView;
|
||||
private TextView mNumberView;
|
||||
|
||||
public StatusBarIcon(Context context, IconData data, ViewGroup parent) {
|
||||
mData = data.clone();
|
||||
|
||||
switch (data.type) {
|
||||
case IconData.TEXT: {
|
||||
TextView t;
|
||||
t = new TextView(context);
|
||||
mTextView = t;
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
t.setTextSize(16);
|
||||
t.setTextColor(0xff000000);
|
||||
t.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
t.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
|
||||
t.setPadding(6, 0, 0, 0);
|
||||
t.setLayoutParams(layoutParams);
|
||||
t.setText(data.text);
|
||||
this.view = t;
|
||||
break;
|
||||
}
|
||||
|
||||
case IconData.ICON: {
|
||||
// container
|
||||
LayoutInflater inflater = (LayoutInflater)context.getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
View v = inflater.inflate(com.android.internal.R.layout.status_bar_icon, parent, false);
|
||||
this.view = v;
|
||||
|
||||
// icon
|
||||
AnimatedImageView im = (AnimatedImageView)v.findViewById(com.android.internal.R.id.image);
|
||||
im.setImageDrawable(getIcon(context, data));
|
||||
im.setImageLevel(data.iconLevel);
|
||||
mImageView = im;
|
||||
|
||||
// number
|
||||
TextView nv = (TextView)v.findViewById(com.android.internal.R.id.number);
|
||||
mNumberView = nv;
|
||||
if (data.number > 0) {
|
||||
nv.setText("" + data.number);
|
||||
nv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
nv.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Context context, IconData data) throws StatusBarException {
|
||||
if (mData.type != data.type) {
|
||||
throw new StatusBarException("status bar entry type can't change");
|
||||
}
|
||||
switch (data.type) {
|
||||
case IconData.TEXT:
|
||||
if (!TextUtils.equals(mData.text, data.text)) {
|
||||
TextView tv = mTextView;
|
||||
tv.setText(data.text);
|
||||
}
|
||||
break;
|
||||
case IconData.ICON:
|
||||
if (((mData.iconPackage != null && data.iconPackage != null)
|
||||
&& !mData.iconPackage.equals(data.iconPackage))
|
||||
|| mData.iconId != data.iconId
|
||||
|| mData.iconLevel != data.iconLevel) {
|
||||
ImageView im = mImageView;
|
||||
im.setImageDrawable(getIcon(context, data));
|
||||
im.setImageLevel(data.iconLevel);
|
||||
}
|
||||
if (mData.number != data.number) {
|
||||
TextView nv = mNumberView;
|
||||
if (data.number > 0) {
|
||||
nv.setText("" + data.number);
|
||||
} else {
|
||||
nv.setText("");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
mData.copyFrom(data);
|
||||
}
|
||||
|
||||
public void update(int number) {
|
||||
if (mData.number != number) {
|
||||
TextView nv = mNumberView;
|
||||
if (number > 0) {
|
||||
nv.setText("" + number);
|
||||
} else {
|
||||
nv.setText("");
|
||||
}
|
||||
}
|
||||
mData.number = number;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the right icon to use for this item, respecting the iconId and
|
||||
* iconPackage (if set)
|
||||
*
|
||||
* @param context Context to use to get resources if iconPackage is not set
|
||||
* @return Drawable for this item, or null if the package or item could not
|
||||
* be found
|
||||
*/
|
||||
static Drawable getIcon(Context context, IconData data) {
|
||||
|
||||
Resources r = null;
|
||||
|
||||
if (data.iconPackage != null) {
|
||||
try {
|
||||
r = context.getPackageManager().getResourcesForApplication(data.iconPackage);
|
||||
} catch (PackageManager.NameNotFoundException ex) {
|
||||
Slog.e(PhoneStatusBarService.TAG, "Icon package not found: " + data.iconPackage, ex);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
r = context.getResources();
|
||||
}
|
||||
|
||||
if (data.iconId == 0) {
|
||||
Slog.w(PhoneStatusBarService.TAG, "No icon ID for slot " + data.slot);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return r.getDrawable(data.iconId);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(PhoneStatusBarService.TAG, "Icon not found in "
|
||||
+ (data.iconPackage != null ? data.iconId : "<system>")
|
||||
+ ": " + Integer.toHexString(data.iconId));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
int getNumber() {
|
||||
return mData.number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.view.View;
|
||||
|
||||
public class StatusBarNotification {
|
||||
IBinder key;
|
||||
NotificationData data;
|
||||
View view;
|
||||
View contentView;
|
||||
}
|
||||
@@ -34,12 +34,22 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerImpl;
|
||||
|
||||
import com.android.server.status.IconData;
|
||||
import com.android.server.status.NotificationData;
|
||||
|
||||
public abstract class StatusBarService extends Service {
|
||||
private static final String TAG = "StatusBarService";
|
||||
|
||||
Bar mBar = new Bar();
|
||||
IStatusBarService mBarService;
|
||||
|
||||
/* TODO
|
||||
H mHandler = new H();
|
||||
Object mQueueLock = new Object();
|
||||
ArrayList<PendingOp> mQueue = new ArrayList<PendingOp>();
|
||||
NotificationCallbacks mNotificationCallbacks;
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
// Put up the view
|
||||
@@ -75,5 +85,28 @@ public abstract class StatusBarService extends Service {
|
||||
* Implement this to add the main status bar view.
|
||||
*/
|
||||
protected abstract void addStatusBarView();
|
||||
|
||||
public void activate() {
|
||||
}
|
||||
|
||||
public void deactivate() {
|
||||
}
|
||||
|
||||
public void toggle() {
|
||||
}
|
||||
|
||||
public void disable(int what, IBinder token, String pkg) {
|
||||
}
|
||||
|
||||
public IBinder addIcon(IconData data, NotificationData n) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateIcon(IBinder key, IconData data, NotificationData n) {
|
||||
}
|
||||
|
||||
public void setIconVisibility(IBinder key, boolean visible) {
|
||||
//addPendingOp(OP_SET_VISIBLE, key, visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.server.status;
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
@@ -27,14 +27,12 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
public class StatusBarView extends FrameLayout {
|
||||
private static final String TAG = "StatusBarView";
|
||||
|
||||
static final int DIM_ANIM_TIME = 400;
|
||||
|
||||
StatusBarManagerService mService;
|
||||
PhoneStatusBarService mService;
|
||||
boolean mTracking;
|
||||
int mStartX, mStartY;
|
||||
ViewGroup mNotificationIcons;
|
||||
@@ -94,7 +92,7 @@ public class StatusBarView extends FrameLayout {
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
mService.updateExpandedViewPos(StatusBarManagerService.EXPANDED_LEAVE_ALONE);
|
||||
mService.updateExpandedViewPos(PhoneStatusBarService.EXPANDED_LEAVE_ALONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -14,9 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.server.status;
|
||||
|
||||
import com.android.internal.R;
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -36,7 +34,7 @@ import android.widget.ImageSwitcher;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
abstract class Ticker {
|
||||
public abstract class Ticker {
|
||||
private static final int TICKER_SEGMENT_DELAY = 3000;
|
||||
|
||||
private final class Segment {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.server.status;
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.android.policy.statusbar.phone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
||||
public class TrackingView extends LinearLayout {
|
||||
final Display mDisplay;
|
||||
PhoneStatusBarService mService;
|
||||
boolean mTracking;
|
||||
int mStartX, mStartY;
|
||||
|
||||
public TrackingView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mDisplay = ((WindowManager)context.getSystemService(
|
||||
Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
mService.updateExpandedHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
|
||||
switch (event.getKeyCode()) {
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
if (down) {
|
||||
mService.deactivate();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
mService.onTrackingViewAttached();
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,11 @@ import android.util.Slog;
|
||||
import android.view.View;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class NotificationViewList {
|
||||
public class NotificationViewList {
|
||||
private ArrayList<StatusBarNotification> mOngoing = new ArrayList();
|
||||
private ArrayList<StatusBarNotification> mLatest = new ArrayList();
|
||||
|
||||
NotificationViewList() {
|
||||
public NotificationViewList() {
|
||||
}
|
||||
|
||||
private static final int indexInList(ArrayList<StatusBarNotification> list, NotificationData n){
|
||||
|
||||
@@ -31,7 +31,7 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
class StatusBarIcon {
|
||||
public class StatusBarIcon {
|
||||
// TODO: get this from a resource
|
||||
private static final int ICON_GAP = 8;
|
||||
private static final int ICON_WIDTH = 25;
|
||||
|
||||
@@ -154,7 +154,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
|
||||
final Context mContext;
|
||||
final Display mDisplay;
|
||||
StatusBarView mStatusBarView;
|
||||
View /*StatusBarView*/ mStatusBarView;
|
||||
int mPixelFormat;
|
||||
H mHandler = new H();
|
||||
Object mQueueLock = new Object();
|
||||
@@ -207,8 +207,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
int mTrackingPosition; // the position of the top of the tracking view.
|
||||
|
||||
// ticker
|
||||
private Ticker mTicker;
|
||||
private View mTickerView;
|
||||
private boolean mTicking;
|
||||
|
||||
// Tracking finger for opening/closing.
|
||||
@@ -240,7 +238,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
mContext = context;
|
||||
mDisplay = ((WindowManager)context.getSystemService(
|
||||
Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||
makeStatusBarView(context);
|
||||
mUninstallReceiver = new UninstallReceiver();
|
||||
}
|
||||
|
||||
@@ -251,106 +248,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
// ================================================================================
|
||||
// Constructing the view
|
||||
// ================================================================================
|
||||
private void makeStatusBarView(Context context) {
|
||||
Resources res = context.getResources();
|
||||
mRightIconSlots = res.getStringArray(com.android.internal.R.array.status_bar_icon_order);
|
||||
mRightIcons = new StatusBarIcon[mRightIconSlots.length];
|
||||
|
||||
ExpandedView expanded = (ExpandedView)View.inflate(context,
|
||||
com.android.internal.R.layout.status_bar_expanded, null);
|
||||
expanded.mService = this;
|
||||
StatusBarView sb = (StatusBarView)View.inflate(context,
|
||||
com.android.internal.R.layout.status_bar, null);
|
||||
sb.mService = this;
|
||||
|
||||
// figure out which pixel-format to use for the status bar.
|
||||
mPixelFormat = PixelFormat.TRANSLUCENT;
|
||||
Drawable bg = sb.getBackground();
|
||||
if (bg != null) {
|
||||
mPixelFormat = bg.getOpacity();
|
||||
}
|
||||
|
||||
mStatusBarView = sb;
|
||||
mStatusIcons = (LinearLayout)sb.findViewById(R.id.statusIcons);
|
||||
mNotificationIcons = (IconMerger)sb.findViewById(R.id.notificationIcons);
|
||||
mNotificationIcons.service = this;
|
||||
mIcons = (LinearLayout)sb.findViewById(R.id.icons);
|
||||
mTickerView = sb.findViewById(R.id.ticker);
|
||||
mDateView = (DateView)sb.findViewById(R.id.date);
|
||||
|
||||
mExpandedDialog = new ExpandedDialog(context);
|
||||
mExpandedView = expanded;
|
||||
mExpandedContents = expanded.findViewById(R.id.notificationLinearLayout);
|
||||
mOngoingTitle = (TextView)expanded.findViewById(R.id.ongoingTitle);
|
||||
mOngoingItems = (LinearLayout)expanded.findViewById(R.id.ongoingItems);
|
||||
mLatestTitle = (TextView)expanded.findViewById(R.id.latestTitle);
|
||||
mLatestItems = (LinearLayout)expanded.findViewById(R.id.latestItems);
|
||||
mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
|
||||
mClearButton = (TextView)expanded.findViewById(R.id.clear_all_button);
|
||||
mClearButton.setOnClickListener(mClearButtonListener);
|
||||
mSpnLabel = (TextView)expanded.findViewById(R.id.spnLabel);
|
||||
mPlmnLabel = (TextView)expanded.findViewById(R.id.plmnLabel);
|
||||
mScrollView = (ScrollView)expanded.findViewById(R.id.scroll);
|
||||
mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout);
|
||||
|
||||
mOngoingTitle.setVisibility(View.GONE);
|
||||
mLatestTitle.setVisibility(View.GONE);
|
||||
|
||||
mTicker = new MyTicker(context, sb);
|
||||
|
||||
TickerView tickerView = (TickerView)sb.findViewById(R.id.tickerText);
|
||||
tickerView.mTicker = mTicker;
|
||||
|
||||
mTrackingView = (TrackingView)View.inflate(context,
|
||||
com.android.internal.R.layout.status_bar_tracking, null);
|
||||
mTrackingView.mService = this;
|
||||
mCloseView = (CloseDragHandle)mTrackingView.findViewById(R.id.close);
|
||||
mCloseView.mService = this;
|
||||
|
||||
mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);
|
||||
|
||||
// add the more icon for the notifications
|
||||
IconData moreData = IconData.makeIcon(null, context.getPackageName(),
|
||||
R.drawable.stat_notify_more, 0, 42);
|
||||
mMoreIcon = new StatusBarIcon(context, moreData, mNotificationIcons);
|
||||
mMoreIcon.view.setId(R.drawable.stat_notify_more);
|
||||
mNotificationIcons.moreIcon = mMoreIcon;
|
||||
mNotificationIcons.addView(mMoreIcon.view);
|
||||
|
||||
// set the inital view visibility
|
||||
setAreThereNotifications();
|
||||
mDateView.setVisibility(View.INVISIBLE);
|
||||
|
||||
// before we register for broadcasts
|
||||
mPlmnLabel.setText(R.string.lockscreen_carrier_default);
|
||||
mPlmnLabel.setVisibility(View.VISIBLE);
|
||||
mSpnLabel.setText("");
|
||||
mSpnLabel.setVisibility(View.GONE);
|
||||
|
||||
// receive broadcasts
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
||||
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
filter.addAction(Telephony.Intents.SPN_STRINGS_UPDATED_ACTION);
|
||||
context.registerReceiver(mBroadcastReceiver, filter);
|
||||
}
|
||||
|
||||
public void systemReady() {
|
||||
final StatusBarView view = mStatusBarView;
|
||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
view.getContext().getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.status_bar_height),
|
||||
WindowManager.LayoutParams.TYPE_STATUS_BAR,
|
||||
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
|
||||
WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,
|
||||
mPixelFormat);
|
||||
lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
|
||||
lp.setTitle("StatusBar");
|
||||
lp.windowAnimations = R.style.Animation_StatusBar;
|
||||
|
||||
//WindowManagerImpl.getDefault().addView(view, lp);
|
||||
}
|
||||
|
||||
public void systemReady2() {
|
||||
@@ -431,6 +330,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
// Can be called from any thread
|
||||
// ================================================================================
|
||||
public IBinder addIcon(IconData data, NotificationData n) {
|
||||
if (true) {
|
||||
return new Binder();
|
||||
}
|
||||
// TODO: Call onto the IStatusBar
|
||||
int slot;
|
||||
// assert early-on if they using a slot that doesn't exist.
|
||||
if (data != null && n == null) {
|
||||
@@ -681,6 +584,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
|
||||
/* private */ void performAddUpdateIcon(IBinder key, IconData data, NotificationData n)
|
||||
throws StatusBarException {
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
if (SPEW) {
|
||||
Slog.d(TAG, "performAddUpdateIcon icon=" + data + " notification=" + n + " key=" + key);
|
||||
}
|
||||
@@ -715,7 +621,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
|| !CharSequences.equals(oldData.tickerText, n.tickerText))) {
|
||||
if (0 == (mDisabled &
|
||||
(StatusBarManager.DISABLE_NOTIFICATION_ICONS | StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
|
||||
mTicker.addEntry(n, StatusBarIcon.getIcon(mContext, data), n.tickerText);
|
||||
//mTicker.addEntry(n, StatusBarIcon.getIcon(mContext, data), n.tickerText);
|
||||
}
|
||||
}
|
||||
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
|
||||
@@ -773,6 +679,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
}
|
||||
|
||||
/* private */ void performSetIconVisibility(IBinder key, boolean visible) {
|
||||
if (true) {
|
||||
return;
|
||||
}
|
||||
synchronized (mIconMap) {
|
||||
if (SPEW) {
|
||||
Slog.d(TAG, "performSetIconVisibility key=" + key + " visible=" + visible);
|
||||
@@ -1340,47 +1249,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private class MyTicker extends Ticker {
|
||||
MyTicker(Context context, StatusBarView sb) {
|
||||
super(context, sb);
|
||||
}
|
||||
|
||||
@Override
|
||||
void tickerStarting() {
|
||||
mTicking = true;
|
||||
mIcons.setVisibility(View.GONE);
|
||||
mTickerView.setVisibility(View.VISIBLE);
|
||||
mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.push_up_in, null));
|
||||
mIcons.startAnimation(loadAnim(com.android.internal.R.anim.push_up_out, null));
|
||||
if (mExpandedVisible) {
|
||||
setDateViewVisibility(false, com.android.internal.R.anim.push_up_out);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void tickerDone() {
|
||||
mIcons.setVisibility(View.VISIBLE);
|
||||
mTickerView.setVisibility(View.GONE);
|
||||
mIcons.startAnimation(loadAnim(com.android.internal.R.anim.push_down_in, null));
|
||||
mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.push_down_out,
|
||||
mTickingDoneListener));
|
||||
if (mExpandedVisible) {
|
||||
setDateViewVisibility(true, com.android.internal.R.anim.push_down_in);
|
||||
}
|
||||
}
|
||||
|
||||
void tickerHalting() {
|
||||
mIcons.setVisibility(View.VISIBLE);
|
||||
mTickerView.setVisibility(View.GONE);
|
||||
mIcons.startAnimation(loadAnim(com.android.internal.R.anim.fade_in, null));
|
||||
mTickerView.startAnimation(loadAnim(com.android.internal.R.anim.fade_out,
|
||||
mTickingDoneListener));
|
||||
if (mExpandedVisible) {
|
||||
setDateViewVisibility(true, com.android.internal.R.anim.fade_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Animation.AnimationListener mTickingDoneListener = new Animation.AnimationListener() {;
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
mTicking = false;
|
||||
@@ -1448,7 +1316,6 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
pw.println(" mLatestItems: " + viewInfo(mLatestItems));
|
||||
pw.println(" mNoNotificationsTitle: " + viewInfo(mNoNotificationsTitle));
|
||||
pw.println(" mCloseView: " + viewInfo(mCloseView));
|
||||
pw.println(" mTickerView: " + viewInfo(mTickerView));
|
||||
pw.println(" mScrollView: " + viewInfo(mScrollView)
|
||||
+ " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY());
|
||||
pw.println("mNotificationLinearLayout: " + viewInfo(mNotificationLinearLayout));
|
||||
@@ -1591,12 +1458,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
}
|
||||
|
||||
void setNotificationIconVisibility(boolean visible, int anim) {
|
||||
/*
|
||||
int old = mNotificationIcons.getVisibility();
|
||||
int v = visible ? View.VISIBLE : View.INVISIBLE;
|
||||
if (old != v) {
|
||||
mNotificationIcons.setVisibility(v);
|
||||
mNotificationIcons.startAnimation(loadAnim(anim, null));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void updateExpandedViewPos(int expandedPosition) {
|
||||
@@ -1729,7 +1598,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: yes");
|
||||
if (mTicking) {
|
||||
mNotificationIcons.setVisibility(View.INVISIBLE);
|
||||
mTicker.halt();
|
||||
//mTicker.halt();
|
||||
} else {
|
||||
setNotificationIconVisibility(false, com.android.internal.R.anim.fade_out);
|
||||
}
|
||||
@@ -1741,7 +1610,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
||||
}
|
||||
} else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
|
||||
if (mTicking && (net & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
|
||||
mTicker.halt();
|
||||
//mTicker.halt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.server.status;
|
||||
import android.os.IBinder;
|
||||
import android.view.View;
|
||||
|
||||
class StatusBarNotification {
|
||||
public class StatusBarNotification {
|
||||
IBinder key;
|
||||
NotificationData data;
|
||||
View view;
|
||||
|
||||