Skip to content

Instantly share code, notes, and snippets.

package cloud.jablotron.apps.myjablotron2.jablotron.jablotron.widgets.internal
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import app.cash.turbine.test
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.design.components.text.Text
package cloud.jablotron.apps.myjablotron2.jablotron.jablotron.widgets.internal
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.widgets.WidgetUpdater
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.widgets.data.WidgetInstance
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.widgets.injection.WidgetsScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import javax.inject.Inject
@WidgetsScope
package cloud.jablotron.apps.myjablotron2.jablotron.jablotron.dashboard.ui.screens.dashboard
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.dashboard.data.local.model.device.Device
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.dashboard.domain.devices.GetDevicesUseCase
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.dashboard.util.RateLimiter
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.design.components.layout.data.RequestState
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.design.components.snackbar.SnackbarCommand
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.design.components.snackbar.SnackbarMessageType
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.design.viewmodel.BaseViewModel
import cloud.jablotron.apps.myjablotron2.jablotron.jablotron.moduleapi.navigation.BottomNavigationVisibilityManager
@Composable
fun Navigation() {
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = "home",
) {
composable("home") {
Screen(
title = "Home",
package cloud.jablotron.apps.myjablotron2.jablotron.jablotron.design.data
import android.content.res.Resources
import androidx.annotation.PluralsRes
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
Main_iosKt.MainViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
struct ContentView: View {
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BadJokesCounter()
}
}
}
//
android {
compileSdk = 33
...
defaultConfig {
applicationId = "app.badjoke.counter"
minSdk = 28
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@Composable
fun Profile() {
val user by userFlow.subscribeAsState(null)
val balance by balanceFlow.subscribeAsState(0L)
if (user == null) {
Text("Loading…")
} else {
Text("${user.name} - $balance")