This file contains 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
windowInfoRepository | |
.windowLayoutInfoObservable() | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe{ windowLayoutInfo -> | |
windowLayoutInfo.displayFeatures.filterIsInstance(FoldingFeature::class.java) | |
.firstOrNull ()?.let { foldingFeature -> | |
if (foldingFeature.state == FoldingFeature.State.HALF_OPENED) { | |
recyclerView.layoutManager = LinearLayoutManager( | |
context, | |
LinearLayoutManager.HORIZONTAL, |
This file contains 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 VRActivity : AppCompatActivity() { | |
private var player: SimpleExoPlayer? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.video_player_layout) | |
(player_view.videoSurfaceView as SphericalGLSurfaceView) | |
.setDefaultStereoMode(C.STEREO_MODE_TOP_BOTTOM) |
This file contains 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
task getDebugAppInDesktopFolder(dependsOn: 'assembleDebug') { | |
doLast { | |
def destination = "Put the desired path" | |
def desiredName = "Put the desired name" | |
ext.apk = file("build/outputs/apk/debug/app-debug.apk") | |
if (ext.apk.exists()) { | |
copy { | |
from ext.apk.absolutePath | |
into destination |
This file contains 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 me.jorgecastillo.polymorphicapps.polymorphic | |
import arrow.Kind | |
import arrow.core.Option | |
import arrow.core.left | |
import arrow.core.right | |
import arrow.effects.IO | |
import arrow.effects.async | |
import arrow.effects.fix | |
import arrow.effects.typeclasses.Async |
This file contains 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
interface DataSource { | |
fun allTasksByUser(user: User): Observable<List<Task>> | |
} | |
class LocalDataSource : DataSource { | |
private val localCache: Map<User, List<Task>> = | |
mapOf(User(UserId("user1")) to listOf(Task("LocalTask assigned to user1"))) | |
override fun allTasksByUser(user: User): Observable<List<Task>> = Observable.create { emitter -> | |
val cachedUser = localCache[user] |