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

Commit 0418f8a5 authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Android (Google) Code Review
Browse files

Merge "sysui: refactor for extensibility" into nyc-dev

parents bb8c3090 311b98ea
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -27,9 +27,25 @@ import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.phone.KeyguardBouncer;
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.phone.QSTileHost;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.StatusBarWindowManager;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.CastController;
import com.android.systemui.statusbar.policy.FlashlightController;
import com.android.systemui.statusbar.policy.HotspotController;
import com.android.systemui.statusbar.policy.KeyguardMonitor;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.NextAlarmController;
import com.android.systemui.statusbar.policy.RotationLockController;
import com.android.systemui.statusbar.policy.SecurityController;
import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.statusbar.policy.ZenModeController;

/**
 * Class factory to provide customizable SystemUI components.
@@ -82,6 +98,20 @@ public class SystemUIFactory {
        return new NotificationIconAreaController(context, phoneStatusBar);
    }

    public QSTileHost createQSTileHost(Context context, PhoneStatusBar statusBar,
            BluetoothController bluetooth, LocationController location,
            RotationLockController rotation, NetworkController network,
            ZenModeController zen, HotspotController hotspot,
            CastController cast, FlashlightController flashlight,
            UserSwitcherController userSwitcher, UserInfoController userInfo,
            KeyguardMonitor keyguard, SecurityController security,
            BatteryController battery, StatusBarIconController iconController,
            NextAlarmController nextAlarmController) {
        return new QSTileHost(context, statusBar, bluetooth, location, rotation, network, zen,
                hotspot, cast, flashlight, userSwitcher, userInfo, keyguard, security, battery,
                iconController, nextAlarmController);
    }

    public <T> T createInstance(Class<T> classType) {
        return null;
    }
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
        } else if (MOVE_FULL_ROWS.equals(key)) {
            mFullRows = newValue == null || Integer.parseInt(newValue) != 0;
        } else if (QuickQSPanel.NUM_QUICK_TILES.equals(key)) {
            mNumQuickTiles = QuickQSPanel.getNumQuickTiles(mQsContainer.getContext());
            mNumQuickTiles = mQuickQsPanel.getNumQuickTiles(mQsContainer.getContext());
            clearAnimationState();
        }
        updateAnimators();
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ public class QuickQSPanel extends QSPanel {
        }
    };

    public static int getNumQuickTiles(Context context) {
    public int getNumQuickTiles(Context context) {
        return TunerService.get(context).getValue(NUM_QUICK_TILES, 5);
    }

+18 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.systemui.R;
public class ExpandableIndicator extends ImageView {

    private boolean mExpanded;
    private boolean mIsDefaultDirection = true;

    public ExpandableIndicator(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -31,16 +32,14 @@ public class ExpandableIndicator extends ImageView {
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        final int res = mExpanded ? R.drawable.ic_volume_collapse_animation
                : R.drawable.ic_volume_expand_animation;
        final int res = getDrawableResourceId(mExpanded);
        setImageResource(res);
    }

    public void setExpanded(boolean expanded) {
        if (expanded == mExpanded) return;
        mExpanded = expanded;
        final int res = mExpanded ? R.drawable.ic_volume_expand_animation
                : R.drawable.ic_volume_collapse_animation;
        final int res = getDrawableResourceId(!mExpanded);
        // workaround to reset drawable
        final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getContext()
                .getDrawable(res).getConstantState().newDrawable();
@@ -48,4 +47,19 @@ public class ExpandableIndicator extends ImageView {
        avd.forceAnimationOnUI();
        avd.start();
    }

    /** Whether the icons are using the default direction or the opposite */
    public void setDefaultDirection(boolean isDefaultDirection) {
        mIsDefaultDirection = isDefaultDirection;
    }

    private int getDrawableResourceId(boolean expanded) {
        if (mIsDefaultDirection) {
            return expanded ? R.drawable.ic_volume_collapse_animation
                    : R.drawable.ic_volume_expand_animation;
        } else {
            return expanded ? R.drawable.ic_volume_expand_animation
                    : R.drawable.ic_volume_collapse_animation;
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -876,7 +876,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        DensityContainer container = (DensityContainer) mStatusBarWindow.findViewById(
                R.id.qs_density_container);
        if (container != null) {
            final QSTileHost qsh = new QSTileHost(mContext, this,
            final QSTileHost qsh = SystemUIFactory.getInstance().createQSTileHost(mContext, this,
                    mBluetoothController, mLocationController, mRotationLockController,
                    mNetworkController, mZenModeController, mHotspotController,
                    mCastController, mFlashlightController,
Loading