diff options
3 files changed, 154 insertions, 75 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index 82c0d1a..3ff3f2b 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -40,7 +40,7 @@ android:layout_height="wrap_content" /> - <LinearLayout android:id="@+id/carrier_label_layout" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" @@ -127,36 +127,9 @@ android:layout_height="wrap_content" android:orientation="vertical" /> - <TextView android:id="@+id/clear_all_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right|center_vertical" - android:layout_marginTop="4dp" - android:layout_marginBottom="1dp" - android:text="@string/status_bar_clear_all_button" - style="@style/StatusBar.ClearButton" - android:paddingLeft="15dp" - android:paddingRight="15dp" - /> </com.android.systemui.statusbar.NotificationLinearLayout> </ScrollView> - <LinearLayout android:id="@+id/compact_carrier_layout" - android:orientation="horizontal" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - > - <com.android.systemui.statusbar.CarrierLabel - android:gravity="bottom|right|center" - android:textAppearance="@style/TextAppearance.StatusBar.Title" - android:background="@android:color/transparent" - android:layout_marginRight="6.0dip" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - /> - </LinearLayout> - <ImageView android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/packages/SystemUI/res/layout/status_bar_expanded_compact_carrier.xml b/packages/SystemUI/res/layout/status_bar_expanded_compact_carrier.xml new file mode 100644 index 0000000..c80fa51 --- /dev/null +++ b/packages/SystemUI/res/layout/status_bar_expanded_compact_carrier.xml @@ -0,0 +1,135 @@ +<?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.systemui.statusbar.ExpandedView xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:focusable="true" + android:descendantFocusability="afterDescendants" + > + + <LinearLayout android:id="@+id/power_and_carrier" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingTop="3dp" + android:paddingBottom="5dp" + android:paddingRight="3dp" + android:background="@drawable/title_bar_portrait" + > + <com.android.systemui.statusbar.powerwidget.PowerWidget android:id="@+id/exp_power_stat" + android:layout_width="match_parent" + android:layout_height="wrap_content" + /> + </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" + android:overScrollMode="ifContentScrolls" + > + <com.android.systemui.statusbar.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/shade_header_background" + android:paddingLeft="5dp" + android:textAppearance="@style/TextAppearance.StatusBar.Title" + 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/shade_header_background" + android:paddingLeft="5dp" + android:textAppearance="@style/TextAppearance.StatusBar.Title" + 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/shade_header_background" + android:paddingLeft="5dp" + android:textAppearance="@style/TextAppearance.StatusBar.Title" + 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" + /> + <TextView android:id="@+id/clear_all_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right|center_vertical" + android:layout_marginTop="4dp" + android:layout_marginBottom="1dp" + android:text="@string/status_bar_clear_all_button" + style="@style/StatusBar.ClearButton" + android:paddingLeft="15dp" + android:paddingRight="15dp" + /> + </com.android.systemui.statusbar.NotificationLinearLayout> + </ScrollView> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + <com.android.systemui.statusbar.CarrierLabel + android:gravity="bottom|right|center" + android:textAppearance="@style/TextAppearance.StatusBar.Title" + android:background="@android:color/transparent" + android:layout_marginRight="6.0dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + /> + </LinearLayout> + + <ImageView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:src="@drawable/title_bar_shadow" + android:scaleType="fitXY" + /> + + </FrameLayout> +</com.android.systemui.statusbar.ExpandedView> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java index c61e306..419a6b1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java @@ -136,7 +136,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks // top bar TextView mNoNotificationsTitle; TextView mClearButton; - TextView mCompactClearButton; ViewGroup mClearButtonParent; CmBatteryMiniIcon mCmBatteryMiniIcon; // drag bar @@ -166,11 +165,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks // the power widget PowerWidget mPowerWidget; - //Carrier label stuff - LinearLayout mCarrierLabelLayout; - LinearLayout mCompactCarrierLayout; - LinearLayout mPowerAndCarrier; - // ticker private Ticker mTicker; private View mTickerView; @@ -219,10 +213,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks Settings.System.getUriFor(Settings.System.SOFT_BUTTONS_LEFT), false, this); resolver.registerContentObserver( Settings.System.getUriFor(Settings.System.STATUS_BAR_DEAD_ZONE), false, this); - resolver.registerContentObserver( - Settings.System.getUriFor(Settings.System.STATUS_BAR_COMPACT_CARRIER), false, this); - resolver.registerContentObserver( - Settings.System.getUriFor(Settings.System.EXPANDED_VIEW_WIDGET), false, this); onChange(true); } @@ -240,10 +230,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks defValue=(CmSystem.getDefaultBool(mContext, CmSystem.CM_DEFAULT_USE_DEAD_ZONE) ? 1 : 0); mDeadZone = (Settings.System.getInt(resolver, Settings.System.STATUS_BAR_DEAD_ZONE, defValue) == 1); - mCompactCarrier = (Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_COMPACT_CARRIER, 0) == 1); updateLayout(); - updateCarrierLabel(); } } @@ -355,7 +342,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks return null; } - private boolean mCompactCarrier = false; + private boolean compactCarrier = false; // ================================================================================ // Constructing the view @@ -366,9 +353,11 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size); //Check for compact carrier layout and apply if enabled - mCompactCarrier = Settings.System.getInt(getContentResolver(), - Settings.System.STATUS_BAR_COMPACT_CARRIER, 0) == 1; - ExpandedView expanded = (ExpandedView)View.inflate(context, + compactCarrier = Settings.System.getInt(getContentResolver(), + Settings.System.STATUS_BAR_COMPACT_CARRIER, 0) == 1; + ExpandedView expanded = compactCarrier ? (ExpandedView)View.inflate(context, + R.layout.status_bar_expanded_compact_carrier, null) : + (ExpandedView)View.inflate(context, R.layout.status_bar_expanded, null); expanded.mService = this; @@ -400,9 +389,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle); mClearButton = (TextView)expanded.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); - mCompactClearButton = (TextView)expanded.findViewById(R.id.compact_clear_all_button); - mCompactClearButton.setOnClickListener(mClearButtonListener); - mPowerAndCarrier = (LinearLayout)expanded.findViewById(R.id.power_and_carrier); + mClearButtonParent = (ViewGroup)mClearButton.getParent(); mScrollView = (ScrollView)expanded.findViewById(R.id.scroll); mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout); @@ -427,9 +414,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks } }); - mCarrierLabelLayout = (LinearLayout)expanded.findViewById(R.id.carrier_label_layout); - mCompactCarrierLayout = (LinearLayout)expanded.findViewById(R.id.compact_carrier_layout); - mTicker = new MyTicker(context, sb); TickerView tickerView = (TickerView)sb.findViewById(R.id.tickerText); @@ -441,7 +425,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks mCloseView.mService = this; updateLayout(); - updateCarrierLabel(); mContext=context; mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore); @@ -451,20 +434,6 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks mDateView.setVisibility(View.INVISIBLE); } - private void updateCarrierLabel() { - if (mCompactCarrier) { - mCarrierLabelLayout.setVisibility(View.GONE); - mCompactCarrierLayout.setVisibility(View.VISIBLE); - if (mLatest.hasClearableItems()) - mCompactClearButton.setVisibility(View.VISIBLE); - } else { - mCarrierLabelLayout.setVisibility(View.VISIBLE); - mCompactCarrierLayout.setVisibility(View.GONE); - mCompactClearButton.setVisibility(View.GONE); - } - - } - private void updateLayout() { if(mTrackingView==null || mCloseView==null || mExpandedView==null) return; @@ -484,13 +453,7 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks // readd in right order mExpandedView.addView(powerAndCarrier, mBottomBar ? 1 : 0); - powerAndCarrier.addView(power, mBottomBar && !mCompactCarrier ? 1 : 0); - - //remove small ugly grey area if compactcarrier is enabled and power widget disabled - boolean hideArea = mCompactCarrier && - Settings.System.getInt(mContext.getContentResolver(), - Settings.System.EXPANDED_VIEW_WIDGET, 1) == 0; - mPowerAndCarrier.setVisibility(hideArea ? View.GONE : View.VISIBLE); + powerAndCarrier.addView(power, mBottomBar && !compactCarrier ? 1 : 0); } protected void addStatusBarView() { @@ -778,17 +741,25 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks return entry.notification; } + private boolean isClearButtonAdded = false; + private void setAreThereNotifications() { boolean ongoing = mOngoing.hasVisibleItems(); boolean latest = mLatest.hasVisibleItems(); // (no ongoing notifications are clearable) if (mLatest.hasClearableItems()) { - if (mCompactCarrier) mCompactClearButton.setVisibility(View.VISIBLE); mClearButton.setVisibility(View.VISIBLE); + if (compactCarrier && !isClearButtonAdded) { + mClearButtonParent.addView(mClearButton); + isClearButtonAdded = true; + } } else { - mCompactClearButton.setVisibility(View.GONE); mClearButton.setVisibility(View.INVISIBLE); + if (compactCarrier) { + mClearButtonParent.removeView(mClearButton); + isClearButtonAdded = false; + } } mOngoingTitle.setVisibility(ongoing ? View.VISIBLE : View.GONE); |