diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java index 638858a38335e..db026cad6ef53 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java @@ -68,6 +68,14 @@ public interface QSTile { void destroy(); + /** + * return true if the tile supports detail views, and not + * only boolean states + */ + default boolean supportsDetailView() { + return false; + } + CharSequence getTileLabel(); State getState(); diff --git a/packages/SystemUI/res/layout/qs_tile_detail_text.xml b/packages/SystemUI/res/layout/qs_tile_detail_text.xml new file mode 100644 index 0000000000000..bcbf826b9d492 --- /dev/null +++ b/packages/SystemUI/res/layout/qs_tile_detail_text.xml @@ -0,0 +1,33 @@ + + + + + + diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 3a1f7a37729f9..1079206c81ced 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -457,6 +457,7 @@ 16dp 8dp 24dp + 3dp 12sp 1dp 16dp diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java index f4a516261ade9..8b7f280608a54 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java @@ -36,6 +36,7 @@ import android.text.TextUtils; import android.util.Log; import android.util.PathParser; import android.view.Gravity; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; @@ -43,6 +44,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.Switch; +import android.widget.TextView; import com.android.settingslib.Utils; import com.android.systemui.R; @@ -67,6 +69,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private boolean mShowRippleEffect = true; private final ImageView mBg; + private final TextView mDetailText; private final int mColorActive; private final int mColorInactive; private final int mColorDisabled; @@ -106,6 +109,12 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); mIconFrame.addView(mIcon, params); + + // "..." afforadance below icon + mDetailText = (TextView) LayoutInflater.from(context).inflate(R.layout.qs_tile_detail_text, + mIconFrame, false); + mIconFrame.addView(mDetailText); + mIconFrame.setClipChildren(false); mIconFrame.setClipToPadding(false); @@ -161,6 +170,10 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { tile.longClick(); return true; }); + + if (tile.supportsDetailView()) { + mDetailText.setVisibility(View.VISIBLE); + } } public void init(OnClickListener click, OnClickListener secondaryClick, @@ -214,6 +227,8 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { mCircleColor = circleColor; } + mDetailText.setTextColor(QSTileImpl.getColorForState(getContext(), state.state)); + mShowRippleEffect = state.showRippleEffect; setClickable(state.state != Tile.STATE_UNAVAILABLE); setLongClickable(state.handlesLongClick); @@ -352,4 +367,4 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { } } } -} \ No newline at end of file +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index b79b662a2bd73..b7ce101cacab9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -117,6 +117,11 @@ public class WifiTile extends QSTileImpl { else return WIFI_SETTINGS; } + @Override + public boolean supportsDetailView() { + return getDetailAdapter() != null && mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK; + } + @Override protected void handleClick() { if (mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK) {