This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val config = LandscapistConfig( | |
| // Memory cache: LRU with 64MB default | |
| memoryCacheSize = 64 * 1024 * 1024L, | |
| // Disk cache: 100MB default, auto-configured on Android | |
| diskCacheSize = 100 * 1024 * 1024L, | |
| // Enable weak references for recently evicted entries | |
| weakReferencesEnabled = true | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.skydoves.landscapist.core.ImageRequest | |
| import com.skydoves.landscapist.core.model.ImageResult | |
| suspend fun loadImage(url: String) { | |
| val request = ImageRequest.builder() | |
| .model(url) | |
| .size(width = 800, height = 600) | |
| .build() | |
| landscapist.load(request).collect { result -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.skydoves.landscapist.core.Landscapist | |
| import com.skydoves.landscapist.core.LandscapistConfig | |
| // Get the singleton instance (works on all platforms including Android) | |
| val landscapist = Landscapist.getInstance() | |
| // Or create a custom instance without context | |
| val landscapist = Landscapist.builder() | |
| .config( | |
| LandscapistConfig( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.skydoves.landscapist.core.Landscapist | |
| import com.skydoves.landscapist.core.LandscapistConfig | |
| // Create with default configuration | |
| val landscapist = Landscapist.builder(context).build() | |
| // Or with custom configuration | |
| val landscapist = Landscapist.builder(context) | |
| .config( | |
| LandscapistConfig( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| main_recyclerView.adapter = adapter | |
| main_recyclerView.layoutManager = LinearLayoutManager(this) | |
| paginator = RecyclerViewPaginator( | |
| recyclerView = main_recyclerView, | |
| isLoading = { viewModel.isLoading }, | |
| loadMore = { loadMore(it) }, | |
| onLast = { viewModel.isOnLast } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class RecyclerViewPaginator(val recyclerView: RecyclerView, | |
| val isLoading: () -> Boolean, | |
| val loadMore: (Int) -> Unit, | |
| val onLast: () -> Boolean = { true }): RecyclerView.OnScrollListener() { | |
| private val threshold = 10 | |
| private var currentPage: Int = 0 | |
| init { | |
| recyclerView.addOnScrollListener(this) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class HistoryViewHolder(view: View, val delegate: Delegate) : BaseViewHolder(view) { | |
| interface Delegate { | |
| fun onItemClicked(history: History) | |
| fun onDeleteHistory(history: History) | |
| } | |
| private lateinit var history: History | |
| private val binding by lazy { DataBindingUtil.bind<ItemHistoryBinding>(view) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools"> | |
| <data> | |
| <variable name="history" type="com.skydoves.githubfollows.models.History"/> | |
| </data> | |
| <LinearLayout | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" |