This file contains hidden or 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.textfieldtypinganimation | |
import android.os.Bundle | |
import androidx.activity.ComponentActivity | |
import androidx.activity.compose.setContent | |
import androidx.activity.enableEdgeToEdge | |
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.AnimationVector1D | |
import androidx.compose.animation.core.Spring | |
import androidx.compose.animation.core.spring |
This file contains hidden or 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
@OptIn(ExperimentalLayoutApi::class) | |
@Composable | |
fun AnimateCharTextField( | |
value: String, | |
onValueChange: (String) -> Unit, | |
modifier: Modifier = Modifier, | |
textStyle: TextStyle = TextStyle(fontSize = 50.sp) | |
) { | |
val scope = rememberCoroutineScope() | |
val animatables = remember { mutableStateMapOf<Int, Animatable<Float, AnimationVector1D>>() } |
This file contains hidden or 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.graphics.BlurMaskFilter | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.requiredSize | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.remember | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.composed |
This file contains hidden or 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 PdfAdapter( | |
// this would come from the ViewModel so we don't need to recreate it on config change | |
// and the VM can close it within onCleared() | |
private val renderer: PdfRenderer, | |
// this would come from the Activity/Fragment based on the display metrics | |
private val pageWidth: Int | |
) : RecyclerView.Adapter<PdfAdapter.ViewHolder>() { | |
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { |
This file contains hidden or 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
// IMPORTANT! READ THIS FIRST | |
// Assisted Injection doesn't work with @HiltViewModel or @ViewModelInject | |
// Read more about the issue here: https://github.com/google/dagger/issues/2287 | |
// | |
// | |
// AssistedInject and Hilt working together in v2.28-alpha times | |
// Example of a ViewModel using AssistedInject injected in a Fragment by Hilt | |
// As AssistedInject isn't part of Dagger yet, we cannot use in | |
// conjuction with @ViewModelInject |
This file contains hidden or 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.filipkowicz.headeritemdecorator | |
/* | |
solution based on - based on Sevastyan answer on StackOverflow | |
changes: | |
- take to account views offsets | |
- transformed to Kotlin | |
- now works on viewHolders |
This file contains hidden or 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
@BindingAdapter(value = {"bind:datePick", "bind:maxDate", "bind:minDate"}, requireAll = false) | |
public static void bindTextViewDateClicks(final TextView textView, final ObservableField<Date> date, final ObservableField<Date> maxDate, final ObservableField<Date> minDate) { | |
textView.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
selectDate(textView.getContext(), date, maxDate, minDate); | |
} | |
}); | |
} | |