All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.skydoves.landscapist.placeholder.thumbnail.ThumbnailPlugin.kt Maven / Gradle / Ivy

Go to download

A pluggable, highly optimized Jetpack Compose image loading library that fetches and displays network images with Glide, Coil, and Fresco.

There is a newer version: 2.4.4
Show newest version
/*
 * Designed and developed by 2020-2023 skydoves (Jaewoong Eum)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.skydoves.landscapist.placeholder.thumbnail

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.IntSize
import com.skydoves.landscapist.ImageLoadState
import com.skydoves.landscapist.ImageOptions
import com.skydoves.landscapist.plugins.ImagePlugin

/**
 * A pluggable thumbnail executor that will be rendered depending on the image states is [ImageLoadState.Loading].
 */
public class ThumbnailPlugin(
  private val requestSize: IntSize = IntSize(15, 15),
) : ImagePlugin.LoadingStatePlugin {

  @Composable
  override fun compose(
    modifier: Modifier,
    imageOptions: ImageOptions,
    executor: @Composable (IntSize) -> Unit,
  ): ImagePlugin = apply {
    executor.invoke(requestSize)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy