Merge "Add watch specific tweaks to global actions layouts." into pi-dev

This commit is contained in:
Michael Kwan
2018-05-09 01:53:50 +00:00
committed by Android (Google) Code Review
4 changed files with 85 additions and 50 deletions

View File

@@ -77,21 +77,27 @@ public abstract class SinglePressAction implements Action {
TextView statusView = v.findViewById(R.id.status);
final String status = getStatus();
if (!TextUtils.isEmpty(status)) {
statusView.setText(status);
} else {
statusView.setVisibility(View.GONE);
if (statusView != null) {
if (!TextUtils.isEmpty(status)) {
statusView.setText(status);
} else {
statusView.setVisibility(View.GONE);
}
}
if (mIcon != null) {
icon.setImageDrawable(mIcon);
icon.setScaleType(ImageView.ScaleType.CENTER_CROP);
} else if (mIconResId != 0) {
icon.setImageDrawable(context.getDrawable(mIconResId));
if (icon != null) {
if (mIcon != null) {
icon.setImageDrawable(mIcon);
icon.setScaleType(ImageView.ScaleType.CENTER_CROP);
} else if (mIconResId != 0) {
icon.setImageDrawable(context.getDrawable(mIconResId));
}
}
if (mMessage != null) {
messageView.setText(mMessage);
} else {
messageView.setText(mMessageResId);
if (messageView != null) {
if (mMessage != null) {
messageView.setText(mMessage);
} else {
messageView.setText(mMessageResId);
}
}
return v;

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingTop="?attr/dialogPreferredPadding"
android:paddingBottom="?attr/dialogPreferredPadding"
android:orientation="vertical"/>

View File

@@ -13,46 +13,52 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:background="?attr/activatedBackgroundIndicator"
android:clipToPadding="false">
<ImageView android:id="@+id/icon"
android:background="@drawable/global_action_icon_background"
android:scaleType="centerInside"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:duplicateParentState="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
android:maxHeight="?attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:background="?attr/selectableItemBackground"
android:clipToPadding="false">
<ImageView android:id="@+id/icon"
android:duplicateParentState="true"
android:background="@drawable/global_action_icon_background"
android:scaleType="centerInside"
android:padding="8dp"
android:gravity="center"
android:layout_marginEnd="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_width="40dp"
android:layout_height="40dp"/>
<FrameLayout android:id="@+id/widget_frame"
android:duplicateParentState="true"
android:gravity="center"
android:visibility="gone"
android:orientation="horizontal"
android:layout_marginEnd="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_width="40dp"
android:layout_height="40dp"/>
<TextView android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:textAppearance="?attr/textAppearanceListItem"
android:ellipsize="end" />
<TextView android:id="@+id/status"
android:ellipsize="end"
android:layout_weight="1"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/message"
android:layout_alignStart="@id/message"
android:textAppearance="?attr/textAppearanceListItemSecondary"
android:textColor="?attr/textColorSecondary"/>
</RelativeLayout>
</LinearLayout>
android:layout_height="wrap_content"/>
</LinearLayout>
</FrameLayout>

View File

@@ -1732,6 +1732,7 @@
<java-symbol type="integer" name="config_lidNavigationAccessibility" />
<java-symbol type="integer" name="config_lidOpenRotation" />
<java-symbol type="integer" name="config_longPressOnHomeBehavior" />
<java-symbol type="layout" name="global_actions" />
<java-symbol type="layout" name="global_actions_item" />
<java-symbol type="layout" name="global_actions_silent_mode" />
<java-symbol type="layout" name="recent_apps_dialog" />