@@ -39,9 +39,11 @@ import androidx.core.view.isVisible
39
39
import com.google.android.material.imageview.ShapeableImageView
40
40
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
41
41
import rasel.lunar.launcher.R
42
+ import rasel.lunar.launcher.apps.IconPackManager.Companion.getDrawableIconForPackage
42
43
import rasel.lunar.launcher.helpers.Constants.Companion.ACCESSIBILITY_SERVICE_LOCK_SCREEN
43
44
import rasel.lunar.launcher.helpers.Constants.Companion.AUTHENTICATOR_TYPE
44
45
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_ICON_SIZE
46
+ import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPS_LAYOUT
45
47
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APP_NO_
46
48
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_ICON_SIZE
47
49
import rasel.lunar.launcher.helpers.Constants.Companion.MAX_FAVORITE_APPS
@@ -192,6 +194,7 @@ internal class UniUtils {
192
194
/* favorite apps */
193
195
private fun populateFavApps (context : Context , linearLayoutCompat : LinearLayoutCompat ) {
194
196
val prefsFavApps = context.getSharedPreferences(PREFS_FAVORITE_APPS , 0 )
197
+ val useIconPack = context.getSharedPreferences(PREFS_SETTINGS , 0 ).getInt(KEY_APPS_LAYOUT , 0 ) != 0
195
198
if (linearLayoutCompat.isVisible || prefsFavApps.all.toString().length < 3 ) {
196
199
linearLayoutCompat.visibility = View .GONE
197
200
} else {
@@ -208,12 +211,18 @@ internal class UniUtils {
208
211
layoutParams = LinearLayoutCompat .LayoutParams (
209
212
(iconSize * resources.displayMetrics.density).toInt(),
210
213
(iconSize * resources.displayMetrics.density).toInt(), 1F )
211
- }.let {
212
- it.setImageDrawable(context.packageManager.getApplicationIcon(packageName))
213
- it.setOnClickListener {
214
+ }.let { sImageView ->
215
+ context.packageManager.getApplicationIcon(packageName).let { defaultIcon ->
216
+ sImageView.setImageDrawable(
217
+ if (context.getSharedPreferences(PREFS_SETTINGS , 0 ).getInt(KEY_APPS_LAYOUT , 0 ) != 0 )
218
+ getDrawableIconForPackage(packageName, defaultIcon)
219
+ else defaultIcon
220
+ )
221
+ }
222
+ sImageView.setOnClickListener {
214
223
context.startActivity(context.packageManager.getLaunchIntentForPackage(packageName))
215
224
}
216
- linearLayoutCompat.addView(it )
225
+ linearLayoutCompat.addView(sImageView )
217
226
}
218
227
} catch (nameNotFoundException: PackageManager .NameNotFoundException ) {
219
228
context.getSharedPreferences(PREFS_FAVORITE_APPS , 0 )
0 commit comments