Merge "QS edit mode fixes." into pi-dev
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
index 7da109d..bfbfbf6 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 @@
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 9759b69..eb95866 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 3ba5fe6..441d29b 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 @@
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 2ac592f..8bf4096 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.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 @@
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 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 45c20a0..4774785 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 @@
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;