Skip to content

Commit

Permalink
feat(koin): update method to get viewmodel in koin
Browse files Browse the repository at this point in the history
  • Loading branch information
ujizin committed Jan 4, 2025
1 parent 66e473a commit 3bddf88
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ import com.ujizin.sample.feature.camera.mapper.toFlash
import com.ujizin.sample.feature.camera.mapper.toFlashMode
import com.ujizin.sample.feature.camera.model.CameraOption
import com.ujizin.sample.feature.camera.model.Flash
import org.koin.androidx.compose.get
import org.koin.androidx.compose.koinViewModel
import java.io.File

@Composable
fun CameraScreen(
viewModel: CameraViewModel = get(),
viewModel: CameraViewModel = koinViewModel(),
onGalleryClick: () -> Unit,
onConfigurationClick: () -> Unit,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package com.ujizin.sample.feature.configuration

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Switch
import androidx.compose.material.SwitchDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -14,11 +21,11 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ujizin.sample.R
import com.ujizin.sample.components.Section
import com.ujizin.sample.domain.User
import org.koin.androidx.compose.get
import org.koin.androidx.compose.koinViewModel

@Composable
fun ConfigurationScreen(
viewModel: ConfigurationViewModel = get(),
viewModel: ConfigurationViewModel = koinViewModel(),
onBackPressed: () -> Unit,
) {
Section(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import androidx.compose.animation.fadeOut
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
Expand All @@ -16,8 +22,13 @@ import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.PlayArrow
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -29,22 +40,22 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ujizin.sample.R
import com.ujizin.sample.components.Section
import com.ujizin.sample.extensions.getDuration
import com.ujizin.sample.extensions.minutes
import com.ujizin.sample.extensions.seconds
import coil.compose.AsyncImage
import coil.compose.AsyncImagePainter
import coil.decode.VideoFrameDecoder
import coil.request.ImageRequest
import coil.request.videoFramePercent
import org.koin.androidx.compose.get
import com.ujizin.sample.R
import com.ujizin.sample.components.Section
import com.ujizin.sample.extensions.getDuration
import com.ujizin.sample.extensions.minutes
import com.ujizin.sample.extensions.seconds
import org.koin.androidx.compose.koinViewModel
import java.io.File

@Composable
fun GalleryScreen(
viewModel: GalleryViewModel = get(),
viewModel: GalleryViewModel = koinViewModel(),
onBackPressed: () -> Unit,
onPreviewClick: (String) -> Unit,
) {
Expand Down

0 comments on commit 3bddf88

Please sign in to comment.