Skip to content

Instantly share code, notes, and snippets.

View yschimke's full-sized avatar

Yuri Schimke yschimke

View GitHub Profile
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package com.google.android.horologist.scratch
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@yschimke
yschimke / ComposeA11yExtension.kt
Created August 24, 2022 16:44
ComposeA11yExtension
package com.google.android.horologist.audio.ui
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.node.RootForTest
import androidx.compose.ui.platform.ViewRootForTest
import androidx.compose.ui.semantics.SemanticsActions
import androidx.compose.ui.semantics.SemanticsNode
val navController = rememberSwipeDismissableNavController()
Scaffold(
modifier = Modifier.fillMaxSize(),
timeText = { TimeText() }
) {
SwipeDismissableNavHost(
navController = navController,
startDestination = "start",
) {
/*
* Copyright (C) 2020 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@RunWith(AndroidJUnit4::class)
class OkHttpPlayerTest {
@Test
fun handlesFastCancellations() {
assumeInternet()
val context = InstrumentationRegistry.getInstrumentation().targetContext
val okHttpClient = OkHttpClient.Builder()
.build()
package okhttp3
import java.io.IOException
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
fun main() {
val client = OkHttpClient.Builder()
.pingInterval(2500, TimeUnit.MILLISECONDS)
.connectionPool(ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
/*
* Copyright (C) 2014 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Configuration
@EnableRSocketSecurity
@EnableReactiveMethodSecurity
// https://spring.io/blog/2020/06/17/getting-started-with-rsocket-spring-security
class SecurityConfig {
@Bean
fun messageHandler(strategies: RSocketStrategies?): RSocketMessageHandler {
val mh = RSocketMessageHandler()
mh.argumentResolverConfigurer.addCustomResolver(AuthenticationPrincipalArgumentResolver())
mh.rSocketStrategies = strategies!!