Skip to content

Commit

Permalink
Refactor: Made dots only work with left align apps on home screen.
Browse files Browse the repository at this point in the history
Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
  • Loading branch information
CreativeCodeCat committed Aug 26, 2024
1 parent 2c83c4a commit e9fa768
Showing 1 changed file with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,26 @@ class HomeViewHolder @Inject constructor(
val appIcon = pm.getApplicationIcon(appInfo.packageName)

if (preferenceHelper.showAppIconAsDots) {
val appNewIcon: Drawable = ContextCompat.getDrawable(itemView.context, R.drawable.app_dot_icon)!!

val bitmap = drawableToBitmap(appIcon)
val dominantColor = getDominantColor(bitmap)
val recoloredDrawable = recolorDrawable(appNewIcon, dominantColor)
when (preferenceHelper.homeAppAlignment) {
Gravity.START -> {
val appNewIcon
: Drawable = ContextCompat.getDrawable(itemView.context, R.drawable.app_dot_icon)!!

val bitmap = drawableToBitmap(appIcon)
val dominantColor = getDominantColor(bitmap)
val recoloredDrawable = recolorDrawable(appNewIcon, dominantColor)

val appIconSize = (preferenceHelper.appTextSize * 1.1f).toInt()
appHomeDotsIcon.setImageDrawable(recoloredDrawable)
appHomeDotsIcon.layoutParams.width = appIconSize
appHomeDotsIcon.layoutParams.height = appIconSize
appHomeDotsIcon.visibility = View.VISIBLE
}

val appIconSize = (preferenceHelper.appTextSize * 1.1f).toInt()
appHomeDotsIcon.setImageDrawable(recoloredDrawable)
appHomeDotsIcon.layoutParams.width = appIconSize
appHomeDotsIcon.layoutParams.height = appIconSize
appHomeDotsIcon.visibility = View.VISIBLE
else -> {
appHomeDotsIcon.visibility = View.GONE
}
}
} else {
val appIconSize = (preferenceHelper.appTextSize * 2f).toInt()
when (preferenceHelper.homeAppAlignment) {
Expand Down

0 comments on commit e9fa768

Please sign in to comment.