• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.launcher3
17 
18 import android.content.Context
19 import com.android.launcher3.dagger.ApplicationContext
20 import com.android.launcher3.icons.IconCache
21 import com.android.launcher3.icons.LauncherIconProvider
22 import com.android.launcher3.util.DaggerSingletonObject
23 import javax.inject.Inject
24 import javax.inject.Named
25 
26 /** A collection of common dependencies used across Launcher */
27 @Deprecated("Inject the specific targets directly instead of using LauncherAppState")
28 data class LauncherAppState
29 @Inject
30 constructor(
31     @ApplicationContext val context: Context,
32     val iconProvider: LauncherIconProvider,
33     val iconCache: IconCache,
34     val model: LauncherModel,
35     val invariantDeviceProfile: InvariantDeviceProfile,
36     @Named("SAFE_MODE") val isSafeModeEnabled: Boolean,
37 ) {
38 
39     companion object {
40 
<lambda>null41         @JvmField var INSTANCE = DaggerSingletonObject { it.launcherAppState }
42 
getInstancenull43         @JvmStatic fun getInstance(context: Context) = INSTANCE[context]
44 
45         /** Shorthand for [.getInvariantDeviceProfile] */
46         @JvmStatic fun getIDP(context: Context) = InvariantDeviceProfile.INSTANCE[context]
47     }
48 }
49