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.composecharts.ui.widgets | |
import androidx.compose.animation.AnimatedVisibility | |
import androidx.compose.animation.core.AnimationSpec | |
import androidx.compose.animation.core.animateFloatAsState | |
import androidx.compose.animation.core.tween | |
import androidx.compose.animation.fadeIn | |
import androidx.compose.animation.fadeOut | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.* |
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
// Usage | |
// PingPongSwitch( | |
// textFirst = "Ping", | |
// textSecond = "Pong" | |
// ) | |
@Composable | |
fun PingPongSwitch( | |
state: PingPongSwitchState = rememberPingPongSwitchState(), | |
textFirst: String, |
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
interface Observer<T> { | |
fun onChange(newValue: T?) | |
} | |
class Observable<T>(initialValue: T? = null) { | |
// List ov observers watching this value for changes | |
private val observers = mutableListOf<Observer<T>>() | |
// The real value of this observer |
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
<ScrollView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layoutAnimation="@anim/layout_animation" | |
android:orientation="vertical"> | |
</ScrollView> |
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.annotation.SuppressLint | |
import android.content.ContentUris | |
import android.content.Context | |
import android.content.CursorLoader | |
import android.database.Cursor | |
import android.net.Uri | |
import android.os.Build | |
import android.os.Environment | |
import android.provider.DocumentsContract | |
import android.provider.MediaStore |
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
class CreditCardNumberFormattingTextWatcher : TextWatcher { | |
private var current = "" | |
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { | |
} | |
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { | |
} | |
override fun afterTextChanged(s: Editable) { |