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, |
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 |
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 |
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) |
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.annotation.NonNull; | |
import androidx.recyclerview.widget.RecyclerView; | |
import androidx.viewpager2.widget.ViewPager2; | |
public class RecyclerViewUtils { |
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
/** | |
* The Computer Language Benchmarks Game | |
* https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ | |
* | |
* based on Jarkko Miettinen's Java program | |
* contributed by Christophe Beyls | |
*/ | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.runBlocking |
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.sample | |
import android.os.Parcel | |
import kotlinx.parcelize.Parceler | |
import java.math.BigDecimal | |
import java.math.BigInteger | |
import java.util.Date | |
inline fun <T> Parcel.readNullable(reader: () -> T) = | |
if (readInt() != 0) reader() else null |
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
sealed class Animal { | |
// Cats are simple. A cat is a cat. | |
object Cat : Animal() | |
sealed class Dog : Animal() { | |
abstract val breed: String? | |
class DogWithBreed(override val breed: String) : Dog() |
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.common.livedata; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.os.SystemClock; | |
import androidx.annotation.NonNull; | |
import androidx.lifecycle.LiveData; | |
import java.util.concurrent.TimeUnit; |
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.arch.lifecycle; | |
import android.arch.lifecycle.LiveData; | |
import android.arch.lifecycle.MutableLiveData; | |
import android.os.AsyncTask; | |
import android.support.annotation.MainThread; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.VisibleForTesting; | |
import android.support.annotation.WorkerThread; |