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

Commit 59b73580 authored by Michael Kwan's avatar Michael Kwan
Browse files

Add watch specific tweaks to global actions layouts.

Also add null check to single action global actions.

Bug: 78276813
Change-Id: I02ebd642b5df00084b7ac5e6425defb6119c3955
parent e442db3e
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -77,22 +77,28 @@ public abstract class SinglePressAction implements Action {

        TextView statusView = v.findViewById(R.id.status);
        final String status = getStatus();
        if (statusView != null) {
            if (!TextUtils.isEmpty(status)) {
                statusView.setText(status);
            } else {
                statusView.setVisibility(View.GONE);
            }
        }
        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 (messageView != null) {
            if (mMessage != null) {
                messageView.setText(mMessage);
            } else {
                messageView.setText(mMessageResId);
            }
        }

        return v;
    }
+22 −0
Original line number Diff line number Diff line
<?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"/>
+43 −37
Original line number Diff line number Diff line
@@ -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">
    <LinearLayout
            android:duplicateParentState="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        android:minHeight="?attr/listPreferredItemHeightSmall"
            android:maxHeight="?attr/listPreferredItemHeightSmall"
            android:gravity="center_vertical"
            android:paddingStart="?attr/listPreferredItemPaddingStart"
            android:paddingEnd="?attr/listPreferredItemPaddingEnd"
        android:background="?attr/activatedBackgroundIndicator"
            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: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"/>
                android:layout_marginTop="4dp"
                android:layout_marginBottom="4dp"
                android:layout_width="40dp"
                android:layout_height="40dp"/>

    <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
        <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>
                android:layout_height="wrap_content"/>
    </LinearLayout>
</FrameLayout>
+1 −0
Original line number Diff line number Diff line
@@ -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" />