Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,14 @@ public interface QSTile { void destroy(); void destroy(); /** * return true if the tile supports detail views, and not * only boolean states */ default boolean supportsDetailView() { return false; } CharSequence getTileLabel(); CharSequence getTileLabel(); State getState(); State getState(); Loading packages/SystemUI/res/layout/qs_tile_detail_text.xml 0 → 100644 +33 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2019 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- use 'dp' instead of 'sp' as we do not want the text to increase if the user scales the font size --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:text="..." android:textSize="16dp" android:fontFamily="@*android:string/config_headlineFontFamily" android:singleLine="true" android:visibility="gone" android:paddingBottom="@dimen/qs_tile_detail_padding" android:clickable="false" android:focusable="false" /> packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -457,6 +457,7 @@ <dimen name="qs_page_indicator_width">16dp</dimen> <dimen name="qs_page_indicator_width">16dp</dimen> <dimen name="qs_page_indicator_height">8dp</dimen> <dimen name="qs_page_indicator_height">8dp</dimen> <dimen name="qs_tile_icon_size">24dp</dimen> <dimen name="qs_tile_icon_size">24dp</dimen> <dimen name="qs_tile_detail_padding">3dp</dimen> <dimen name="qs_tile_text_size">12sp</dimen> <dimen name="qs_tile_text_size">12sp</dimen> <dimen name="qs_tile_divider_height">1dp</dimen> <dimen name="qs_tile_divider_height">1dp</dimen> <dimen name="qs_panel_padding">16dp</dimen> <dimen name="qs_panel_padding">16dp</dimen> Loading packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java +16 −1 Original line number Original line Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.text.TextUtils; import android.util.Log; import android.util.Log; import android.util.PathParser; import android.util.PathParser; import android.view.Gravity; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent; Loading @@ -43,6 +44,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ImageView; import android.widget.Switch; import android.widget.Switch; import android.widget.TextView; import com.android.settingslib.Utils; import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.R; Loading @@ -67,6 +69,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private boolean mShowRippleEffect = true; private boolean mShowRippleEffect = true; private final ImageView mBg; private final ImageView mBg; private final TextView mDetailText; private final int mColorActive; private final int mColorActive; private final int mColorInactive; private final int mColorInactive; private final int mColorDisabled; private final int mColorDisabled; Loading Loading @@ -106,6 +109,12 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); Gravity.CENTER); mIconFrame.addView(mIcon, params); 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.setClipChildren(false); mIconFrame.setClipToPadding(false); mIconFrame.setClipToPadding(false); Loading Loading @@ -161,6 +170,10 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { tile.longClick(); tile.longClick(); return true; return true; }); }); if (tile.supportsDetailView()) { mDetailText.setVisibility(View.VISIBLE); } } } public void init(OnClickListener click, OnClickListener secondaryClick, public void init(OnClickListener click, OnClickListener secondaryClick, Loading Loading @@ -214,6 +227,8 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { mCircleColor = circleColor; mCircleColor = circleColor; } } mDetailText.setTextColor(QSTileImpl.getColorForState(getContext(), state.state)); mShowRippleEffect = state.showRippleEffect; mShowRippleEffect = state.showRippleEffect; setClickable(state.state != Tile.STATE_UNAVAILABLE); setClickable(state.state != Tile.STATE_UNAVAILABLE); setLongClickable(state.handlesLongClick); setLongClickable(state.handlesLongClick); Loading packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,11 @@ public class WifiTile extends QSTileImpl<SignalState> { else return WIFI_SETTINGS; else return WIFI_SETTINGS; } } @Override public boolean supportsDetailView() { return getDetailAdapter() != null && mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK; } @Override @Override protected void handleClick() { protected void handleClick() { if (mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK) { if (mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK) { Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,14 @@ public interface QSTile { void destroy(); void destroy(); /** * return true if the tile supports detail views, and not * only boolean states */ default boolean supportsDetailView() { return false; } CharSequence getTileLabel(); CharSequence getTileLabel(); State getState(); State getState(); Loading
packages/SystemUI/res/layout/qs_tile_detail_text.xml 0 → 100644 +33 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2019 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- use 'dp' instead of 'sp' as we do not want the text to increase if the user scales the font size --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:text="..." android:textSize="16dp" android:fontFamily="@*android:string/config_headlineFontFamily" android:singleLine="true" android:visibility="gone" android:paddingBottom="@dimen/qs_tile_detail_padding" android:clickable="false" android:focusable="false" />
packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -457,6 +457,7 @@ <dimen name="qs_page_indicator_width">16dp</dimen> <dimen name="qs_page_indicator_width">16dp</dimen> <dimen name="qs_page_indicator_height">8dp</dimen> <dimen name="qs_page_indicator_height">8dp</dimen> <dimen name="qs_tile_icon_size">24dp</dimen> <dimen name="qs_tile_icon_size">24dp</dimen> <dimen name="qs_tile_detail_padding">3dp</dimen> <dimen name="qs_tile_text_size">12sp</dimen> <dimen name="qs_tile_text_size">12sp</dimen> <dimen name="qs_tile_divider_height">1dp</dimen> <dimen name="qs_tile_divider_height">1dp</dimen> <dimen name="qs_panel_padding">16dp</dimen> <dimen name="qs_panel_padding">16dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileBaseView.java +16 −1 Original line number Original line Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.text.TextUtils; import android.util.Log; import android.util.Log; import android.util.PathParser; import android.util.PathParser; import android.view.Gravity; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent; Loading @@ -43,6 +44,7 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ImageView; import android.widget.Switch; import android.widget.Switch; import android.widget.TextView; import com.android.settingslib.Utils; import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.R; Loading @@ -67,6 +69,7 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { private boolean mShowRippleEffect = true; private boolean mShowRippleEffect = true; private final ImageView mBg; private final ImageView mBg; private final TextView mDetailText; private final int mColorActive; private final int mColorActive; private final int mColorInactive; private final int mColorInactive; private final int mColorDisabled; private final int mColorDisabled; Loading Loading @@ -106,6 +109,12 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER); Gravity.CENTER); mIconFrame.addView(mIcon, params); 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.setClipChildren(false); mIconFrame.setClipToPadding(false); mIconFrame.setClipToPadding(false); Loading Loading @@ -161,6 +170,10 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { tile.longClick(); tile.longClick(); return true; return true; }); }); if (tile.supportsDetailView()) { mDetailText.setVisibility(View.VISIBLE); } } } public void init(OnClickListener click, OnClickListener secondaryClick, public void init(OnClickListener click, OnClickListener secondaryClick, Loading Loading @@ -214,6 +227,8 @@ public class QSTileBaseView extends com.android.systemui.plugins.qs.QSTileView { mCircleColor = circleColor; mCircleColor = circleColor; } } mDetailText.setTextColor(QSTileImpl.getColorForState(getContext(), state.state)); mShowRippleEffect = state.showRippleEffect; mShowRippleEffect = state.showRippleEffect; setClickable(state.state != Tile.STATE_UNAVAILABLE); setClickable(state.state != Tile.STATE_UNAVAILABLE); setLongClickable(state.handlesLongClick); setLongClickable(state.handlesLongClick); Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,11 @@ public class WifiTile extends QSTileImpl<SignalState> { else return WIFI_SETTINGS; else return WIFI_SETTINGS; } } @Override public boolean supportsDetailView() { return getDetailAdapter() != null && mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK; } @Override @Override protected void handleClick() { protected void handleClick() { if (mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK) { if (mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK) { Loading