Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3e8cbd2 authored by Matt Pietal's avatar Matt Pietal
Browse files

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
parent 053c2ebe
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -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();
+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" />
+1 −0
Original line number Original line Diff line number Diff line
@@ -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>
+16 −1
Original line number Original line Diff line number Diff line
@@ -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;
@@ -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;
@@ -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;
@@ -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);


@@ -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,
@@ -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);
+5 −0
Original line number Original line Diff line number Diff line
@@ -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) {