Merge "Add settings button to notification panel."
This commit is contained in:
committed by
Android (Google) Code Review
commit
74e3c75ee9
BIN
packages/SystemUI/res/drawable-hdpi/status_bar_bg_tile.png
Normal file
BIN
packages/SystemUI/res/drawable-hdpi/status_bar_bg_tile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 83 B |
BIN
packages/SystemUI/res/drawable-hdpi/status_bar_hr.9.png
Normal file
BIN
packages/SystemUI/res/drawable-hdpi/status_bar_hr.9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 B |
BIN
packages/SystemUI/res/drawable-mdpi/status_bar_bg_tile.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/status_bar_bg_tile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1005 B |
BIN
packages/SystemUI/res/drawable-mdpi/status_bar_hr.9.png
Normal file
BIN
packages/SystemUI/res/drawable-mdpi/status_bar_hr.9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 B |
BIN
packages/SystemUI/res/drawable-xhdpi/status_bar_bg_tile.png
Normal file
BIN
packages/SystemUI/res/drawable-xhdpi/status_bar_bg_tile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 B |
BIN
packages/SystemUI/res/drawable-xhdpi/status_bar_hr.9.png
Normal file
BIN
packages/SystemUI/res/drawable-xhdpi/status_bar_hr.9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 B |
21
packages/SystemUI/res/drawable/status_bar_bg.xml
Normal file
21
packages/SystemUI/res/drawable/status_bar_bg.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2011 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.
|
||||
-->
|
||||
|
||||
<bitmap
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tileMode="repeat"
|
||||
android:src="@drawable/status_bar_bg_tile"
|
||||
/>
|
||||
@@ -121,15 +121,4 @@
|
||||
/>
|
||||
</com.android.systemui.statusbar.phone.TickerView>
|
||||
</LinearLayout>
|
||||
|
||||
<com.android.systemui.statusbar.policy.DateView android:id="@+id/date"
|
||||
android:textAppearance="@*android:style/TextAppearance.StatusBar.Icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:paddingLeft="6px"
|
||||
android:paddingRight="6px"
|
||||
android:background="@drawable/status_bar_background"
|
||||
/>
|
||||
</com.android.systemui.statusbar.phone.PhoneStatusBarView>
|
||||
|
||||
@@ -26,15 +26,24 @@
|
||||
android:descendantFocusability="afterDescendants"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="55dp"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingRight="3dp"
|
||||
android:background="@drawable/shade_header_background"
|
||||
>
|
||||
<com.android.systemui.statusbar.policy.DateView android:id="@+id/date"
|
||||
android:textAppearance="@android:style/TextAppearance.StatusBar.EventContent.Title"
|
||||
android:textColor="@android:color/holo_blue_bright"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:singleLine="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:paddingLeft="16dp"
|
||||
/>
|
||||
<!--
|
||||
<com.android.systemui.statusbar.phone.CarrierLabel
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -47,15 +56,30 @@
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
/>
|
||||
-->
|
||||
<ImageView android:id="@+id/settings_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toRightOf="@id/date"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_sysbar_quicksettings"
|
||||
/>
|
||||
<ImageView android:id="@+id/clear_all_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:src="@drawable/ic_notify_clear"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:background="@drawable/status_bar_hr"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="#ff000000"
|
||||
android:background="@drawable/status_bar_bg"
|
||||
/>
|
||||
|
||||
<com.android.systemui.statusbar.phone.CloseDragHandle android:id="@+id/close"
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Slog;
|
||||
import android.util.Log;
|
||||
@@ -140,6 +141,8 @@ public class PhoneStatusBar extends StatusBar {
|
||||
// top bar
|
||||
TextView mNoNotificationsTitle;
|
||||
View mClearButton;
|
||||
View mSettingsButton;
|
||||
|
||||
// drag bar
|
||||
CloseDragHandle mCloseView;
|
||||
|
||||
@@ -296,7 +299,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
mNotificationIcons = (IconMerger)sb.findViewById(R.id.notificationIcons);
|
||||
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;
|
||||
@@ -305,6 +307,9 @@ public class PhoneStatusBar extends StatusBar {
|
||||
mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
|
||||
mClearButton = expanded.findViewById(R.id.clear_all_button);
|
||||
mClearButton.setOnClickListener(mClearButtonListener);
|
||||
mDateView = (DateView)expanded.findViewById(R.id.date);
|
||||
mSettingsButton = expanded.findViewById(R.id.settings_button);
|
||||
mSettingsButton.setOnClickListener(mSettingsButtonListener);
|
||||
mScrollView = (ScrollView)expanded.findViewById(R.id.scroll);
|
||||
mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout);
|
||||
|
||||
@@ -322,7 +327,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
|
||||
// set the inital view visibility
|
||||
setAreThereNotifications();
|
||||
mDateView.setVisibility(View.INVISIBLE);
|
||||
|
||||
// Other icons
|
||||
mLocationController = new LocationController(mContext); // will post a notification
|
||||
@@ -1106,10 +1110,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
mExpandedDialog.getWindow().setAttributes(mExpandedParams);
|
||||
mExpandedView.requestFocus(View.FOCUS_FORWARD);
|
||||
mTrackingView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!mTicking) {
|
||||
setDateViewVisibility(true, com.android.internal.R.anim.fade_in);
|
||||
}
|
||||
}
|
||||
|
||||
public void animateExpand() {
|
||||
@@ -1194,7 +1194,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
if ((mDisabled & StatusBarManager.DISABLE_NOTIFICATION_ICONS) == 0) {
|
||||
setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in);
|
||||
}
|
||||
setDateViewVisibility(false, com.android.internal.R.anim.fade_out);
|
||||
|
||||
if (!mExpanded) {
|
||||
return;
|
||||
@@ -1578,9 +1577,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
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
|
||||
@@ -1590,9 +1586,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void tickerHalting() {
|
||||
@@ -1601,9 +1594,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1764,11 +1754,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
mExpandedDialog.show();
|
||||
}
|
||||
|
||||
void setDateViewVisibility(boolean visible, int anim) {
|
||||
mDateView.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
|
||||
mDateView.startAnimation(loadAnim(anim, null));
|
||||
}
|
||||
|
||||
void setNotificationIconVisibility(boolean visible, int anim) {
|
||||
int old = mNotificationIcons.getVisibility();
|
||||
int v = visible ? View.VISIBLE : View.INVISIBLE;
|
||||
@@ -1979,6 +1964,14 @@ public class PhoneStatusBar extends StatusBar {
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mSettingsButtonListener = new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
v.getContext().startActivity(new Intent(Settings.ACTION_SETTINGS)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
animateCollapse();
|
||||
}
|
||||
};
|
||||
|
||||
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
|
||||
@@ -42,8 +42,6 @@ public class PhoneStatusBarView extends FrameLayout {
|
||||
int mStartX, mStartY;
|
||||
ViewGroup mNotificationIcons;
|
||||
ViewGroup mStatusIcons;
|
||||
View mDate;
|
||||
FixedSizeDrawable mBackground;
|
||||
|
||||
boolean mNightMode = false;
|
||||
int mStartAlpha = 0, mEndAlpha = 0;
|
||||
@@ -61,11 +59,6 @@ public class PhoneStatusBarView extends FrameLayout {
|
||||
super.onFinishInflate();
|
||||
mNotificationIcons = (ViewGroup)findViewById(R.id.notificationIcons);
|
||||
mStatusIcons = (ViewGroup)findViewById(R.id.statusIcons);
|
||||
mDate = findViewById(R.id.date);
|
||||
|
||||
mBackground = new FixedSizeDrawable(mDate.getBackground());
|
||||
mBackground.setFixedBounds(0, 0, 0, 0);
|
||||
mDate.setBackgroundDrawable(mBackground);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,31 +100,6 @@ public class PhoneStatusBarView extends FrameLayout {
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
|
||||
// put the date date view quantized to the icons
|
||||
int oldDateRight = mDate.getRight();
|
||||
int newDateRight;
|
||||
|
||||
newDateRight = getDateSize(mNotificationIcons, oldDateRight,
|
||||
getViewOffset(mNotificationIcons));
|
||||
if (newDateRight < 0) {
|
||||
int offset = getViewOffset(mStatusIcons);
|
||||
if (oldDateRight < offset) {
|
||||
newDateRight = oldDateRight;
|
||||
} else {
|
||||
newDateRight = getDateSize(mStatusIcons, oldDateRight, offset);
|
||||
if (newDateRight < 0) {
|
||||
newDateRight = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
int max = r - getPaddingRight();
|
||||
if (newDateRight > max) {
|
||||
newDateRight = max;
|
||||
}
|
||||
|
||||
mDate.layout(mDate.getLeft(), mDate.getTop(), newDateRight, mDate.getBottom());
|
||||
mBackground.setFixedBounds(-mDate.getLeft(), -mDate.getTop(), (r-l), (b-t));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,19 +132,6 @@ public class PhoneStatusBarView extends FrameLayout {
|
||||
return offset;
|
||||
}
|
||||
|
||||
private int getDateSize(ViewGroup g, int w, int offset) {
|
||||
final int N = g.getChildCount();
|
||||
for (int i=0; i<N; i++) {
|
||||
View v = g.getChildAt(i);
|
||||
int l = v.getLeft() + offset;
|
||||
int r = v.getRight() + offset;
|
||||
if (w >= l && w <= r) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that, if there is no target under us to receive the touch,
|
||||
* that we process it ourself. This makes sure that onInterceptTouchEvent()
|
||||
|
||||
Reference in New Issue
Block a user