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

Commit cdeef27f authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Adding viewmodel and composable for tile layout refactor

Added the start of the tile composable with only the background colors and labels.
Missing the rest of the UI elements, clicks/long clicks, logging, etc.

Bug: 331598956
Flag: ACONFIG com.android.systemui.qs_ui_refactor DEVELOPMENT
Test: TileGridViewModelTest
Test: adb shell am start -n com.android.systemui/com.google.android.systemui.qs.ui.activity.QSActivity

Change-Id: I3ced8ee1d315ce5d2e98ae785ad19a1669a9f51a
parent 46f27a9c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@
    <!-- The number of rows in the QuickSettings -->
    <integer name="quick_settings_max_rows">4</integer>

    <!-- The number of columns in the infinite grid QuickSettings -->
    <integer name="quick_settings_infinite_grid_num_columns">4</integer>

    <!-- Override column number for quick settings.
    For now, this value has effect only when flag lockscreen.enable_landscape is enabled.
    TODO (b/293252410) - change this comment/resource when flag is enabled -->
+10 −0
Original line number Diff line number Diff line
@@ -18,10 +18,20 @@ package com.android.systemui.qs.panels.dagger

import com.android.systemui.qs.panels.data.repository.IconTilesRepository
import com.android.systemui.qs.panels.data.repository.IconTilesRepositoryImpl
import com.android.systemui.qs.panels.shared.model.GridLayoutTypeKey
import com.android.systemui.qs.panels.shared.model.InfiniteGridLayoutType
import com.android.systemui.qs.panels.ui.compose.GridLayout
import com.android.systemui.qs.panels.ui.compose.InfiniteGridLayout
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoMap

@Module
interface PanelsModule {
    @Binds fun bindIconTilesRepository(impl: IconTilesRepositoryImpl): IconTilesRepository

    @Binds
    @IntoMap
    @GridLayoutTypeKey(InfiniteGridLayoutType::class)
    fun bindGridLayout(impl: InfiniteGridLayout): GridLayout
}
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.
 */

package com.android.systemui.qs.panels.data.repository

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.qs.panels.shared.model.GridLayoutType
import com.android.systemui.qs.panels.shared.model.InfiniteGridLayoutType
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf

@SysUISingleton
class GridLayoutTypeRepository @Inject constructor() {
    val layout: Flow<GridLayoutType> = flowOf(InfiniteGridLayoutType)
}
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.
 */

package com.android.systemui.qs.panels.domain.interactor

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.qs.panels.data.repository.GridLayoutTypeRepository
import com.android.systemui.qs.panels.shared.model.GridLayoutType
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow

@SysUISingleton
class GridLayoutTypeInteractor @Inject constructor(repo: GridLayoutTypeRepository) {
    val layout: Flow<GridLayoutType> = repo.layout
}
+1 −1
Original line number Diff line number Diff line
@@ -24,6 +24,6 @@ import kotlinx.coroutines.flow.Flow

/** Interactor for retrieving the list of [TileSpec] to be displayed as icons. */
@SysUISingleton
class IconTilesInteractor @Inject constructor(private val repo: IconTilesRepository) {
class IconTilesInteractor @Inject constructor(repo: IconTilesRepository) {
    val iconTilesSpecs: Flow<Set<TileSpec>> = repo.iconTilesSpecs
}
Loading