Variables
val requesterList: ArrayList<FocusRequester> = arrayListOf()
val textList: ArrayList<MutableState<TextFieldValue>> = arrayListOf()
var lastIndex = -1
for (i in 0 until count){
// Add string mutableStateOf variables to the input count| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Modifier | |
| import androidx.lifecycle.ViewModel | |
| import androidx.lifecycle.viewModelScope | |
| import kotlinx.coroutines.flow.MutableStateFlow | |
| import kotlinx.coroutines.flow.SharingStarted | |
| import kotlinx.coroutines.flow.asStateFlow | |
| import kotlinx.coroutines.flow.combine | |
| import kotlinx.coroutines.flow.distinctUntilChangedBy | |
| import kotlinx.coroutines.flow.launchIn |
| import androidx.compose.foundation.layout.PaddingValues | |
| import androidx.compose.runtime.* | |
| import androidx.compose.ui.Modifier | |
| import androidx.compose.ui.layout.SubcomposeLayout | |
| import androidx.compose.ui.layout.SubcomposeLayoutState | |
| import androidx.compose.ui.layout.SubcomposeSlotReusePolicy | |
| import androidx.compose.ui.unit.* | |
| import java.time.LocalDate | |
| /** |
| // Short way to collect StateFlow on coroutine when Activity Started. | |
| // Useful when you need to collect one StateFlow, but could be used for many. | |
| fun <T> StateFlow<T>.collectIt(lifecycleOwner: LifecycleOwner, function: (T) -> Unit) { | |
| lifecycleOwner.lifecycleScope.launch { | |
| lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { | |
| collect { | |
| function.invoke(it) | |
| } | |
| } | |
| } |
| package com.thomaskuenneth.sandbox | |
| import android.graphics.Bitmap | |
| import android.graphics.Canvas | |
| import android.os.Bundle | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.compose.setContent | |
| import androidx.compose.foundation.Image | |
| import androidx.compose.foundation.layout.* | |
| import androidx.compose.material.MaterialTheme |
| import android.content.Context | |
| import android.net.ConnectivityManager | |
| import android.net.Network | |
| import android.net.NetworkCapabilities | |
| import android.net.NetworkRequest | |
| import android.os.Bundle | |
| import android.widget.TextView | |
| import androidx.appcompat.app.AppCompatActivity | |
| import androidx.lifecycle.ViewModel | |
| import androidx.lifecycle.ViewModelProvider |
| /* | |
| * Copyright (C) 2017 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 |
| /* | |
| * Copyright (C) 2017 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 |
| import os | |
| import sys | |
| import traceback | |
| from functools import wraps | |
| from multiprocessing import Process, Queue | |
| def processify(func): | |
| '''Decorator to run a function as a process. | |
| Be sure that every argument and the return value |