Replace TextDrawable with an implementation that supports tint

This commit is contained in:
MM20
2021-12-04 13:51:38 +01:00
parent 0e1ca1c1f9
commit fa22eb4d71
12 changed files with 217 additions and 161 deletions
@@ -3,6 +3,7 @@ package de.mm20.launcher2.search.data
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.Typeface
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.util.Log
@@ -10,11 +11,12 @@ import android.webkit.URLUtil
import androidx.core.graphics.drawable.toBitmap
import androidx.core.graphics.toColorInt
import androidx.palette.graphics.Palette
import com.amulyakhare.textdrawable.TextDrawable
import com.bumptech.glide.Glide
import de.mm20.launcher2.graphics.TextDrawable
import de.mm20.launcher2.helper.NetworkUtils
import de.mm20.launcher2.icons.LauncherIcon
import de.mm20.launcher2.ktx.jsonObjectOf
import de.mm20.launcher2.ktx.sp
import de.mm20.launcher2.preferences.LauncherPreferences
import de.mm20.launcher2.preferences.WebsiteProtocols
import de.mm20.launcher2.websites.R
@@ -67,7 +69,7 @@ class Website(
override fun getPlaceholderIcon(context: Context): LauncherIcon {
val drawable = if (label.isNotEmpty()) {
TextDrawable.builder().buildRect(label[0].toString(), 0)
TextDrawable(label[0].toString(), typeface = Typeface.DEFAULT_BOLD, fontSize = 40 * context.sp)
} else context.getDrawable(R.drawable.ic_website)!!
return LauncherIcon(
foreground = drawable,