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
inline fun Modifier.conditional( | |
condition: Boolean, | |
ifTrue: Modifier.() -> Modifier, | |
ifFalse: Modifier.() -> Modifier = { this }, | |
): Modifier = if (condition) { | |
then(ifTrue(this)) | |
} else { | |
then(ifFalse(this)) | |
} |
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 UploadFilesUseCase( | |
private val schedulerProvider: SchedulerProvider, | |
private val httpManager: HttpManager | |
) { | |
private var operation: Completable? = null | |
fun uploadFiles(): Completable = synchronized(this) { | |
operation | |
?: (doUploadFiles() |
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
public class ViewModelInjectionFactory<VM extends ViewModel> implements ViewModelProvider.Factory { | |
private Lazy<VM> viewModel; | |
@Inject | |
public ViewModelInjectionFactory(Lazy<VM> viewModel) { | |
this.viewModel = viewModel; | |
} | |
@Override |
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
// ViewModel factory | |
@MainThread | |
inline fun <reified VM : ViewModel> ComponentActivity.viewModel( | |
noinline provider: (SavedStateHandle) -> VM | |
) = createLazyViewModel( | |
viewModelClass = VM::class, | |
savedStateRegistryOwnerProducer = { this }, | |
viewModelStoreOwnerProducer = { this }, | |
viewModelProvider = provider |
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
@MainThread | |
inline fun <reified VM : ViewModel> ComponentActivity.viewModel( | |
noinline provider: (SavedStateHandle) -> VM | |
) = createLazyViewModel( | |
viewModelClass = VM::class, | |
savedStateRegistryOwnerProducer = { this }, | |
viewModelStoreOwnerProducer = { this }, | |
viewModelProvider = provider | |
) |
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
abstract class BaseFragment<VB : ViewBinding>( | |
private val bindingFactory: (LayoutInflater, ViewGroup?, Boolean) -> VB | |
) : Fragment() { | |
private var _binding: VB? = null | |
val binding: VB | |
get() = _binding!! | |
override fun onCreateView( | |
inflater: LayoutInflater, |
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
public class ResourceProvider { | |
private final Context context; | |
@Inject | |
public ResourceProvider(Context context) { | |
this.context = context; | |
} | |
@NonNull |
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
@Module | |
abstract class FragmentBindingModule { | |
@Binds | |
abstract fun bindFragmentFactory(factory: FragmentInjectionFactory): FragmentFactory | |
@Binds | |
@IntoMap | |
@FragmentKey(MainFragment::class) | |
abstract fun bindMainFragment(fragment: MainFragment): Fragment |
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
const puppeteerLottie = require("puppeteer-lottie"); | |
const fs = require("fs"); | |
const baseInputDir = "lotties/"; | |
const baseOutputDir = "lotties-rendered/"; | |
const outputExtension = '.mp4'; | |
(async () => { | |
await run(); |
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.app.Activity | |
import android.content.Context | |
import android.content.res.ColorStateList | |
import android.content.res.Resources | |
import android.graphics.Typeface | |
import android.graphics.drawable.Drawable | |
import android.view.View | |
import android.view.animation.Animation | |
import android.view.animation.AnimationUtils |
NewerOlder