Skip to content

Commit

Permalink
Make dynamically created skeleton darker
Browse files Browse the repository at this point in the history
Similar to the statically created skeleton.

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma committed Jul 18, 2024
1 parent 84d80f7 commit 3710e9f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import android.util.Base64
import android.util.Log
import androidx.appcompat.widget.AppCompatImageView
import com.faltenreich.skeletonlayout.Skeleton
import com.faltenreich.skeletonlayout.SkeletonConfig
import com.faltenreich.skeletonlayout.SkeletonLayout
import com.faltenreich.skeletonlayout.createSkeleton
import kotlin.random.Random
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
Expand All @@ -42,6 +44,7 @@ import org.openhab.habdroid.util.ImageConversionPolicy
import org.openhab.habdroid.util.getIconFallbackColor
import org.openhab.habdroid.util.getPrefs
import org.openhab.habdroid.util.isDebugModeEnabled
import org.openhab.habdroid.util.resolveThemedColor

class WidgetImageView(context: Context, attrs: AttributeSet?) : AppCompatImageView(context, attrs) {
private var scope: CoroutineScope? = null
Expand Down Expand Up @@ -317,7 +320,9 @@ class WidgetImageView(context: Context, attrs: AttributeSet?) : AppCompatImageVi

private fun applySkeleton() {
if (skeleton == null) {
skeleton = createSkeleton()
val config = SkeletonConfig.default(context)
config.maskColor = context.resolveThemedColor(R.attr.colorOnSurfaceInverse, config.maskColor)
skeleton = createSkeleton(config)
}
skeleton?.showSkeleton()
}
Expand Down

0 comments on commit 3710e9f

Please sign in to comment.