@@ -22,11 +22,19 @@ import android.content.Context
2222import android.graphics.Path
2323import android.graphics.Region
2424import android.graphics.drawable.AdaptiveIconDrawable
25+ import com.android.launcher3.dagger.ApplicationContext
26+ import com.android.launcher3.dagger.LauncherAppComponent
27+ import com.android.launcher3.dagger.LauncherAppSingleton
2528import com.android.launcher3.graphics.ThemeManager
2629import com.android.launcher3.icons.GraphicsUtils
27- import com.android.launcher3.util.MainThreadInitializedObject
30+ import com.android.launcher3.util.DaggerSingletonObject
31+ import com.android.launcher3.util.SafeCloseable
32+ import jakarta.inject.Inject
2833
29- class IconShapeManager (private val context : Context ) {
34+ @LauncherAppSingleton
35+ class IconShapeManager @Inject constructor(
36+ @ApplicationContext private val context : Context ,
37+ ) : SafeCloseable {
3038 fun getSystemShape (): IconShape {
3139 val iconMask = AdaptiveIconDrawable (null , null ).iconMask
3240 val systemShape = findNearestShape(iconMask)
@@ -80,10 +88,13 @@ class IconShapeManager(private val context: Context) {
8088 }!!
8189 }
8290
83- companion object {
91+ override fun close () {
92+ TODO (" Not yet implemented" )
93+ }
8494
95+ companion object {
8596 @JvmField
86- val INSTANCE = MainThreadInitializedObject (:: IconShapeManager )
97+ val INSTANCE = DaggerSingletonObject ( LauncherAppComponent ::getIconShapeManager )
8798 }
8899
89100}
0 commit comments