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(ExperimentalPagerApi::class) | |
| @Composable | |
| fun Calendar( | |
| startDate: LocalDate, | |
| months: List<YearMonth>, | |
| selectedDates: Set<LocalDate>, | |
| focusedDate: LocalDate?, | |
| isNewDateSelectionEnabled: Boolean, | |
| onDateClick: (LocalDate) -> Unit, | |
| horizontalPadding: Dp, |
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
| // Requires Compose 1.1.0-alpha02+ | |
| // Best used with navigation animation transitions in Accompanist 0.17.0+ | |
| import androidx.compose.animation.* | |
| import androidx.compose.animation.core.FastOutLinearInEasing | |
| import androidx.compose.animation.core.LinearEasing | |
| import androidx.compose.animation.core.LinearOutSlowInEasing | |
| import androidx.compose.animation.core.tween | |
| import androidx.compose.ui.unit.Density | |
| import androidx.compose.ui.unit.dp |
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
| /* ΨΨ°Ω ΩΩΪ―ΩΫ ΨͺΩΨ¦ΫΨͺΨ± */ | |
| [aria-label="Twitter"], | |
| [aria-label="ΨͺΩΫΫΨͺΨ±"] { | |
| display: none; | |
| } | |
| /* Ψ³ΨͺΩΩ Ψ³Ω Ψͺ ΪΩΎ */ | |
| /* Explore Ω ΨBookmarks ΨLists ΪΫΨ²ΩΨ§ΫΫ Ϊ©Ω Ψ§Ψ³ΨͺΩΨ§Ψ―ΩΩ Ϊ©Ω ΨͺΨ±Ϋ Ψ―Ψ§Ψ±ΩΨ Ψ΄Ψ§Ω Ω */ |
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 ScaleItemOnTouchListener : RecyclerView.OnItemTouchListener { | |
| private var previousX = 0f | |
| private var previousY = 0f | |
| private var previousMotionX = 0f | |
| private var previousMotionY = 0f | |
| private object Constants { | |
| const val SCALE_DEFAULT = 1f |
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 androidx.recyclerview.widget.GridLayoutManager | |
| import androidx.recyclerview.widget.LinearLayoutManager | |
| import androidx.recyclerview.widget.RecyclerView | |
| import androidx.recyclerview.widget.StaggeredGridLayoutManager | |
| fun RecyclerView.attachInfiniteScroll(onLoadMoreListener: OnLoadMoreListener) { | |
| if (layoutManager != null) | |
| setInfiniteScrollGrid(this, layoutManager!!, onLoadMoreListener) | |
| else throw RuntimeException("Layout Manager is Not Set") | |
| } |
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
| %kotlinc% -script DeleteBuildFolders.kts -- -dir . | |
| :: "." is default path you can change it to any folder you want to work on that folder ^ | |
| :: (script workes on current folder without "-dir" argument)" | |
| :: "^" can be used for multiline commands |
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 androidx.lifecycle.ViewModel | |
| import androidx.lifecycle.ViewModelProvider | |
| import kotlin.reflect.full.primaryConstructor | |
| class AndroidViewModelFactory(private vararg val args: Any) : | |
| ViewModelProvider.NewInstanceFactory() { | |
| override fun <T : ViewModel> create(modelClass: Class<T>) = | |
| modelClass.kotlin.primaryConstructor?.call(*args) | |
| ?: throw IllegalArgumentException("$modelClass primaryConstructor is null") |
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 androidx.animation.PhysicsBuilder | |
| import androidx.animation.Spring.DampingRatioHighBouncy | |
| import androidx.animation.Spring.StiffnessLow | |
| import androidx.compose.Composable | |
| import androidx.compose.Model | |
| import androidx.compose.remember | |
| import androidx.ui.animation.animate | |
| import androidx.ui.core.DrawClipToBounds | |
| import androidx.ui.core.Text | |
| import androidx.ui.core.drawLayer |
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.content.SharedPreferences | |
| import kotlin.properties.ReadWriteProperty | |
| import kotlin.reflect.KProperty | |
| abstract class BasePreferencesDataSource { | |
| protected abstract val preferences : SharedPreferences | |
| protected class StringPrefProperty(private val key: String) : ReadWriteProperty<BasePreferencesDataSource, String> { |
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
| /* Coming up ~ April 2020 */ | |
| package test | |
| import arrow.* | |
| inline class TwitterHandle(val handle: String) { | |
| companion object : Refined<String> { | |
| override val validate: String.() -> Map<String, Boolean> = { | |
| mapOf( | |
| "Should start with '@'" to startsWith("@"), |