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

Commit ec686c19 authored by Ben Reich's avatar Ben Reich
Browse files

Support Hilt DI on DocumentsUICompose

Bug: 376167559
Test: m DocumentsUICompose
Flag: EXEMPT development only change
Change-Id: I90001c46ed26c29de447869bdddf7e2c52822f4d
parent 3bdd0fbf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -37,8 +37,10 @@ android_library {
        "androidx.compose.runtime_runtime",
        "androidx.compose.ui_ui",
        "androidx.core_core-ktx",
        "androidx.hilt_hilt-navigation-compose",
        "androidx.lifecycle_lifecycle-runtime-compose",
        "androidx.lifecycle_lifecycle-runtime-ktx",
        "hilt_android",
        "modules-utils-build_system",
    ],

+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
    <uses-permission android:name="android.permission.READ_DEVICE_CONFIG"/>

    <application
        android:name=".DocumentsUIApplication"
        android:label="@string/app_label"
        android:supportsRtl="true"
        android:allowBackup="true"
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright 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.documentsui.compose

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp(Application::class)
class DocumentsUIApplication : Hilt_DocumentsUIApplication()
+6 −5
Original line number Diff line number Diff line
@@ -19,15 +19,18 @@ package com.android.documentsui.compose
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import dagger.hilt.android.AndroidEntryPoint

class MainActivity : ComponentActivity() {
@AndroidEntryPoint(ComponentActivity::class)
class MainActivity : Hilt_MainActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        enableEdgeToEdge()
        super.onCreate(savedInstanceState)

        setContent {
@@ -36,11 +39,9 @@ class MainActivity : ComponentActivity() {
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    Column {
                    Text(text = "DocumentsUI Compose")
                }
            }
        }
    }
}
}