Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Yuichi Araki yaraki

🏠
Working from home
  • Google, Inc.
  • Tokyo
View GitHub Profile
@yaraki
yaraki / Gap.kt
Created Mar 5, 2021
Common interface for Spacers in Column and Row
View Gap.kt
package com.example.android.codelab.animationdemo.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.material.Text
View MainActivity.kt
package com.example.android.codelab.animationdemo
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
View DataBindingDelegates.kt
package io.github.yaraki.miscex
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
View CoroutineTest.kt
package com.example.playground
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.produce
import kotlinx.coroutines.channels.toList
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.single
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.yield
View FlowTest.kt
package com.example.android.flow
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.channelFlow
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
@yaraki
yaraki / FirestoreLiveData.kt
Created May 20, 2019
Firebase Query as LiveData
View FirestoreLiveData.kt
/**
* Copyright 2019 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
package com.example.firestore
import android.util.Log
import androidx.lifecycle.LiveData
import com.google.firebase.firestore.*
View PhotoActivity.kt
/*
* Copyright 2018 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
package io.github.yaraki.playground
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Bundle
@yaraki
yaraki / MainViewModel.kt
Created Sep 28, 2018
FPS as LiveData (with coroutine)
View MainViewModel.kt
/*
* Copyright (C) 2018 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@yaraki
yaraki / LiveDataWithTimeout.kt
Last active Sep 15, 2020
LiveData with timeout
View LiveDataWithTimeout.kt
/*
* Copyright (C) 2018 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@yaraki
yaraki / MainViewModel.kt
Created Sep 21, 2018
SharedPreferences as LiveData
View MainViewModel.kt
package io.github.yaraki.playground
import android.app.Application
import android.arch.lifecycle.AndroidViewModel
import android.content.Context
class MainViewModel(application: Application) : AndroidViewModel(application) {
companion object {
const val PREF = "main"