Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af56345c authored by Chris Wren's avatar Chris Wren Committed by Android Git Automerger
Browse files

am 059537e7: Merge "Back from the dead: Carrier name, background dimming." into jb-dev

* commit '059537e7':
  Back from the dead: Carrier name, background dimming.
parents 77b924e5 059537e7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -29,6 +29,17 @@
    android:layout_marginLeft="@dimen/notification_panel_margin_left"
    >

    <TextView
        android:id="@+id/carrier_label"
        android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network"
        android:layout_height="@dimen/carrier_label_height"
        android:layout_width="match_parent"
        android:layout_gravity="bottom"
        android:layout_marginBottom="@dimen/close_handle_height"
        android:gravity="center"
        android:visibility="invisible"
        />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
+4 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@
    <dimen name="notification_panel_header_height">48dp</dimen>

    <!-- Extra space above the panel -->
    <dimen name="notification_panel_padding_top">4dp</dimen>
    <dimen name="notification_panel_padding_top">0dp</dimen>

    <!-- Extra space above the clock in the panel -->
    <dimen name="notification_panel_header_padding_top">0dp</dimen>
@@ -145,4 +145,7 @@
    <!-- Gravity for the notification panel -->
    <!-- 0x37 = fill_horizontal|top -->
    <integer name="notification_panel_layout_gravity">0x37</integer>

    <!-- Height of the carrier/wifi name label -->
    <dimen name="carrier_label_height">24dp</dimen>
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@
        <item name="android:textAllCaps">true</item>
    </style>

    <style name="TextAppearance.StatusBar.Expanded.Network" parent="@style/TextAppearance.StatusBar.Expanded.Date">
        <item name="android:textColor">#999999</item>
	</style>

    <style name="Animation" />

    <style name="Animation.ShirtPocketPanel">
+87 −6
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
@@ -86,6 +87,7 @@ import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.DateView;
import com.android.systemui.statusbar.policy.IntruderAlertView;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.OnSizeChangedListener;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NotificationRowLayout;

@@ -105,7 +107,8 @@ public class PhoneStatusBar extends BaseStatusBar {
    public static final String ACTION_STATUSBAR_START
            = "com.android.internal.policy.statusbar.START";

    private static final boolean DIM_BEHIND_EXPANDED_PANEL = false;
    private static final boolean DIM_BEHIND_EXPANDED_PANEL = true;
    private static final boolean SHOW_CARRIER_LABEL = true;

    private static final int MSG_OPEN_NOTIFICATION_PANEL = 1000;
    private static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001;
@@ -170,6 +173,11 @@ public class PhoneStatusBar extends BaseStatusBar {
    View mSettingsButton;
    RotationToggle mRotationButton;

    // carrier/wifi label
    private TextView mCarrierLabel;
    private boolean mCarrierLabelVisible = false;
    private int mCarrierLabelHeight;

    // drag bar
    CloseDragHandle mCloseView;
    private int mCloseViewHeight;
@@ -385,6 +393,14 @@ public class PhoneStatusBar extends BaseStatusBar {

        mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
        mPile.setLongPressListener(getNotificationLongClicker());
        if (SHOW_CARRIER_LABEL) {
            mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
                @Override
                public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
                    updateCarrierLabelVisibility();
                }
            });
        }
        mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout);

        mClearButton = mStatusBarWindow.findViewById(R.id.clear_all_button);
