QS - Prototype visual affordance for detail panels
Builds on ag/9335278 to show "..." below tiles that support direct to detail view on touch. Test: manual Change-Id: I1c192656505bac228a3935f0aa498c37a468d973
This commit is contained in:
@@ -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();
|
||||
|
||||
33
packages/SystemUI/res/layout/qs_tile_detail_text.xml
Normal file
33
packages/SystemUI/res/layout/qs_tile_detail_text.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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" />
|
||||
|
||||
@@ -457,6 +457,7 @@
|
||||
<dimen name="qs_page_indicator_width">16dp</dimen>
|
||||
<dimen name="qs_page_indicator_height">8dp</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_divider_height">1dp</dimen>
|
||||
<dimen name="qs_panel_padding">16dp</dimen>
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@ public class WifiTile extends QSTileImpl<SignalState> {
|
||||
else return WIFI_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsDetailView() {
|
||||
return getDetailAdapter() != null && mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleClick() {
|
||||
if (mQSSettingsPanelOption == QSSettingsPanel.OPEN_CLICK) {
|
||||
|
||||
Reference in New Issue
Block a user