Skip to content

Instantly share code, notes, and snippets.

View lucamtudor's full-sized avatar

Tudor Luca lucamtudor

View GitHub Profile
@outermeasure
outermeasure / rimpark_retrospective.md
Last active January 11, 2022 13:01
A list of features developed for Rimpark in 2021.

Rimpark Retrospective 2021

Dev: https://dev001.rimpark.io

Test: https://test.rimpark.io

Product UX

  • Add locker timeout. 1, 2
  • Allow the leader to start game instead of having everyone pressing ready. 1
  • Add the possibility to pay with ADA (Cardano) for Coins. 1, 2, ...
@rjrjr
rjrjr / Gatekeeper.kt
Last active August 5, 2021 21:30
Gatekeeper workflow pattern
/**
* In our production code, this typealias is more interesting,
* something like AlertContainerScreen<PanelContainerScreen<R>>
*/
typealias MetaRootRendering<R>: AlertContainerScreen<R>
data class ActivityAndRoot<R> (
val activity: Activity,
val root: R
)
@objcode
objcode / Permissions.kt
Last active February 21, 2023 23:01
Quick demo of compose permissions using activity result API. Uses Flow instead of State to make it reusable outside of Compose.
/*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@seanghay
seanghay / MaterialDialogFragment.kt
Created June 6, 2020 05:41
An alert dialog fragment that supports new material background.
/**
* Designed and developed by Seanghay Yath (@seanghay)
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@objcode
objcode / ConcurrencyHelpers.kt
Last active May 2, 2024 08:05
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@siyamed
siyamed / MyTextInputEditText.kt
Created May 3, 2019 17:44
Show Error in TextInputEditText
import android.content.Context
import android.graphics.Point
import android.graphics.Rect
import android.util.AttributeSet
import android.view.View
import android.view.ViewParent
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
class MyTextInputEditText : TextInputEditText {
@alexjlockwood
alexjlockwood / RingOfCirclesView.kt
Last active January 10, 2024 14:07
Kotlin implementation of a Ring of Circles animation, inspired by https://twitter.com/InfinityLoopGIF/status/1101584983259533312
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
private const val N = 16
private const val PERIOD1 = -10000.0
private const val PERIOD2 = -500.0
@nickbutcher
nickbutcher / LICENSE
Last active October 6, 2020 11:14
Fun with gradients and AnimatedVectorDrawables. Illustration by the wonderful https://twitter.com/VPoltrack
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created April 26, 2018 12:14
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)
package statemachine
import debug
import fail
import io.reactivex.Observable
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.runBlocking