View FlowExt.kt
This file contains 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
package be.digitalia.flow | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.ExperimentalCoroutinesApi | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.channels.BufferOverflow | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.FlowCollector | |
import kotlinx.coroutines.flow.MutableSharedFlow | |
import kotlinx.coroutines.flow.MutableStateFlow |
View OptimizedDesugaring.groovy
This file contains 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
afterEvaluate { | |
// Update configuration of the R8 tasks to optimize desugaring shrinker | |
def originalSetting = "\"support_all_callbacks_from_library\": true" | |
def replacementSetting = "\"support_all_callbacks_from_library\": false" | |
tasks.forEach { task -> | |
def taskSimpleName = task.getClass().getSimpleName() | |
if (taskSimpleName.startsWith("R8Task")) { | |
task.configure { | |
def patchedDesugarConfig = coreLibDesugarConfig.getProvider().map { | |
it.replace(originalSetting, replacementSetting) |
View LifecycleViewModel.kt
This file contains 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
package androidx.lifecycle | |
import be.digitalia.utils.CompositeLifecycleOwner | |
private const val VIEW_LIFECYCLE_KEY = "androidx.lifecycle.VIEW_LIFECYCLE" | |
val ViewModel.lifecycleOwner: CompositeLifecycleOwner | |
get() { | |
return getTag(VIEW_LIFECYCLE_KEY) | |
?: setTagIfAbsent(VIEW_LIFECYCLE_KEY, CompositeLifecycleOwner()) |
View CompositeLifecycleOwner.kt
This file contains 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
package be.digitalia.utils | |
import android.os.Handler | |
import android.os.Looper | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleEventObserver | |
import androidx.lifecycle.LifecycleObserver | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.LifecycleRegistry | |
import java.io.Closeable |
View ignore-jetified-proguard-rules.groovy
This file contains 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
// Add the following to your Android app module build.gradle file, after the android section: | |
// Replace "proguard.txt" with the actual name of the proguard rules file in the library aar, if different | |
afterEvaluate { | |
// Update configuration of the minify tasks to exclude specific consumer Proguard rules files | |
tasks.findAll { task -> task.name.startsWith('minify') }.each { task -> | |
task.configure { | |
configurationFiles.from.collect().each { fileCollection -> | |
if (fileCollection instanceof FileCollection) { | |
configurationFiles.from.remove fileCollection |
View StickyHeaderLinearLayoutManager.kt
This file contains 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
package be.digitalia.util.stickyheader | |
import android.content.Context | |
import android.graphics.PointF | |
import android.os.Parcel | |
import android.os.Parcelable | |
import android.view.View | |
import android.view.ViewGroup | |
import android.view.ViewTreeObserver | |
import androidx.recyclerview.widget.LinearLayoutManager |
View FlowLayout.kt
This file contains 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
package be.digitalia.compose.layout | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Layout | |
import androidx.compose.ui.Modifier | |
@Composable | |
fun FlowLayout( | |
modifier: Modifier = Modifier, |
View LayerCrossfadeTransition.kt
This file contains 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
package be.digitalia.bifff.coil | |
import android.view.View | |
import androidx.core.view.ViewCompat | |
import androidx.core.view.isVisible | |
import coil.annotation.ExperimentalCoilApi | |
import coil.decode.DataSource | |
import coil.drawable.CrossfadeDrawable | |
import coil.request.ErrorResult | |
import coil.request.RequestResult |
View TypedFragmentResults.kt
This file contains 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 android.os.Bundle | |
import androidx.core.os.bundleOf | |
import androidx.fragment.app.Fragment | |
import androidx.fragment.app.FragmentManager | |
import androidx.fragment.app.FragmentResultListener | |
import androidx.lifecycle.LifecycleOwner | |
interface FragmentResultContract<T> { | |
fun toBundle(result: T): Bundle |
View RecyclerViewExt.kt
This file contains 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
package be.digitalia.samples.utils | |
import android.view.MotionEvent | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.RecyclerView.OnItemTouchListener | |
import kotlin.math.abs | |
fun RecyclerView.enforceSingleScrollDirection() { | |
val enforcer = SingleScrollDirectionEnforcer() | |
addOnItemTouchListener(enforcer) |
NewerOlder