From e4f2661946809e187d07644739a757c7fff24cff Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Fri, 3 Mar 2017 10:05:18 -0500 Subject: [PATCH] QS: Fix up non-dual target touches Make sure the label doesn't take any touches or show a background if the tile doesn't support dual touch targets. Test: Click on text of flashlight Change-Id: Ib6a91e04a739e3ba74d0d05336ce70790dcf6a7a Fixes: 35855398 --- .../src/com/android/systemui/qs/QSTileView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java index 428fe9bbff7e0..7d13f76778feb 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileView.java @@ -84,7 +84,6 @@ public class QSTileView extends QSTileBaseView { mLabel = (TextView) mLabelContainer.findViewById(R.id.tile_label); mPadLock = (ImageView) mLabelContainer.findViewById(R.id.restricted_padlock); - mLabelContainer.setBackground(newTileBackground()); addView(mLabelContainer); } @@ -102,6 +101,11 @@ public class QSTileView extends QSTileBaseView { mLabel.setText(state.label); } mDivider.setVisibility(state.dualTarget ? View.VISIBLE : View.INVISIBLE); + if (state.dualTarget != mLabelContainer.isClickable()) { + mLabelContainer.setClickable(state.dualTarget); + mLabelContainer.setLongClickable(state.dualTarget); + mLabelContainer.setBackground(state.dualTarget ? newTileBackground() : null); + } mLabel.setEnabled(!state.disabledByPolicy); mPadLock.setVisibility(state.disabledByPolicy ? View.VISIBLE : View.GONE); } @@ -110,7 +114,9 @@ public class QSTileView extends QSTileBaseView { public void init(OnClickListener click, OnClickListener secondaryClick, OnLongClickListener longClick) { super.init(click, secondaryClick, longClick); - mLabelContainer.setClickable(true); mLabelContainer.setOnClickListener(secondaryClick); + mLabelContainer.setOnLongClickListener(longClick); + mLabelContainer.setClickable(false); + mLabelContainer.setLongClickable(false); } }