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

Commit e263b621 authored by Will Leshner's avatar Will Leshner
Browse files

Add desired widget sizes to widget picker action intent.

This is to support filtering widgets in the communal hub widget picker.

Bug: 322191186
Test: manualy against ag/26052248
Flag: NA
Change-Id: Iea1edd49bae5ba9599ca72b549db9c8fc0bcd9c5
parent 038c071e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -903,6 +903,10 @@
        Keep it the same as in Launcher-->
    <dimen name="communal_enforced_rounded_corner_max_radius">16dp</dimen>

    <!-- Width and height used to filter widgets displayed in the communal widget picker -->
    <dimen name="communal_widget_picker_desired_width">464dp</dimen>
    <dimen name="communal_widget_picker_desired_height">307dp</dimen>

    <!-- The width/height of the unlock icon view on keyguard. -->
    <dimen name="keyguard_lock_height">42dp</dimen>
    <dimen name="keyguard_lock_padding">20dp</dimen>
+18 −7
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.internal.logging.UiEventLogger
import com.android.systemui.communal.shared.log.CommunalUiEvent
import com.android.systemui.communal.ui.viewmodel.CommunalEditModeViewModel
import com.android.systemui.compose.ComposeFacade.setCommunalEditWidgetActivityContent
import com.android.systemui.res.R
import javax.inject.Inject

/** An Activity for editing the widgets that appear in hub mode. */
@@ -44,8 +45,10 @@ constructor(
) : ComponentActivity() {
    companion object {
        private const val EXTRA_IS_PENDING_WIDGET_DRAG = "is_pending_widget_drag"
        private const val EXTRA_FILTER_STRATEGY = "filter_strategy"
        private const val FILTER_STRATEGY_GLANCEABLE_HUB = 1
        private const val EXTRA_DESIRED_WIDGET_WIDTH = "desired_widget_width"

        private const val EXTRA_DESIRED_WIDGET_HEIGHT = "desired_widget_height"

        private const val TAG = "EditWidgetsActivity"
        const val EXTRA_PRESELECTED_KEY = "preselected_key"
    }
@@ -110,11 +113,19 @@ constructor(
                    ?.let { packageName ->
                        try {
                            addWidgetActivityLauncher.launch(
                                Intent(Intent.ACTION_PICK).also {
                                    it.setPackage(packageName)
                                    it.putExtra(
                                        EXTRA_FILTER_STRATEGY,
                                        FILTER_STRATEGY_GLANCEABLE_HUB
                                Intent(Intent.ACTION_PICK).apply {
                                    setPackage(packageName)
                                    putExtra(
                                        EXTRA_DESIRED_WIDGET_WIDTH,
                                        resources.getDimensionPixelSize(
                                            R.dimen.communal_widget_picker_desired_width
                                        )
                                    )
                                    putExtra(
                                        EXTRA_DESIRED_WIDGET_HEIGHT,
                                        resources.getDimensionPixelSize(
                                            R.dimen.communal_widget_picker_desired_height
                                        )
                                    )
                                }
                            )