Merge "QS edit mode fixes." into pi-dev

am: c6de4240d5

Change-Id: I33179a69d3805e454e04655e8760c8d322d89377
This commit is contained in:
Amin Shaikh
2018-03-23 01:18:25 +00:00
committed by android-build-merger
5 changed files with 14 additions and 24 deletions

View File

@@ -140,7 +140,6 @@ public class QSContainerImpl extends FrameLayout {
setMargins(mQSFooter); setMargins(mQSFooter);
setMargins(mQSPanel); setMargins(mQSPanel);
setMargins(mHeader); setMargins(mHeader);
setMargins(mQSCustomizer);
} }
private void setMargins(View view) { private void setMargins(View view) {

View File

@@ -15,42 +15,33 @@
package com.android.systemui.qs.customize; package com.android.systemui.qs.customize;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.QSIconView; import com.android.systemui.plugins.qs.QSIconView;
import com.android.systemui.plugins.qs.QSTile;
import com.android.systemui.qs.tileimpl.QSTileView; import com.android.systemui.qs.tileimpl.QSTileView;
import java.util.Objects;
public class CustomizeTileView extends QSTileView { public class CustomizeTileView extends QSTileView {
private boolean mShowAppLabel;
private TextView mAppLabel;
private int mLabelMinLines;
public CustomizeTileView(Context context, QSIconView icon) { public CustomizeTileView(Context context, QSIconView icon) {
super(context, 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) { public void setShowAppLabel(boolean showAppLabel) {
mAppLabel.setVisibility(showAppLabel ? View.VISIBLE : View.GONE); mShowAppLabel = showAppLabel;
mSecondLine.setVisibility(showAppLabel ? View.VISIBLE : View.GONE);
mLabel.setSingleLine(showAppLabel); mLabel.setSingleLine(showAppLabel);
} }
public void setAppLabel(CharSequence label) { @Override
if (!Objects.equals(label, mAppLabel.getText())) { protected void handleStateChanged(QSTile.State state) {
mAppLabel.setText(label); super.handleStateChanged(state);
} mSecondLine.setVisibility(mShowAppLabel ? View.VISIBLE : View.GONE);
} }
public TextView getAppLabel() { public TextView getAppLabel() {
return mAppLabel; return mSecondLine;
} }
} }

View File

@@ -274,7 +274,6 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta
R.string.accessibility_qs_edit_tile_label, position + 1, info.state.label); R.string.accessibility_qs_edit_tile_label, position + 1, info.state.label);
} }
holder.mTileView.onStateChanged(info.state); holder.mTileView.onStateChanged(info.state);
holder.mTileView.setAppLabel(info.appLabel);
holder.mTileView.setShowAppLabel(position > mEditIndex && !info.isSystem); holder.mTileView.setShowAppLabel(position > mEditIndex && !info.isSystem);
if (mAccessibilityManager.isTouchExplorationEnabled()) { if (mAccessibilityManager.isTouchExplorationEnabled()) {

View File

@@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.service.quicksettings.TileService; import android.service.quicksettings.TileService;
import android.text.TextUtils;
import android.widget.Button; import android.widget.Button;
import com.android.systemui.Dependency; import com.android.systemui.Dependency;
@@ -169,7 +170,8 @@ public class TileQueryHelper {
info.state.expandedAccessibilityClassName = info.state.expandedAccessibilityClassName =
Button.class.getName(); Button.class.getName();
info.spec = spec; info.spec = spec;
info.appLabel = appLabel; info.state.secondaryLabel = (isSystem || TextUtils.equals(state.label, appLabel))
? null : appLabel;
info.isSystem = isSystem; info.isSystem = isSystem;
mTiles.add(info); mTiles.add(info);
mSpecs.add(spec); mSpecs.add(spec);
@@ -186,7 +188,6 @@ public class TileQueryHelper {
public static class TileInfo { public static class TileInfo {
public String spec; public String spec;
public CharSequence appLabel;
public QSTile.State state; public QSTile.State state;
public boolean isSystem; public boolean isSystem;
} }

View File

@@ -40,7 +40,7 @@ public class QSTileView extends QSTileBaseView {
private static final boolean DUAL_TARGET_ALLOWED = false; private static final boolean DUAL_TARGET_ALLOWED = false;
private View mDivider; private View mDivider;
protected TextView mLabel; protected TextView mLabel;
private TextView mSecondLine; protected TextView mSecondLine;
private ImageView mPadLock; private ImageView mPadLock;
private int mState; private int mState;
private ViewGroup mLabelContainer; private ViewGroup mLabelContainer;