Skip to content

Instantly share code, notes, and snippets.

View legobyte's full-sized avatar

Legobytes legobyte

  • Legobyte
  • Istanbul
View GitHub Profile
@legobyte
legobyte / build.gradle
Last active September 20, 2020 03:57
build.gradle useful solutions
// change java source
android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
@legobyte
legobyte / AndroidSnippets.kt
Last active October 8, 2020 09:10
Android code snippets in Kotlin
// Make EditText clickable not editable
fun makeEditTextClickable(et:EditText){
et.isFocusableInTouchMode = false
et.isLongClickable = false
}
// extract activity from a given context
fun requireActivity(context: Context): Activity {
if (context is Activity) {
return context