Skip to content

Instantly share code, notes, and snippets.

View skydoves's full-sized avatar
💡
Practice is the only shortcut

Jaewoong Eum skydoves

💡
Practice is the only shortcut
View GitHub Profile
@skydoves
skydoves / TwoTierCacheConfiguration.kt
Created January 4, 2026 08:57
Landscapist: Two-Tier Cache Configuration
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
)
@skydoves
skydoves / LoadingImagesWithFlow.kt
Created January 4, 2026 08:57
Landscapist: Loading Images with Flow
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 ->
@skydoves
skydoves / CrossPlatformConfiguration.kt
Created January 4, 2026 08:57
Landscapist: Cross-Platform Configuration
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(
@skydoves
skydoves / AndroidConfiguration.kt
Created January 4, 2026 08:56
Landscapist: Android Configuration with Context
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(
@skydoves
skydoves / PowerMenuExample06.java
Created January 23, 2019 10:51
PowerMenuExample06
CustomPowerMenu customPowerMenu = new CustomPowerMenu.Builder<>(context, new IconMenuAdapter())
.addItem(new IconPowerMenuItem(context.getResources().getDrawable(R.drawable.ic_wechat), "WeChat"))
.addItem(new IconPowerMenuItem(context.getResources().getDrawable(R.drawable.ic_facebook), "Facebook"))
.addItem(new IconPowerMenuItem(context.getResources().getDrawable(R.drawable.ic_twitter), "Twitter"))
.addItem(new IconPowerMenuItem(context.getResources().getDrawable(R.drawable.ic_line), "Line"))
.setOnMenuItemClickListener(onIconMenuItemClickListener)
.setAnimation(MenuAnimation.SHOWUP_TOP_RIGHT)
.setMenuRadius(10f)
.setMenuShadow(10f)
.build();
@skydoves
skydoves / PowerMenuExample.java
Created January 23, 2019 10:21
PowerMenu Example
PowerMenu powerMenu = new PowerMenu.Builder(context)
.addItemList(list) // list has "Novel", "Poerty", "Art"
.addItem(new PowerMenuItem("Journals", false))
.addItem(new PowerMenuItem("Travel", false))
.setAnimation(MenuAnimation.SHOWUP_TOP_LEFT) // Animation start point (TOP | LEFT)
.setMenuRadius(10f)
.setMenuShadow(10f)
.setTextColor(context.getResources().getColor(R.color.md_grey_800))
.setSelectedTextColor(Color.WHITE)
.setMenuColor(Color.WHITE)
@skydoves
skydoves / paginator.kt
Created March 16, 2018 02:46
paginator
main_recyclerView.adapter = adapter
main_recyclerView.layoutManager = LinearLayoutManager(this)
paginator = RecyclerViewPaginator(
recyclerView = main_recyclerView,
isLoading = { viewModel.isLoading },
loadMore = { loadMore(it) },
onLast = { viewModel.isOnLast }
)
@skydoves
skydoves / RecyclerViewPaginator.kt
Created March 16, 2018 02:44
RecyclerViewPaginator
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)
@skydoves
skydoves / HistoryViewHolder.kt
Created March 16, 2018 02:34
HistoryViewHolder
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) }
@skydoves
skydoves / item_history.xml
Created March 16, 2018 02:30
item_history
<?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"