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
fun createViewModelFactory(viewModel: ViewModel): ViewModelProvider.Factory { | |
return object : ViewModelProvider.Factory { | |
@Suppress("UNCHECKED_CAST") | |
override fun <T : ViewModel?> create(modelClass: Class<T>): T = viewModel as T | |
} | |
} |
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 kotlinx.coroutines.launch | |
import kotlinx.coroutines.runBlocking | |
object Main { | |
@JvmStatic | |
fun main(args: Array<String>) { | |
runBlocking { | |
val job = launch { | |
println("Coroutine start") | |
launch { |
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
tasks.register<DependencyReportTask>("allDependencies") { | |
evaluationDependsOnChildren() | |
this.setRenderer(org.gradle.api.tasks.diagnostics.internal.dependencies.AsciiDependencyReportRenderer()) | |
} |
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.Context | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import androidx.recyclerview.widget.RecyclerView | |
import kotlin.math.abs | |
class ZoomRecyclerLayout: LinearLayoutManager { | |
private val mShrinkAmount = 0.15f | |
private val mShrinkDistance = 0.9f |
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
#!/bin/sh | |
rm ~/Library/Preferences/GoLand2019*/eval/*evaluation.key | |
# The one below not required right not but keep in mind | |
# rm ~/Library/Preferences/GoLand2019*/options/options.xml |
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 com.github.shyiko.ktlint.core.Rule | |
import org.jetbrains.kotlin.com.intellij.lang.ASTNode | |
import org.jetbrains.kotlin.lexer.KtTokens.EXCLEXCL | |
class NoNotNullAssertionOperator : Rule("no-notnull-assertion") { | |
override fun visit( | |
node: ASTNode, | |
autoCorrect: Boolean, | |
emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit |
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
/* | |
** res/drawable/transition_background.xml ** | |
<transition xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:drawable="@drawable/shape_selection_label_background_gray" /> | |
<item android:drawable="@drawable/shape_selection_label_background_blue" /> | |
</transition> | |
** layout file ** |
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
/* res/anim/shake.xml | |
<?xml version="1.0" encoding="utf-8"?> | |
<set xmlns:android="http://schemas.android.com/apk/res/android"> | |
<translate | |
android:duration="50" | |
android:fromXDelta="-0.3%" | |
android:repeatCount="5" | |
android:repeatMode="reverse" | |
android:toXDelta="0.3%"/> | |
</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
package com.erdem.test; | |
import android.app.Activity; | |
import android.app.AlarmManager; | |
import android.app.PendingIntent; | |
import android.app.job.JobInfo; | |
import android.app.job.JobScheduler; | |
import android.content.ComponentName; | |
import android.content.Context; | |
import android.content.Intent; |
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.view.View | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleObserver | |
import androidx.lifecycle.OnLifecycleEvent | |
import java.lang.ref.WeakReference | |
import kotlin.properties.ReadOnlyProperty | |
import kotlin.reflect.KProperty | |
public fun <V : View> Fragment.bindView(id: Int): ReadOnlyProperty<Fragment, V> = ViewFinderProperty(id) |
NewerOlder