@@ -397,6 +413,9 @@ public class PhoneStatusBar extends BaseStatusBar {
        mSettingsButton.setOnClickListener(mSettingsButtonListener);
        mRotationButton = (RotationToggle) mStatusBarWindow.findViewById(R.id.rotation_lock_button);
        
        mCarrierLabel = (TextView)mStatusBarWindow.findViewById(R.id.carrier_label);
        mCarrierLabel.setVisibility(mCarrierLabelVisible ? View.VISIBLE : View.INVISIBLE);

        mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
        mScrollView.setVerticalScrollBarEnabled(false); // less drawing during pulldowns

@@ -421,8 +440,17 @@ public class PhoneStatusBar extends BaseStatusBar {
        mNetworkController = new NetworkController(mContext);
        final SignalClusterView signalCluster =
                (SignalClusterView)mStatusBarView.findViewById(R.id.signal_cluster);

        mNetworkController.addSignalCluster(signalCluster);
        signalCluster.setNetworkController(mNetworkController);
        
        // for wifi-only devices, we show SSID; otherwise, we show PLMN
        if (mNetworkController.hasMobileDataFeature()) {
            mNetworkController.addMobileLabelView(mCarrierLabel);
        } else {
            mNetworkController.addWifiLabelView(mCarrierLabel);
        }

//        final ImageView wimaxRSSI =
//                (ImageView)sb.findViewById(R.id.wimax_signal);
//        if (wimaxRSSI != null) {
@@ -861,6 +889,45 @@ public class PhoneStatusBar extends BaseStatusBar {
        }
    }

    protected void updateCarrierLabelVisibility() {
        if (!SHOW_CARRIER_LABEL) return;
        // The idea here is to only show the carrier label when there is enough room to see it, 
        // i.e. when there aren't enough notifications to fill the panel.
        if (DEBUG) {
            Slog.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
                    mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
        }
        
        final boolean makeVisible = 
            mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
        
        if (mCarrierLabelVisible != makeVisible) {
            mCarrierLabelVisible = makeVisible;
            if (DEBUG) {
                Slog.d(TAG, "making carrier label " + (makeVisible?"visible":"invisible"));
            }
            mCarrierLabel.animate().cancel();
            if (makeVisible) {
                mCarrierLabel.setVisibility(View.VISIBLE);
            }
            mCarrierLabel.animate()
                .alpha(makeVisible ? 1f : 0f)
                //.setStartDelay(makeVisible ? 500 : 0)
                //.setDuration(makeVisible ? 750 : 100)
                .setDuration(150)
                .setListener(makeVisible ? null : new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        if (!mCarrierLabelVisible) { // race
                            mCarrierLabel.setVisibility(View.INVISIBLE);
                            mCarrierLabel.setAlpha(0f);
                        }
                    }
                })
                .start();
        }
    }

    @Override
    protected void setAreThereNotifications() {
        final boolean any = mNotificationData.size() > 0;
@@ -918,6 +985,8 @@ public class PhoneStatusBar extends BaseStatusBar {
                })
                .start();
        }

        updateCarrierLabelVisibility();
    }

    public void showClock(boolean show) {
@@ -1092,6 +1161,8 @@ public class PhoneStatusBar extends BaseStatusBar {
        mExpandedVisible = true;
        makeSlippery(mNavigationBarView, true);

        updateCarrierLabelVisibility();

        updateExpandedViewPos(EXPANDED_LEAVE_ALONE);

        // Expand the window to encompass the full screen in anticipation of the drag.
@@ -1947,6 +2018,8 @@ public class PhoneStatusBar extends BaseStatusBar {
            panelh = 0;
        }

        if (panelh == mTrackingPosition) return;

        mTrackingPosition = panelh;

        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams();
@@ -1958,13 +2031,17 @@ public class PhoneStatusBar extends BaseStatusBar {
        }
        mNotificationPanel.setLayoutParams(lp);

        if (DIM_BEHIND_EXPANDED_PANEL && ActivityManager.isHighEndGfx(mDisplay)) {
            // woo, special effects
        final int barh = getCloseViewHeight() + getStatusBarHeight();
        final float frac = saturate((float)(panelh - barh) / (disph - barh));
            final int color = ((int)(0xB0 * Math.sin(frac * 1.57f))) << 24;

        if (DIM_BEHIND_EXPANDED_PANEL && ActivityManager.isHighEndGfx(mDisplay)) {
            // woo, special effects
            final float k = (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2.2f))));
            final int color = ((int)(0xB0 * k)) << 24;
            mStatusBarWindow.setBackgroundColor(color);
        }
        
        updateCarrierLabelVisibility();
    }

    void updateDisplaySize() {
@@ -2199,11 +2276,15 @@ public class PhoneStatusBar extends BaseStatusBar {
        if (mNotificationPanelGravity <= 0) {
            mNotificationPanelGravity = Gravity.CENTER_VERTICAL | Gravity.TOP;
        }
        mNotificationPanelMinHeight =
        final int notificationPanelDecorationHeight =
              res.getDimensionPixelSize(R.dimen.notification_panel_padding_top)
            + res.getDimensionPixelSize(R.dimen.notification_panel_header_height)
            + res.getDimensionPixelSize(R.dimen.close_handle_underlap)
            + getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg)).bottom;
        mNotificationPanelMinHeight = 
              notificationPanelDecorationHeight 
            + res.getDimensionPixelSize(R.dimen.close_handle_underlap);

        mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height);

        if (false) Slog.v(TAG, "updateResources");
    }
+9 −2
Original line number Diff line number Diff line
@@ -237,6 +237,10 @@ public class NetworkController extends BroadcastReceiver {
        mBatteryStats = BatteryStatsService.getService();
    }

    public boolean hasMobileDataFeature() {
        return mHasMobileDataFeature;
    }

    public void addPhoneSignalIconView(ImageView v) {
        mPhoneSignalIconViews.add(v);
    }
@@ -1049,6 +1053,9 @@ public class NetworkController extends BroadcastReceiver {
                    + Integer.toHexString(combinedSignalIconId)
                    + "/" + getResourceName(combinedSignalIconId)
                    + " combinedActivityIconId=0x" + Integer.toHexString(combinedActivityIconId)
                    + " mobileLabel=" + mobileLabel
                    + " wifiLabel=" + wifiLabel
                    + " combinedLabel=" + combinedLabel
                    + " mAirplaneMode=" + mAirplaneMode
                    + " mDataActivity=" + mDataActivity
                    + " mPhoneSignalIconId=0x" + Integer.toHexString(mPhoneSignalIconId)
@@ -1194,11 +1201,11 @@ public class NetworkController extends BroadcastReceiver {
        N = mWifiLabelViews.size();
        for (int i=0; i<N; i++) {
            TextView v = mWifiLabelViews.get(i);
            v.setText(wifiLabel);
            if ("".equals(wifiLabel)) {
                v.setVisibility(View.GONE);
            } else {
                v.setVisibility(View.VISIBLE);
                v.setText(wifiLabel);
            }
        }

@@ -1206,11 +1213,11 @@ public class NetworkController extends BroadcastReceiver {
        N = mMobileLabelViews.size();
        for (int i=0; i<N; i++) {
            TextView v = mMobileLabelViews.get(i);
            v.setText(mobileLabel);
            if ("".equals(mobileLabel)) {
                v.setVisibility(View.GONE);
            } else {
                v.setVisibility(View.VISIBLE);
                v.setText(mobileLabel);
            }
        }
    }
Loading