Skip to content

Instantly share code, notes, and snippets.

@crypticminds
Created February 3, 2020 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crypticminds/3bd445803222aac1111c0937ce26a888 to your computer and use it in GitHub Desktop.
Save crypticminds/3bd445803222aac1111c0937ce26a888 to your computer and use it in GitHub Desktop.
package com.arcane.coldstorageexamples.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.fragment.app.Fragment
import com.arcane.coldstorageannotation.LoadImage
import com.arcane.coldstoragecache.cache.Cache
import com.arcane.coldstorageexamples.R
class LoadImageFragment : Fragment() {
@LoadImage(
R.id.image_1,
"https://i.ytimg.com/vi/kYnx7nPw-xo/maxresdefault.jpg",
placeHolder = R.drawable.loading, enableLoadingAnimation = true
)
lateinit var imageView1: ImageView
@LoadImage(
R.id.image_2,
"https://image.shutterstock.com/image-photo/small-red-bunny-on-isolated-260nw-562790971.jpg",
placeHolder = R.drawable.loading_2, enableLoadingAnimation = true
)
lateinit var imageView2: ImageView
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.load_image_example_fragment, container)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Cache.bind(this)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment