diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java index 7da109de69512..bfbfbf6fe8138 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java @@ -140,7 +140,6 @@ public class QSContainerImpl extends FrameLayout { setMargins(mQSFooter); setMargins(mQSPanel); setMargins(mHeader); - setMargins(mQSCustomizer); } private void setMargins(View view) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java index 9759b6984d67a..eb95866aa909f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.java @@ -15,42 +15,33 @@ package com.android.systemui.qs.customize; import android.content.Context; -import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; -import com.android.systemui.R; + import com.android.systemui.plugins.qs.QSIconView; +import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.qs.tileimpl.QSTileView; -import java.util.Objects; public class CustomizeTileView extends QSTileView { + private boolean mShowAppLabel; - private TextView mAppLabel; - private int mLabelMinLines; public CustomizeTileView(Context context, QSIconView icon) { super(context, icon); } - @Override - protected void createLabel() { - super.createLabel(); - mLabelMinLines = mLabel.getMinLines(); - mAppLabel = findViewById(R.id.app_label); - mAppLabel.setAlpha(.6f); - } - public void setShowAppLabel(boolean showAppLabel) { - mAppLabel.setVisibility(showAppLabel ? View.VISIBLE : View.GONE); + mShowAppLabel = showAppLabel; + mSecondLine.setVisibility(showAppLabel ? View.VISIBLE : View.GONE); mLabel.setSingleLine(showAppLabel); } - public void setAppLabel(CharSequence label) { - if (!Objects.equals(label, mAppLabel.getText())) { - mAppLabel.setText(label); - } + @Override + protected void handleStateChanged(QSTile.State state) { + super.handleStateChanged(state); + mSecondLine.setVisibility(mShowAppLabel ? View.VISIBLE : View.GONE); } public TextView getAppLabel() { - return mAppLabel; + return mSecondLine; } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java index 3ba5fe67fe005..441d29bffe3a9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java @@ -274,7 +274,6 @@ public class TileAdapter extends RecyclerView.Adapter implements TileSta R.string.accessibility_qs_edit_tile_label, position + 1, info.state.label); } holder.mTileView.onStateChanged(info.state); - holder.mTileView.setAppLabel(info.appLabel); holder.mTileView.setShowAppLabel(position > mEditIndex && !info.isSystem); if (mAccessibilityManager.isTouchExplorationEnabled()) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java index 2ac592ffe5bd9..8bf40962c911e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java @@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; import android.service.quicksettings.TileService; +import android.text.TextUtils; import android.widget.Button; import com.android.systemui.Dependency; @@ -169,7 +170,8 @@ public class TileQueryHelper { info.state.expandedAccessibilityClassName = Button.class.getName(); info.spec = spec; - info.appLabel = appLabel; + info.state.secondaryLabel = (isSystem || TextUtils.equals(state.label, appLabel)) + ? null : appLabel; info.isSystem = isSystem; mTiles.add(info); mSpecs.add(spec); @@ -186,7 +188,6 @@ public class TileQueryHelper { public static class TileInfo { public String spec; - public CharSequence appLabel; public QSTile.State state; public boolean isSystem; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java index 45c20a043ac96..47747851eb1b4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java @@ -40,7 +40,7 @@ public class QSTileView extends QSTileBaseView { private static final boolean DUAL_TARGET_ALLOWED = false; private View mDivider; protected TextView mLabel; - private TextView mSecondLine; + protected TextView mSecondLine; private ImageView mPadLock; private int mState; private ViewGroup mLabelContainer;