Separate the status bar height from the icon size.

Change-Id: I9cc8c5e8ed2c48d03b7c1c89f1bf7f94cc119171
This commit is contained in:
Joe Onorato
2010-06-28 14:02:24 -04:00
parent de6bd120c9
commit b54ef61434
2 changed files with 17 additions and 14 deletions

View File

@@ -28,6 +28,10 @@
<dimen name="toast_y_offset">64dip</dimen> <dimen name="toast_y_offset">64dip</dimen>
<!-- Height of the status bar --> <!-- Height of the status bar -->
<dimen name="status_bar_height">25dip</dimen> <dimen name="status_bar_height">25dip</dimen>
<!-- Height of the status bar -->
<dimen name="status_bar_icon_size">25dip</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
<!-- Size of the fastscroll hint letter --> <!-- Size of the fastscroll hint letter -->
<dimen name="fastscroll_overlay_size">104dp</dimen> <dimen name="fastscroll_overlay_size">104dp</dimen>
<!-- Width of the fastscroll thumb --> <!-- Width of the fastscroll thumb -->
@@ -38,6 +42,4 @@
<dimen name="password_keyboard_key_height">56dip</dimen> <dimen name="password_keyboard_key_height">56dip</dimen>
<!-- Default correction for the space key in the password keyboard --> <!-- Default correction for the space key in the password keyboard -->
<dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen> <dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
</resources> </resources>

View File

@@ -112,9 +112,7 @@ public class PhoneStatusBarService extends StatusBarService {
StatusBarPolicy mIconPolicy; StatusBarPolicy mIconPolicy;
int mHeight; int mIconSize;
int mIconWidth;
Display mDisplay; Display mDisplay;
StatusBarView mStatusBarView; StatusBarView mStatusBarView;
int mPixelFormat; int mPixelFormat;
@@ -211,8 +209,7 @@ public class PhoneStatusBarService extends StatusBarService {
private void makeStatusBarView(Context context) { private void makeStatusBarView(Context context) {
Resources res = context.getResources(); Resources res = context.getResources();
mHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
mIconWidth = mHeight;
ExpandedView expanded = (ExpandedView)View.inflate(context, ExpandedView expanded = (ExpandedView)View.inflate(context,
R.layout.status_bar_expanded, null); R.layout.status_bar_expanded, null);
@@ -277,7 +274,7 @@ public class PhoneStatusBarService extends StatusBarService {
StatusBarIconView moreView = new StatusBarIconView(this, "more"); StatusBarIconView moreView = new StatusBarIconView(this, "more");
moreView.set(new StatusBarIcon(null, R.drawable.stat_notify_more, 0)); moreView.set(new StatusBarIcon(null, R.drawable.stat_notify_more, 0));
mNotificationIcons.addMoreView(moreView, mNotificationIcons.addMoreView(moreView,
new LinearLayout.LayoutParams(mIconWidth, mHeight)); new LinearLayout.LayoutParams(mIconSize, mIconSize));
// set the inital view visibility // set the inital view visibility
setAreThereNotifications(); setAreThereNotifications();
@@ -293,10 +290,13 @@ public class PhoneStatusBarService extends StatusBarService {
@Override @Override
protected void addStatusBarView() { protected void addStatusBarView() {
Resources res = getResources();
final int height= res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
final StatusBarView view = mStatusBarView; final StatusBarView view = mStatusBarView;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
mHeight, height,
WindowManager.LayoutParams.TYPE_STATUS_BAR, WindowManager.LayoutParams.TYPE_STATUS_BAR,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,
@@ -309,7 +309,7 @@ public class PhoneStatusBarService extends StatusBarService {
lp = new WindowManager.LayoutParams( lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
mHeight, height,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
@@ -318,7 +318,7 @@ public class PhoneStatusBarService extends StatusBarService {
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
PixelFormat.TRANSLUCENT); PixelFormat.TRANSLUCENT);
lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL; lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
lp.y += mHeight * 1.5; // for now lp.y += height * 1.5; // for now
lp.setTitle("IntruderAlert"); lp.setTitle("IntruderAlert");
lp.windowAnimations = android.R.style.Animation_Dialog; lp.windowAnimations = android.R.style.Animation_Dialog;
@@ -330,7 +330,7 @@ public class PhoneStatusBarService extends StatusBarService {
+ " icon=" + icon); + " icon=" + icon);
StatusBarIconView view = new StatusBarIconView(this, slot); StatusBarIconView view = new StatusBarIconView(this, slot);
view.set(icon); view.set(icon);
mStatusIcons.addView(view, viewIndex, new LinearLayout.LayoutParams(mIconWidth, mHeight)); mStatusIcons.addView(view, viewIndex, new LinearLayout.LayoutParams(mIconSize, mIconSize));
} }
public void updateIcon(String slot, int index, int viewIndex, public void updateIcon(String slot, int index, int viewIndex,
@@ -379,7 +379,8 @@ public class PhoneStatusBarService extends StatusBarService {
} }
} else if (notification.notification.fullScreenIntent != null) { } else if (notification.notification.fullScreenIntent != null) {
// not immersive & a full-screen alert should be shown // not immersive & a full-screen alert should be shown
Slog.d(TAG, "Notification has fullScreenIntent and activity is not immersive; sending fullScreenIntent"); Slog.d(TAG, "Notification has fullScreenIntent and activity is not immersive;"
+ " sending fullScreenIntent");
try { try {
notification.notification.fullScreenIntent.send(); notification.notification.fullScreenIntent.send();
} catch (PendingIntent.CanceledException e) { } catch (PendingIntent.CanceledException e) {
@@ -577,7 +578,7 @@ public class PhoneStatusBarService extends StatusBarService {
// Add the icon. // Add the icon.
final int iconIndex = chooseIconIndex(isOngoing, viewIndex); final int iconIndex = chooseIconIndex(isOngoing, viewIndex);
mNotificationIcons.addView(iconView, iconIndex, mNotificationIcons.addView(iconView, iconIndex,
new LinearLayout.LayoutParams(mIconWidth, mHeight)); new LinearLayout.LayoutParams(mIconSize, mIconSize));
return iconView; return iconView;
} }