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

Commit 4fcfc79a authored by Will Leshner's avatar Will Leshner Committed by Darrell Shi
Browse files

Implement a basic widget picker for hub mode.

Test: atest CommunalInteractorTest
Bug: 307306823
Flag: ACONFIG com.android.systemui.communal_hub DEVELOPMENT

Change-Id: I5b1046fe4aefaf0153a1881df3d12df7a804b841
parent a41c20a7
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -982,6 +982,24 @@
            android:excludeFromRecents="true"
            android:visibleToInstantApps="true"/>

        <activity android:name="com.android.systemui.communal.widgets.WidgetPickerActivity"
            android:theme="@style/Theme.EditWidgetsActivity"
            android:excludeFromRecents="true"
            android:autoRemoveFromRecents="true"
            android:showOnLockScreen="true"
            android:launchMode="singleTop"
            android:exported="false">
        </activity>

        <activity android:name="com.android.systemui.communal.widgets.EditWidgetsActivity"
            android:theme="@style/Theme.EditWidgetsActivity"
            android:excludeFromRecents="true"
            android:autoRemoveFromRecents="true"
            android:showOnLockScreen="true"
            android:launchMode="singleTop"
            android:exported="false">
        </activity>

        <!-- Doze with notifications, run in main sysui process for every user  -->
        <service
            android:name=".doze.DozeService"
+3 −5
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
@@ -86,11 +87,8 @@ fun CommunalHub(
                )
            }
        }
        IconButton(onClick = viewModel::onOpenWidgetPicker) {
            Icon(
                Icons.Default.Add,
                LocalContext.current.getString(R.string.button_to_open_widget_picker)
            )
        IconButton(onClick = viewModel::onOpenWidgetEditor) {
            Icon(Icons.Default.Add, stringResource(R.string.button_to_open_widget_editor))
        }
    }
}
+32 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2023 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.
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/edit_widgets"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        style="@android:Widget.DeviceDefault.Button.Colored"
        android:id="@+id/add_widget"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textSize="28sp"
        android:text="@string/hub_mode_add_widget_button_text"/>

</FrameLayout>
+26 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2023 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:id="@+id/widgets_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="64dp"
    android:gravity="center_vertical"
    android:orientation="horizontal">

</LinearLayout>
+4 −2
Original line number Diff line number Diff line
@@ -1048,10 +1048,12 @@
    <!-- Indicator on keyguard to start the communal tutorial. [CHAR LIMIT=100] -->
    <string name="communal_tutorial_indicator_text">Swipe left to start the communal tutorial</string>

    <!-- Description for the button that opens the widget picker on click. [CHAR LIMIT=50] -->
    <string name="button_to_open_widget_picker">Open the widget picker</string>
    <!-- Description for the button that opens the widget editor on click. [CHAR LIMIT=50] -->
    <string name="button_to_open_widget_editor">Open the widget editor</string>
    <!-- Description for the button that removes a widget on click. [CHAR LIMIT=50] -->
    <string name="button_to_remove_widget">Remove a widget</string>
    <!-- Text for the button that launches the hub mode widget picker. [CHAR LIMIT=50] -->
    <string name="hub_mode_add_widget_button_text">Add Widget</string>

    <!-- Related to user switcher --><skip/>

Loading