Skip to content

Instantly share code, notes, and snippets.

View halilozercan's full-sized avatar
🏛️
Learning

Halil Ozercan halilozercan

🏛️
Learning
View GitHub Profile
<activity android:name="VideoActivity"
android:supportsPictureInPicture=“true"
android:autoRemoveFromRecents=“true”
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
...
override fun onUserLeaveHint() {
if (iWantToBeInPipModeNow()) {
enterPictureInPictureMode()
}
}
activity?.enterPictureInPictureMode()
<activity android:name="VideoActivity"
android:supportsPictureInPicture="true"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
...
@halilozercan
halilozercan / BuilderPattern.kt
Last active January 23, 2019 07:44
Builder pattern in Kotlin
abstract class BaseBuilder<T> {
abstract fun buildInternal(): T
}
fun <T, R: BaseBuilder<T>> R.build(block: R.() -> Unit): T {
block.invoke(this)
return this.buildInternal()
}
@halilozercan
halilozercan / jacoco.gradle
Created November 21, 2018 06:29 — forked from almozavr/jacoco.gradle
Gradle Jacoco config for Android (3.x plugin) with kotlin and custom excludes support
apply plugin: "jacoco"
jacoco {
toolVersion = deps.test.jacocoVersion
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}