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

Commit f12288bd authored by Jason Monk's avatar Jason Monk Committed by Android (Google) Code Review
Browse files

Merge "Remove visibility from tiles, make them always visible"

parents b8140085 ba2318ef
Loading
Loading
Loading
Loading
+0 −7
Original line number Original line Diff line number Diff line
@@ -180,13 +180,6 @@
            </intent-filter>
            </intent-filter>
        </receiver>
        </receiver>


        <receiver android:name=".qs.tiles.HotspotTile$APChangedReceiver"
                androidprv:systemUserOnly="true">
            <intent-filter>
                <action android:name="android.net.wifi.WIFI_AP_STATE_CHANGED" />
            </intent-filter>
        </receiver>

        <activity android:name=".tuner.TunerActivity"
        <activity android:name=".tuner.TunerActivity"
                  android:enabled="false"
                  android:enabled="false"
                  android:icon="@drawable/tuner"
                  android:icon="@drawable/tuner"
+0 −5
Original line number Original line Diff line number Diff line
@@ -72,11 +72,6 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
        return ((ViewGroup) tile.tileView.getParent()).getTop();
        return ((ViewGroup) tile.tileView.getParent()).getTop();
    }
    }


    @Override
    public void setTileVisibility(TileRecord tile, int visibility) {
        tile.tileView.setVisibility(visibility);
    }

    @Override
    @Override
    public void addTile(TileRecord tile) {
    public void addTile(TileRecord tile) {
        mTiles.add(tile);
        mTiles.add(tile);
+1 −18
Original line number Original line Diff line number Diff line
@@ -302,15 +302,6 @@ public class QSPanel extends FrameLayout implements Tunable {
        mHandler.obtainMessage(H.SHOW_DETAIL, show ? 1 : 0, 0, r).sendToTarget();
        mHandler.obtainMessage(H.SHOW_DETAIL, show ? 1 : 0, 0, r).sendToTarget();
    }
    }


    private void setTileVisibility(TileRecord record, int visibility) {
        mHandler.obtainMessage(H.SET_TILE_VISIBILITY, visibility, 0, record).sendToTarget();
    }

    private void handleSetTileVisibility(TileRecord tile, int visibility) {
        if (visibility == tile.tileView.getVisibility()) return;
        mTileLayout.setTileVisibility(tile, visibility);
    }

    public void setTiles(Collection<QSTile<?>> tiles) {
    public void setTiles(Collection<QSTile<?>> tiles) {
        for (TileRecord record : mRecords) {
        for (TileRecord record : mRecords) {
            mTileLayout.removeTile(record);
            mTileLayout.removeTile(record);
@@ -325,8 +316,6 @@ public class QSPanel extends FrameLayout implements Tunable {
    }
    }


    private void drawTile(TileRecord r, QSTile.State state) {
    private void drawTile(TileRecord r, QSTile.State state) {
        final int visibility = state.visible ? VISIBLE : GONE;
        setTileVisibility(r, visibility);
        r.tileView.onStateChanged(state);
        r.tileView.onStateChanged(state);
    }
    }


@@ -338,7 +327,6 @@ public class QSPanel extends FrameLayout implements Tunable {
        final TileRecord r = new TileRecord();
        final TileRecord r = new TileRecord();
        r.tile = tile;
        r.tile = tile;
        r.tileView = createTileView(tile);
        r.tileView = createTileView(tile);
        r.tileView.setVisibility(View.GONE);
        final QSTile.Callback callback = new QSTile.Callback() {
        final QSTile.Callback callback = new QSTile.Callback() {
            @Override
            @Override
            public void onStateChanged(QSTile.State state) {
            public void onStateChanged(QSTile.State state) {
@@ -517,11 +505,9 @@ public class QSPanel extends FrameLayout implements Tunable {
    private void logTiles() {
    private void logTiles() {
        for (int i = 0; i < mRecords.size(); i++) {
        for (int i = 0; i < mRecords.size(); i++) {
            TileRecord tileRecord = mRecords.get(i);
            TileRecord tileRecord = mRecords.get(i);
            if (tileRecord.tile.getState().visible) {
            MetricsLogger.visible(mContext, tileRecord.tile.getMetricsCategory());
            MetricsLogger.visible(mContext, tileRecord.tile.getMetricsCategory());
        }
        }
    }
    }
    }


    private void fireShowingDetail(QSTile.DetailAdapter detail) {
    private void fireShowingDetail(QSTile.DetailAdapter detail) {
        if (mCallback != null) {
        if (mCallback != null) {
@@ -556,8 +542,6 @@ public class QSPanel extends FrameLayout implements Tunable {
        public void handleMessage(Message msg) {
        public void handleMessage(Message msg) {
            if (msg.what == SHOW_DETAIL) {
            if (msg.what == SHOW_DETAIL) {
                handleShowDetail((Record)msg.obj, msg.arg1 != 0);
                handleShowDetail((Record)msg.obj, msg.arg1 != 0);
            } else if (msg.what == SET_TILE_VISIBILITY) {
                handleSetTileVisibility((TileRecord) msg.obj, msg.arg1);
            }
            }
        }
        }
    }
    }
@@ -621,7 +605,6 @@ public class QSPanel extends FrameLayout implements Tunable {
    public interface QSTileLayout {
    public interface QSTileLayout {
        void addTile(TileRecord tile);
        void addTile(TileRecord tile);
        void removeTile(TileRecord tile);
        void removeTile(TileRecord tile);
        void setTileVisibility(TileRecord tile, int visibility);
        int getOffsetTop(TileRecord tile);
        int getOffsetTop(TileRecord tile);
        void updateResources();
        void updateResources();
    }
    }
+4 −5
Original line number Original line Diff line number Diff line
@@ -320,8 +320,10 @@ public abstract class QSTile<TState extends State> implements Listenable {
    public interface Host {
    public interface Host {
        void startActivityDismissingKeyguard(Intent intent);
        void startActivityDismissingKeyguard(Intent intent);
        void startActivityDismissingKeyguard(PendingIntent intent);
        void startActivityDismissingKeyguard(PendingIntent intent);
        void startRunnableDismissingKeyguard(Runnable runnable);
        void warn(String message, Throwable t);
        void warn(String message, Throwable t);
        void collapsePanels();
        void collapsePanels();
        void openPanels();
        Looper getLooper();
        Looper getLooper();
        Context getContext();
        Context getContext();
        Collection<QSTile<?>> getTiles();
        Collection<QSTile<?>> getTiles();
@@ -338,6 +340,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
        UserSwitcherController getUserSwitcherController();
        UserSwitcherController getUserSwitcherController();
        UserInfoController getUserInfoController();
        UserInfoController getUserInfoController();
        BatteryController getBatteryController();
        BatteryController getBatteryController();
        void removeTile(String tileSpec);


        public interface Callback {
        public interface Callback {
            void onTilesChanged();
            void onTilesChanged();
@@ -444,7 +447,6 @@ public abstract class QSTile<TState extends State> implements Listenable {
    }
    }


    public static class State {
    public static class State {
        public boolean visible;
        public Icon icon;
        public Icon icon;
        public CharSequence label;
        public CharSequence label;
        public CharSequence contentDescription;
        public CharSequence contentDescription;
@@ -454,14 +456,12 @@ public abstract class QSTile<TState extends State> implements Listenable {
        public boolean copyTo(State other) {
        public boolean copyTo(State other) {
            if (other == null) throw new IllegalArgumentException();
            if (other == null) throw new IllegalArgumentException();
            if (!other.getClass().equals(getClass())) throw new IllegalArgumentException();
            if (!other.getClass().equals(getClass())) throw new IllegalArgumentException();
            final boolean changed = other.visible != visible
            final boolean changed = !Objects.equals(other.icon, icon)
                    || !Objects.equals(other.icon, icon)
                    || !Objects.equals(other.label, label)
                    || !Objects.equals(other.label, label)
                    || !Objects.equals(other.contentDescription, contentDescription)
                    || !Objects.equals(other.contentDescription, contentDescription)
                    || !Objects.equals(other.autoMirrorDrawable, autoMirrorDrawable)
                    || !Objects.equals(other.autoMirrorDrawable, autoMirrorDrawable)
                    || !Objects.equals(other.dualLabelContentDescription,
                    || !Objects.equals(other.dualLabelContentDescription,
                    dualLabelContentDescription);
                    dualLabelContentDescription);
            other.visible = visible;
            other.icon = icon;
            other.icon = icon;
            other.label = label;
            other.label = label;
            other.contentDescription = contentDescription;
            other.contentDescription = contentDescription;
@@ -477,7 +477,6 @@ public abstract class QSTile<TState extends State> implements Listenable {


        protected StringBuilder toStringBuilder() {
        protected StringBuilder toStringBuilder() {
            final StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('[');
            final StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append('[');
            sb.append("visible=").append(visible);
            sb.append(",icon=").append(icon);
            sb.append(",icon=").append(icon);
            sb.append(",label=").append(label);
            sb.append(",label=").append(label);
            sb.append(",contentDescription=").append(contentDescription);
            sb.append(",contentDescription=").append(contentDescription);
+0 −5
Original line number Original line Diff line number Diff line
@@ -139,11 +139,6 @@ public class QuickQSPanel extends QSPanel {
            removeView(tile.tileView);
            removeView(tile.tileView);
        }
        }


        @Override
        public void setTileVisibility(TileRecord tile, int visibility) {
            tile.tileView.setVisibility(visibility);
        }

        @Override
        @Override
        public int getOffsetTop(TileRecord tile) {
        public int getOffsetTop(TileRecord tile) {
            return 0;
            return 0;
Loading