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 com.example.roomdb; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.util.Log; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; |
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 com.example.roomdb; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.util.Log; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; |
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
private void API_Get_List() { | |
ExecutorService executor = Executors.newSingleThreadExecutor(); | |
Handler handler = new Handler(Looper.getMainLooper()); | |
executor.execute(new Runnable() { | |
@Override | |
public void run() { | |
final StringRequest request = new StringRequest(Request.Method.POST, |
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 com.example.roomdb; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Looper; | |
import android.util.Log; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; |
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
import 'dart:async'; | |
extension SplitExtension<T> on Stream<T> { | |
Stream<T> split() { | |
final controllers = <MultiStreamController<T>>[]; | |
var index = -1; | |
var done = false; | |
StreamSubscription<T> subscription; | |
return Stream.multi( |
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
import android.app.Activity | |
import androidx.annotation.MainThread | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.lifecycle.lifecycleScope | |
import arrow.core.Either | |
import arrow.core.getOrHandle | |
import arrow.core.left | |
import arrow.core.right | |
import com.google.android.gms.ads.AdError | |
import com.google.android.gms.ads.AdRequest |
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
public class ChannelsEventBus { | |
private val _channels = hashMapOf<KClass<*>, Channel<Any>>() | |
private fun createChannel(key: KClass<*>) = synchronized(this) { _channels.getOrPut(key) { Channel(Channel.UNLIMITED) } } | |
public fun send(event: Any): Unit = createChannel(event::class).trySend(event).let { } | |
@Suppress("UNCHECKED_CAST") | |
public fun <T : Any> receiveAsFlow(type: KClass<T>): Flow<T> = flow { | |
createChannel(type) |
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
import androidx.annotation.MainThread | |
import com.st.android.showcase.ui.extension.debugCheckImmediateMainDispatcher | |
import java.io.Closeable | |
import javax.inject.Inject | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.channels.onFailure | |
import kotlinx.coroutines.channels.onSuccess | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.receiveAsFlow |
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
import io.reactivex.rxjava3.annotations.CheckReturnValue | |
import io.reactivex.rxjava3.core.BackpressureStrategy | |
import io.reactivex.rxjava3.core.Observable | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.flow.* | |
import java.util.concurrent.TimeUnit | |
import java.util.concurrent.atomic.AtomicBoolean | |
@CheckReturnValue | |
inline fun <T : Any, R : Any> Observable<T>.exhaustMap(crossinline transform: (T) -> Observable<R>): Observable<R> { |
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
suspend fun upload(uri: Uri) { | |
val contentResolver = applicationContext.contentResolver | |
val bytes = contentResolver | |
.openInputStream(uri) | |
?.use { inputStream -> inputStream.buffered().use { it.readBytes() } } | |
checkNotNull(bytes) | |
val type = contentResolver.getType(uri) | |
checkNotNull(type) |
NewerOlder