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

Commit 65c210b1 authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Add power menu lite

Refactored existing long-press power menu so common elements could be
reused. This power menu only includes the standard buttons and can
rotate, with different "grid" size based on number of buttons available

Bug: 179674461
Test: atest com.android.systemui.globalactions
Test: manual, verify layout looks correct with different buttons and rotations

Change-Id: I2b61bc0ac2c9a15c4acc639770e4a3799a26c21a
parent df7f14b8
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright 2021, 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.
*/
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
  <solid android:color="@color/global_actions_lite_background"/>
  <corners android:radius="@dimen/global_actions_corner_radius" />
</shape>
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright 2021, 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.
*/
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
  <solid android:color="@color/global_actions_lite_button_background"/>
</shape>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->
<com.android.systemui.globalactions.GlobalActionsItem
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_weight="1"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:stateListAnimator="@anim/control_state_list_animator">
        <ImageView
            android:id="@*android:id/icon"
            android:layout_width="@dimen/global_actions_button_size"
            android:layout_height="@dimen/global_actions_button_size"
            android:layout_marginBottom="@dimen/global_actions_grid_container_bottom_margin"
            android:padding="@dimen/global_actions_button_padding"
            android:scaleType="centerInside"
            android:tint="@color/global_actions_lite_text"
            android:background="@drawable/global_actions_lite_button"/>
        <TextView
            android:id="@*android:id/message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:marqueeRepeatLimit="marquee_forever"
            android:maxLines="2"
            android:textSize="12sp"
            android:gravity="center"
            android:textColor="@color/global_actions_lite_text"
            android:breakStrategy="high_quality"
            android:hyphenationFrequency="full"
            android:textAppearance="?android:attr/textAppearanceSmall" />
</com.android.systemui.globalactions.GlobalActionsItem>
+56 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/global_actions_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_gravity="center">
  <com.android.systemui.globalactions.GlobalActionsLayoutLite
      android:id="@id/global_actions_view"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:clipChildren="false"
      android:clipToPadding="false"
      android:background="@drawable/global_actions_lite_background"
      android:padding="@dimen/global_actions_lite_padding">
    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@android:id/list"
        android:gravity="center"
        android:translationZ="@dimen/global_actions_translate"
        android:orientation="horizontal"
        android:layoutDirection="ltr">
      <androidx.constraintlayout.helper.widget.Flow
          android:id="@+id/list_flow"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:flow_wrapMode="chain"
          app:flow_maxElementsWrap="2"
          app:flow_horizontalGap="@dimen/global_actions_lite_padding"
          app:flow_verticalGap="@dimen/global_actions_lite_padding"
          app:flow_horizontalStyle="packed"/>
    </androidx.constraintlayout.widget.ConstraintLayout>
  </com.android.systemui.globalactions.GlobalActionsLayoutLite>
</LinearLayout>
+7 −0
Original line number Diff line number Diff line
@@ -54,6 +54,13 @@
    <color name="global_actions_emergency_background">@color/GM2_red_400</color>
    <color name="global_actions_emergency_text">@color/GM2_grey_100</color>

    <!-- Colors for Power Menu Lite -->
    <color name="global_actions_lite_background">#191C18</color>
    <color name="global_actions_lite_button_background">#303030</color>
    <color name="global_actions_lite_text">#F0F0F0</color>
    <color name="global_actions_lite_emergency_background">#F85D4D</color>
    <color name="global_actions_lite_emergency_icon">@color/GM2_grey_900</color>

    <color name="global_actions_shutdown_ui_text">@color/control_primary_text</color>

    <!-- Tint color for the content on the notification overflow card. -->
Loading