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
@file:Suppress("NOTHING_TO_INLINE") | |
import android.animation.ArgbEvaluator | |
import android.animation.TimeInterpolator | |
import android.animation.TypeEvaluator | |
import android.animation.ValueAnimator | |
import android.view.animation.LinearInterpolator | |
import kotlinx.coroutines.channels.awaitClose | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.callbackFlow |
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 com.example.bubble.ui.components | |
import androidx.compose.animation.core.MutableTransitionState | |
import androidx.compose.material3.MaterialTheme | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.getValue | |
import androidx.compose.runtime.mutableStateOf | |
import androidx.compose.runtime.remember | |
import androidx.compose.runtime.setValue | |
import androidx.compose.ui.graphics.Color |
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
enum class TickOrientation { | |
TOP, START, END, BOTTOM | |
} | |
class TooltipShape( | |
private val cornerRadiusDp: Dp, | |
private val tickHeight: Dp, | |
private val tickOrientation: TickOrientation | |
) : Shape { |
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
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") | |
// Tooltip implementation for AndroidX Jetpack Compose | |
// See usage example in the next file | |
// Tested with Compose version **1.1.0-alpha06** | |
// Based on material DropdownMenu implementation. | |
import androidx.compose.animation.core.MutableTransitionState | |
import androidx.compose.animation.core.animateFloat |
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.content.Context | |
import android.net.ConnectivityManager | |
import android.net.Network | |
import android.net.NetworkCapabilities | |
import android.net.NetworkRequest | |
import android.os.Bundle | |
import android.widget.TextView | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.ViewModelProvider |
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
// This script is used to initialize the build in a module or plugin project. | |
// During this phase, the script applies the Maven plugin and configures the | |
// destination of the local repository. | |
// The local repository will contain the AAR and POM files. | |
void configureProject(Project project, String mavenUrl, String mavenUser, String mavenPwd, String version) { | |
if (!project.hasProperty("android")) { | |
throw new GradleException("Android property not found.") | |
} | |
if (!project.android.hasProperty("libraryVariants")) { |
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 androidx.compose.foundation.BorderStroke | |
/* | |
* Copyright 2020 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
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.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.fragment.app.DialogFragment | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.DefaultLifecycleObserver | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.viewbinding.ViewBinding |
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
val FusedLocationProviderClient.locationFlow() = callbackFlow<Location> { | |
... | |
}.shareIn( | |
// Make the flow follow the applicationScope | |
applicationScope, | |
// Emit the last emitted element to new collectors | |
replay = 1, | |
// Keep the producer active while there are active subscribers | |
started = SharingStarted.WhileSubscribed() | |
) |
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
fun <T> LifecycleOwner.onDestroyNullable(): ReadWriteProperty<LifecycleOwner, T> = | |
object : ReadWriteProperty<LifecycleOwner, T>, DefaultLifecycleObserver { | |
private var value: T? = null | |
init { | |
this@onDestroyNullable | |
.lifecycle | |
.addObserver(this) | |
} |
NewerOlder