UI updates to dual target tiles

Have an underline + an arrow to indicate them instead of a divider.

Test: visual
Change-Id: I8fdff53825f9668edd5c527b42410c301f943785
This commit is contained in:
Jason Monk
2017-03-16 13:26:13 -04:00
parent f33a037907
commit f12710a545
2 changed files with 48 additions and 19 deletions

View File

@@ -14,24 +14,38 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:paddingTop="8dp">
<LinearLayout
android:id="@+id/label_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView android:id="@+id/tile_label"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tile_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorPrimary"
android:gravity="center_horizontal"
android:minLines="2"
android:clickable="false"
android:maxLines="2"
android:padding="0dp"
android:textAppearance="@style/TextAppearance.QS.TileLabel"
android:clickable="false" />
<ImageView android:id="@+id/restricted_padlock"
android:textColor="?android:attr/textColorPrimary"/>
<ImageView
android:id="@+id/expand_indicator"
android:layout_marginStart="4dp"
android:layout_width="12dp"
android:layout_height="match_parent"
android:src="@drawable/qs_dual_tile_caret"
android:tint="?android:attr/textColorPrimary" />
<ImageView android:id="@+id/restricted_padlock"
android:layout_width="@dimen/qs_tile_text_size"
android:layout_height="match_parent"
android:paddingBottom="@dimen/qs_tile_text_size"
@@ -39,4 +53,17 @@
android:layout_marginLeft="@dimen/restricted_padlock_pading"
android:scaleType="centerInside"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/underline"
android:layout_width="30dp"
android:layout_height="1dp"
android:layout_marginTop="2dp"
android:layout_alignStart="@id/label_group"
android:layout_alignEnd="@id/label_group"
android:layout_below="@id/label_group"
android:alpha="?android:attr/disabledAlpha"
android:background="?android:attr/colorForeground"/>
</RelativeLayout>

View File

@@ -36,11 +36,12 @@ import libcore.util.Objects;
/** View that represents a standard quick settings tile. **/
public class QSTileView extends QSTileBaseView {
private final View mDivider;
private View mDivider;
protected TextView mLabel;
private ImageView mPadLock;
private int mState;
private ViewGroup mLabelContainer;
private View mExpandIndicator;
public QSTileView(Context context, QSIconView icon) {
this(context, icon, false);
@@ -54,8 +55,6 @@ public class QSTileView extends QSTileBaseView {
setClickable(true);
setId(View.generateViewId());
mDivider = LayoutInflater.from(context).inflate(R.layout.divider, this, false);
addView(mDivider);
createLabel();
setOrientation(VERTICAL);
setGravity(Gravity.CENTER);
@@ -81,8 +80,10 @@ public class QSTileView extends QSTileBaseView {
.inflate(R.layout.qs_tile_label, this, false);
mLabelContainer.setClipChildren(false);
mLabelContainer.setClipToPadding(false);
mLabel = (TextView) mLabelContainer.findViewById(R.id.tile_label);
mPadLock = (ImageView) mLabelContainer.findViewById(R.id.restricted_padlock);
mLabel = mLabelContainer.findViewById(R.id.tile_label);
mPadLock = mLabelContainer.findViewById(R.id.restricted_padlock);
mDivider = mLabelContainer.findViewById(R.id.underline);
mExpandIndicator = mLabelContainer.findViewById(R.id.expand_indicator);
addView(mLabelContainer);
}
@@ -101,6 +102,7 @@ public class QSTileView extends QSTileBaseView {
mLabel.setText(state.label);
}
mDivider.setVisibility(state.dualTarget ? View.VISIBLE : View.INVISIBLE);
mExpandIndicator.setVisibility(state.dualTarget ? View.VISIBLE : View.GONE);
if (state.dualTarget != mLabelContainer.isClickable()) {
mLabelContainer.setClickable(state.dualTarget);
mLabelContainer.setLongClickable(state.dualTarget);