From 2a1a252443f64366a91b25616fd9e2ff97deaecd Mon Sep 17 00:00:00 2001 From: T8RIN Date: Tue, 22 Mar 2022 17:23:35 +0300 Subject: [PATCH] changed packages and removed deprecated accompanist insets library --- app/build.gradle.kts | 2 +- .../java/ru/tech/firenote/MainActivity.kt | 562 +----------------- .../java/ru/tech/firenote/di/AppModule.kt | 3 +- .../firenote/ui/composable/app/FirenoteApp.kt | 99 +++ .../screen/creation/CreationContainer.kt | 89 +++ .../screen/creation/GoalCreationScreen.kt | 10 +- .../screen/creation/NoteCreationScreen.kt | 7 +- .../ui/composable/single/FirenoteScaffold.kt | 224 +++++++ .../ui/composable/single/MaterialDialog.kt | 9 +- .../ui/composable/single/bar/AppBarActions.kt | 2 +- .../composable/single/bar/AppBarWithInsets.kt | 2 +- .../single/bar/BottomNavigationBar.kt | 1 - .../composable/single/bar/EditableAppBar.kt | 2 +- .../ui/composable/single/lazyitem/NoteItem.kt | 2 +- .../single/lazyitem/ProfileNoteItem.kt | 2 +- .../java/ru/tech/firenote/ui/theme/Color.kt | 57 +- .../utils/{Utils.kt => GlobalUtils.kt} | 2 +- .../viewModel/GoalCreationViewModel.kt | 2 +- .../viewModel/NoteCreationViewModel.kt | 2 +- app/src/main/res/values-ru-rRU/strings.xml | 2 +- 20 files changed, 445 insertions(+), 636 deletions(-) create mode 100644 app/src/main/java/ru/tech/firenote/ui/composable/app/FirenoteApp.kt create mode 100644 app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/CreationContainer.kt create mode 100644 app/src/main/java/ru/tech/firenote/ui/composable/single/FirenoteScaffold.kt rename app/src/main/java/ru/tech/firenote/utils/{Utils.kt => GlobalUtils.kt} (98%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 507c413..0f66b8b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -91,10 +91,10 @@ dependencies { implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.0-alpha04") implementation("androidx.navigation:navigation-compose:2.5.0-alpha03") implementation("androidx.constraintlayout:constraintlayout-compose:1.0.0") + implementation("androidx.compose.foundation:foundation:1.2.0-alpha05") //Accompanist implementation("com.google.accompanist:accompanist-systemuicontroller:0.24.2-alpha") - implementation("com.google.accompanist:accompanist-insets:0.24.2-alpha") implementation("com.google.accompanist:accompanist-flowlayout:0.24.2-alpha") //Tests diff --git a/app/src/main/java/ru/tech/firenote/MainActivity.kt b/app/src/main/java/ru/tech/firenote/MainActivity.kt index a315fd6..351b0c9 100644 --- a/app/src/main/java/ru/tech/firenote/MainActivity.kt +++ b/app/src/main/java/ru/tech/firenote/MainActivity.kt @@ -1,582 +1,34 @@ package ru.tech.firenote -import android.annotation.SuppressLint -import android.content.pm.ActivityInfo import android.os.Bundle -import android.widget.Toast.LENGTH_SHORT -import android.widget.Toast.makeText import androidx.activity.ComponentActivity -import androidx.activity.compose.BackHandler import androidx.activity.compose.setContent -import androidx.activity.viewModels -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.foundation.layout.* -import androidx.compose.foundation.text.BasicTextField -import androidx.compose.foundation.text.KeyboardActions -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ExitToApp -import androidx.compose.material.icons.outlined.AddTask -import androidx.compose.material.icons.outlined.Edit -import androidx.compose.material.icons.outlined.Image -import androidx.compose.material.icons.rounded.ArrowBack -import androidx.compose.material.icons.rounded.Close -import androidx.compose.material.icons.rounded.Search -import androidx.compose.material.icons.twotone.FactCheck -import androidx.compose.material.icons.twotone.StickyNote2 -import androidx.compose.material3.* -import androidx.compose.runtime.* -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.alpha -import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalFocusManager -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import androidx.core.view.WindowCompat import androidx.navigation.compose.rememberNavController -import com.google.accompanist.insets.ProvideWindowInsets import dagger.hilt.android.AndroidEntryPoint -import ru.tech.firenote.ui.composable.navigation.Navigation -import ru.tech.firenote.ui.composable.provider.LocalSnackbarHost -import ru.tech.firenote.ui.composable.provider.LocalWindowSize -import ru.tech.firenote.ui.composable.screen.auth.AuthScreen -import ru.tech.firenote.ui.composable.screen.creation.GoalCreationScreen -import ru.tech.firenote.ui.composable.screen.creation.NoteCreationScreen -import ru.tech.firenote.ui.composable.single.MaterialDialog -import ru.tech.firenote.ui.composable.single.bar.* +import ru.tech.firenote.ui.composable.app.FirenoteApp import ru.tech.firenote.ui.composable.utils.WindowSize import ru.tech.firenote.ui.composable.utils.rememberWindowSizeClass -import ru.tech.firenote.ui.route.Screen -import ru.tech.firenote.ui.theme.FirenoteTheme -import ru.tech.firenote.viewModel.MainViewModel @AndroidEntryPoint class MainActivity : ComponentActivity() { - private val mainViewModel: MainViewModel by viewModels() - - @SuppressLint("SourceLockedOrientationActivity") - @OptIn(ExperimentalMaterial3Api::class) override fun onCreate(savedInstanceState: Bundle?) { setTheme(R.style.Theme_Firenote) super.onCreate(savedInstanceState) - WindowCompat.setDecorFitsSystemWindows(window, false) + setContent { - val isScaffoldVisible by derivedStateOf { - !mainViewModel.showNoteCreation.currentState - || !mainViewModel.showNoteCreation.targetState - || !mainViewModel.showGoalCreation.currentState - || !mainViewModel.showGoalCreation.targetState - } val navController = rememberNavController() - val context = LocalContext.current - val windowSize = rememberWindowSizeClass() val splitScreen = windowSize != WindowSize.Compact - FirenoteTheme { - MaterialDialog( - showDialog = rememberSaveable { mutableStateOf(false) }, - icon = Icons.Filled.ExitToApp, - title = R.string.exitApp, - message = R.string.exitAppMessage, - confirmText = R.string.stay, - dismissText = R.string.close, - dismissAction = { finishAffinity() } - ) - if (mainViewModel.searchMode.value) BackHandler { - mainViewModel.searchMode.value = false - mainViewModel.searchString.value = "" - } - - ProvideWindowInsets { - val snackbarHostState = remember { SnackbarHostState() } - CompositionLocalProvider( - LocalSnackbarHost provides snackbarHostState, - LocalWindowSize provides windowSize - ) { - if (mainViewModel.isAuth.value) { - AuthScreen(mainViewModel.isAuth) - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT - } - else { - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED - if (splitScreen) { - Row { - Scaffold( - topBar = { - AppBarWithInsets( - type = APP_BAR_CENTER, - navigationIcon = { - when (mainViewModel.selectedItem.value) { - 0 -> { - if (!mainViewModel.searchMode.value) { - IconButton(onClick = { - mainViewModel.searchMode - .value = true - mainViewModel.searchString.value = - "" - }) { - Icon(Icons.Rounded.Search, null) - } - } else { - IconButton(onClick = { - mainViewModel.searchMode - .value = false - mainViewModel.searchString.value = - "" - }) { - Icon( - Icons.Rounded.ArrowBack, - null - ) - } - } - } - 1 -> { - if (!mainViewModel.searchMode.value) { - IconButton(onClick = { - mainViewModel.searchMode - .value = true - mainViewModel.searchString.value = - "" - - }) { - Icon(Icons.Rounded.Search, null) - } - } else { - IconButton(onClick = { - mainViewModel.searchMode - .value = false - mainViewModel.searchString.value = - "" - }) { - Icon( - Icons.Rounded.ArrowBack, - null - ) - } - } - } - 2 -> { - IconButton(onClick = { - mainViewModel.showUsernameDialog.value = - true - }) { - Icon(Icons.Outlined.Edit, null) - } - } - } - }, - scrollBehavior = mainViewModel.scrollBehavior.value, - title = { - if (!mainViewModel.searchMode.value) { - Text( - text = if (mainViewModel.selectedItem.value == 2) mainViewModel.profileTitle.value - else stringResource(mainViewModel.title.value), - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - } else { - val localFocusManager = - LocalFocusManager.current - BasicTextField( - modifier = Modifier.fillMaxWidth(), - value = mainViewModel.searchString.value, - textStyle = TextStyle( - fontSize = 22.sp, - color = MaterialTheme.colorScheme.onBackground, - textAlign = TextAlign.Start, - ), - keyboardActions = KeyboardActions( - onDone = { localFocusManager.clearFocus() } - ), - singleLine = true, - cursorBrush = SolidColor(MaterialTheme.colorScheme.onBackground), - onValueChange = { - mainViewModel.searchString.value = - it - }) - if (mainViewModel.searchString.value.isEmpty()) { - Text( - text = stringResource(R.string.searchHere), - modifier = Modifier - .fillMaxWidth() - .padding(start = 12.dp), - style = TextStyle( - fontSize = 22.sp, - color = MaterialTheme.colorScheme.outline, - textAlign = TextAlign.Start, - ) - ) - } - } - }, - actions = { - if (!mainViewModel.searchMode.value) { - when (mainViewModel.selectedItem.value) { - 0 -> NoteActions(mainViewModel) - 1 -> GoalActions(mainViewModel) - 2 -> ProfileActions { - navController.navigate(Screen.NoteListScreen.route) { - navController.popBackStack() - launchSingleTop = true - } - makeText( - context, - R.string.seeYouAgain, - LENGTH_SHORT - ).show() - - mainViewModel.signOut() - } - } - } else { - IconButton(onClick = { - mainViewModel.searchString.value = "" - }) { - Icon(Icons.Rounded.Close, null) - } - } - } - ) - }, - floatingActionButton = { - ExtendedFloatingActionButton(onClick = { - when (mainViewModel.selectedItem.value) { - 0 -> { - mainViewModel.showNoteCreation.targetState = - true - mainViewModel.globalNote.value = null - - mainViewModel.showGoalCreation.targetState = - false - mainViewModel.globalGoal.value = null - } - 1 -> { - mainViewModel.showGoalCreation.targetState = - true - mainViewModel.globalGoal.value = null - - mainViewModel.showNoteCreation.targetState = - false - mainViewModel.globalNote.value = null - } - 2 -> mainViewModel.resultLauncher.value?.launch( - "image/*" - ) - } - }, icon = { - when (mainViewModel.selectedItem.value) { - 0 -> Icon(Icons.Outlined.Edit, null) - 1 -> Icon(Icons.Outlined.AddTask, null) - 2 -> Icon(Icons.Outlined.Image, null) - } - }, text = { - when (mainViewModel.selectedItem.value) { - 0 -> Text(stringResource(R.string.addNote)) - 1 -> Text(stringResource(R.string.makeGoal)) - 2 -> Text(stringResource(R.string.pickImage)) - } - }) - }, - bottomBar = { - BottomNavigationBar( - title = mainViewModel.title, - selectedItem = mainViewModel.selectedItem, - searchMode = mainViewModel.searchMode, - searchString = mainViewModel.searchString, - navController = navController, - items = listOf( - Screen.NoteListScreen, - Screen.GoalsScreen, - Screen.ProfileScreen - ), - alwaysShowLabel = false - ) - }, - snackbarHost = { SnackbarHost(LocalSnackbarHost.current) }, - modifier = Modifier - .nestedScroll(mainViewModel.scrollBehavior.value.nestedScrollConnection) - .weight(1f) - ) { contentPadding -> - Navigation(navController, contentPadding, mainViewModel) - } - Surface(modifier = Modifier.weight(1.5f)) { - Creation(mainViewModel, splitScreen) - } - } - } - else { - Scaffold( - topBar = { - AppBarWithInsets( - type = APP_BAR_CENTER, - navigationIcon = { - when (mainViewModel.selectedItem.value) { - 0 -> { - if (!mainViewModel.searchMode.value) { - IconButton(onClick = { - mainViewModel.searchMode - .value = true - mainViewModel.searchString.value = - "" - - }) { - Icon(Icons.Rounded.Search, null) - } - } else { - IconButton(onClick = { - mainViewModel.searchMode - .value = false - mainViewModel.searchString.value = - "" - }) { - Icon(Icons.Rounded.ArrowBack, null) - } - } - } - 1 -> { - if (!mainViewModel.searchMode.value) { - IconButton(onClick = { - mainViewModel.searchMode - .value = true - mainViewModel.searchString.value = - "" - - }) { - Icon(Icons.Rounded.Search, null) - } - } else { - IconButton(onClick = { - mainViewModel.searchMode - .value = false - mainViewModel.searchString.value = - "" - }) { - Icon(Icons.Rounded.ArrowBack, null) - } - } - } - 2 -> { - IconButton(onClick = { - mainViewModel.showUsernameDialog.value = - true - }) { - Icon(Icons.Outlined.Edit, null) - } - } - } - }, - scrollBehavior = mainViewModel.scrollBehavior.value, - title = { - if (!mainViewModel.searchMode.value) { - Text( - text = if (mainViewModel.selectedItem.value == 2) mainViewModel.profileTitle.value - else stringResource(mainViewModel.title.value), - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - } else { - val localFocusManager = - LocalFocusManager.current - BasicTextField( - modifier = Modifier.fillMaxWidth(), - value = mainViewModel.searchString.value, - textStyle = TextStyle( - fontSize = 22.sp, - color = MaterialTheme.colorScheme.onBackground, - textAlign = TextAlign.Start, - ), - keyboardActions = KeyboardActions( - onDone = { localFocusManager.clearFocus() } - ), - singleLine = true, - cursorBrush = SolidColor(MaterialTheme.colorScheme.onBackground), - onValueChange = { - mainViewModel.searchString.value = it - }) - if (mainViewModel.searchString.value.isEmpty()) { - Text( - text = stringResource(R.string.searchHere), - modifier = Modifier - .fillMaxWidth() - .padding(start = 12.dp), - style = TextStyle( - fontSize = 22.sp, - color = MaterialTheme.colorScheme.outline, - textAlign = TextAlign.Start, - ) - ) - } - } - }, - actions = { - if (!mainViewModel.searchMode.value) { - when (mainViewModel.selectedItem.value) { - 0 -> NoteActions(mainViewModel) - 1 -> GoalActions(mainViewModel) - 2 -> ProfileActions { - navController.navigate(Screen.NoteListScreen.route) { - navController.popBackStack() - launchSingleTop = true - } - makeText( - context, - R.string.seeYouAgain, - LENGTH_SHORT - ).show() - - mainViewModel.signOut() - } - } - } else { - IconButton(onClick = { - mainViewModel.searchString.value = "" - }) { - Icon(Icons.Rounded.Close, null) - } - } - } - ) - }, - floatingActionButton = { - ExtendedFloatingActionButton(onClick = { - when (mainViewModel.selectedItem.value) { - 0 -> { - mainViewModel.showNoteCreation.targetState = - true - mainViewModel.globalNote.value = null - } - 1 -> { - mainViewModel.showGoalCreation.targetState = - true - mainViewModel.globalGoal.value = null - } - 2 -> mainViewModel.resultLauncher.value?.launch("image/*") - } - }, icon = { - when (mainViewModel.selectedItem.value) { - 0 -> Icon(Icons.Outlined.Edit, null) - 1 -> Icon(Icons.Outlined.AddTask, null) - 2 -> Icon(Icons.Outlined.Image, null) - } - }, text = { - when (mainViewModel.selectedItem.value) { - 0 -> Text(stringResource(R.string.addNote)) - 1 -> Text(stringResource(R.string.makeGoal)) - 2 -> Text(stringResource(R.string.pickImage)) - } - }) - }, - bottomBar = { - BottomNavigationBar( - title = mainViewModel.title, - selectedItem = mainViewModel.selectedItem, - searchMode = mainViewModel.searchMode, - searchString = mainViewModel.searchString, - navController = navController, - items = listOf( - Screen.NoteListScreen, - Screen.GoalsScreen, - Screen.ProfileScreen - ), - alwaysShowLabel = false - ) - }, - snackbarHost = { SnackbarHost(LocalSnackbarHost.current) }, - modifier = Modifier - .nestedScroll(mainViewModel.scrollBehavior.value.nestedScrollConnection) - .alpha(if (isScaffoldVisible) 1f else 0f) - ) { contentPadding -> - Navigation(navController, contentPadding, mainViewModel) - } - Creation(mainViewModel, splitScreen) - } - } - } - } - } - - } - } -} - -@Composable -fun Creation(mainViewModel: MainViewModel, splitScreen: Boolean) { - Box(Modifier.fillMaxSize()) { - if (!mainViewModel.showNoteCreation.currentState) { - mainViewModel.globalNote.value = null - if (splitScreen && mainViewModel.selectedItem.value == 0) { - Column( - modifier = Modifier - .fillMaxSize(), - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally - ) { - Icon(Icons.TwoTone.StickyNote2, null, modifier = Modifier.fillMaxSize(0.3f)) - Text(stringResource(R.string.selectNote)) - } - } - } - if (!mainViewModel.showGoalCreation.currentState) { - mainViewModel.globalGoal.value = null - if (splitScreen && mainViewModel.selectedItem.value in 1..2) { - Column( - modifier = Modifier - .fillMaxSize(), - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally - ) { - Icon(Icons.TwoTone.FactCheck, null, modifier = Modifier.fillMaxSize(0.3f)) - Text(stringResource(R.string.selectGoal)) - } - } - } - - AnimatedVisibility( - visibleState = mainViewModel.showNoteCreation, - enter = fadeIn(), - exit = fadeOut() - ) { - BackHandler { mainViewModel.showNoteCreation.targetState = false } - - NoteCreationScreen( - state = mainViewModel.showNoteCreation, - globalNote = mainViewModel.globalNote - ) - } - - AnimatedVisibility( - visibleState = mainViewModel.showGoalCreation, - enter = fadeIn(), - exit = fadeOut() - ) { - BackHandler { mainViewModel.showGoalCreation.targetState = false } - - GoalCreationScreen( - state = mainViewModel.showGoalCreation, - globalGoal = mainViewModel.globalGoal - ) - } - - if (splitScreen) { - Divider( - Modifier - .fillMaxHeight() - .width(1.dp) - .align(Alignment.CenterStart) + FirenoteApp( + context = this, + windowSize = windowSize, + splitScreen = splitScreen, + navController = navController ) } } diff --git a/app/src/main/java/ru/tech/firenote/di/AppModule.kt b/app/src/main/java/ru/tech/firenote/di/AppModule.kt index 516c693..1ca9e7e 100644 --- a/app/src/main/java/ru/tech/firenote/di/AppModule.kt +++ b/app/src/main/java/ru/tech/firenote/di/AppModule.kt @@ -29,7 +29,6 @@ object AppModule { fun provideNoteRepository( database: DatabaseReference, storage: StorageReference - ): NoteRepository = - NoteRepositoryImpl(database, storage) + ): NoteRepository = NoteRepositoryImpl(database, storage) } \ No newline at end of file diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/app/FirenoteApp.kt b/app/src/main/java/ru/tech/firenote/ui/composable/app/FirenoteApp.kt new file mode 100644 index 0000000..60abcf3 --- /dev/null +++ b/app/src/main/java/ru/tech/firenote/ui/composable/app/FirenoteApp.kt @@ -0,0 +1,99 @@ +package ru.tech.firenote.ui.composable.app + +import android.annotation.SuppressLint +import android.content.pm.ActivityInfo +import androidx.activity.ComponentActivity +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.layout.Row +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ExitToApp +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.Surface +import androidx.compose.runtime.* +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha +import androidx.lifecycle.viewmodel.compose.viewModel +import androidx.navigation.NavHostController +import ru.tech.firenote.R +import ru.tech.firenote.ui.composable.provider.LocalSnackbarHost +import ru.tech.firenote.ui.composable.provider.LocalWindowSize +import ru.tech.firenote.ui.composable.screen.auth.AuthScreen +import ru.tech.firenote.ui.composable.screen.creation.CreationContainer +import ru.tech.firenote.ui.composable.single.FirenoteScaffold +import ru.tech.firenote.ui.composable.single.MaterialDialog +import ru.tech.firenote.ui.composable.utils.WindowSize +import ru.tech.firenote.ui.theme.FirenoteTheme +import ru.tech.firenote.viewModel.MainViewModel + +@SuppressLint("SourceLockedOrientationActivity") +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun FirenoteApp( + context: ComponentActivity, + windowSize: WindowSize, + splitScreen: Boolean, + navController: NavHostController, + mainViewModel: MainViewModel = viewModel() +) { + + val isScaffoldVisible by derivedStateOf { + !mainViewModel.showNoteCreation.currentState + || !mainViewModel.showNoteCreation.targetState + || !mainViewModel.showGoalCreation.currentState + || !mainViewModel.showGoalCreation.targetState + } + + FirenoteTheme { + MaterialDialog( + showDialog = rememberSaveable { mutableStateOf(false) }, + icon = Icons.Filled.ExitToApp, + title = R.string.exitApp, + message = R.string.exitAppMessage, + confirmText = R.string.stay, + dismissText = R.string.close, + dismissAction = { context.finishAffinity() } + ) + if (mainViewModel.searchMode.value) BackHandler { + mainViewModel.searchMode.value = false + mainViewModel.searchString.value = "" + } + + + val snackbarHostState = remember { SnackbarHostState() } + CompositionLocalProvider( + LocalSnackbarHost provides snackbarHostState, + LocalWindowSize provides windowSize + ) { + if (mainViewModel.isAuth.value) { + AuthScreen(mainViewModel.isAuth) + context.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + } else { + context.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED + if (splitScreen) { + Row { + FirenoteScaffold( + modifier = Modifier.weight(1f), + mainViewModel = mainViewModel, + navController = navController, + context = context + ) + Surface(modifier = Modifier.weight(1.5f)) { + CreationContainer(mainViewModel, splitScreen) + } + } + } else { + FirenoteScaffold( + modifier = Modifier.alpha(if (isScaffoldVisible) 1f else 0f), + mainViewModel = mainViewModel, + navController = navController, + context = context + ) + CreationContainer(mainViewModel, splitScreen) + } + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/CreationContainer.kt b/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/CreationContainer.kt new file mode 100644 index 0000000..08e5510 --- /dev/null +++ b/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/CreationContainer.kt @@ -0,0 +1,89 @@ +package ru.tech.firenote.ui.composable.screen.creation + +import androidx.activity.compose.BackHandler +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.foundation.layout.* +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.twotone.FactCheck +import androidx.compose.material.icons.twotone.StickyNote2 +import androidx.compose.material3.Divider +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import ru.tech.firenote.R +import ru.tech.firenote.viewModel.MainViewModel + +@Composable +fun CreationContainer(mainViewModel: MainViewModel, splitScreen: Boolean) { + Box(Modifier.fillMaxSize()) { + if (!mainViewModel.showNoteCreation.currentState) { + mainViewModel.globalNote.value = null + if (splitScreen && mainViewModel.selectedItem.value == 0) { + Column( + modifier = Modifier + .fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon(Icons.TwoTone.StickyNote2, null, modifier = Modifier.fillMaxSize(0.3f)) + Text(stringResource(R.string.selectNote)) + } + } + } + if (!mainViewModel.showGoalCreation.currentState) { + mainViewModel.globalGoal.value = null + if (splitScreen && mainViewModel.selectedItem.value in 1..2) { + Column( + modifier = Modifier + .fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon(Icons.TwoTone.FactCheck, null, modifier = Modifier.fillMaxSize(0.3f)) + Text(stringResource(R.string.selectGoal)) + } + } + } + + AnimatedVisibility( + visibleState = mainViewModel.showNoteCreation, + enter = fadeIn(), + exit = fadeOut() + ) { + BackHandler { mainViewModel.showNoteCreation.targetState = false } + + NoteCreationScreen( + state = mainViewModel.showNoteCreation, + globalNote = mainViewModel.globalNote + ) + } + + AnimatedVisibility( + visibleState = mainViewModel.showGoalCreation, + enter = fadeIn(), + exit = fadeOut() + ) { + BackHandler { mainViewModel.showGoalCreation.targetState = false } + + GoalCreationScreen( + state = mainViewModel.showGoalCreation, + globalGoal = mainViewModel.globalGoal + ) + } + + if (splitScreen) { + Divider( + Modifier + .fillMaxHeight() + .width(1.dp) + .align(Alignment.CenterStart) + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/GoalCreationScreen.kt b/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/GoalCreationScreen.kt index 700d43a..06e0657 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/GoalCreationScreen.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/GoalCreationScreen.kt @@ -36,15 +36,14 @@ import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.lifecycle.viewmodel.compose.viewModel -import com.google.accompanist.insets.navigationBarsPadding import kotlinx.coroutines.launch import ru.tech.firenote.R import ru.tech.firenote.model.Goal import ru.tech.firenote.model.GoalData -import ru.tech.firenote.ui.composable.single.bar.EditableAppBar import ru.tech.firenote.ui.composable.single.MaterialDialog +import ru.tech.firenote.ui.composable.single.bar.EditableAppBar import ru.tech.firenote.ui.theme.goalColors -import ru.tech.firenote.utils.Utils.blend +import ru.tech.firenote.utils.GlobalUtils.blend import ru.tech.firenote.viewModel.GoalCreationViewModel @OptIn(ExperimentalMaterial3Api::class) @@ -298,7 +297,10 @@ fun GoalCreationScreen( .weight(1f) .padding(top = 12.dp) .clickable(remember { MutableInteractionSource() }, null) { - viewModel.updateDone(index, !(viewModel.goalContent.value[index].done ?: false)) + viewModel.updateDone( + index, + !(viewModel.goalContent.value[index].done ?: false) + ) }, style = TextStyle( fontSize = 22.sp, diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/NoteCreationScreen.kt b/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/NoteCreationScreen.kt index 87ceda4..6845959 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/NoteCreationScreen.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/screen/creation/NoteCreationScreen.kt @@ -27,15 +27,14 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel -import com.google.accompanist.insets.navigationBarsPadding import kotlinx.coroutines.launch import ru.tech.firenote.R import ru.tech.firenote.model.Note -import ru.tech.firenote.ui.composable.single.text.EditText -import ru.tech.firenote.ui.composable.single.bar.EditableAppBar import ru.tech.firenote.ui.composable.single.MaterialDialog +import ru.tech.firenote.ui.composable.single.bar.EditableAppBar +import ru.tech.firenote.ui.composable.single.text.EditText import ru.tech.firenote.ui.theme.noteColors -import ru.tech.firenote.utils.Utils.blend +import ru.tech.firenote.utils.GlobalUtils.blend import ru.tech.firenote.viewModel.NoteCreationViewModel @OptIn(ExperimentalMaterial3Api::class) diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/FirenoteScaffold.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/FirenoteScaffold.kt new file mode 100644 index 0000000..31a045d --- /dev/null +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/FirenoteScaffold.kt @@ -0,0 +1,224 @@ +package ru.tech.firenote.ui.composable.single + +import android.content.Context +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.BasicTextField +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.outlined.AddTask +import androidx.compose.material.icons.outlined.Edit +import androidx.compose.material.icons.outlined.Image +import androidx.compose.material.icons.rounded.ArrowBack +import androidx.compose.material.icons.rounded.Close +import androidx.compose.material.icons.rounded.Search +import androidx.compose.material3.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavHostController +import ru.tech.firenote.R +import ru.tech.firenote.ui.composable.navigation.Navigation +import ru.tech.firenote.ui.composable.provider.LocalSnackbarHost +import ru.tech.firenote.ui.composable.single.bar.* +import ru.tech.firenote.ui.route.Screen +import ru.tech.firenote.viewModel.MainViewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun FirenoteScaffold( + modifier: Modifier = Modifier, + mainViewModel: MainViewModel, + navController: NavHostController, + context: Context +) { + Scaffold( + topBar = { + AppBarWithInsets( + type = APP_BAR_CENTER, + navigationIcon = { + when (mainViewModel.selectedItem.value) { + 0 -> { + if (!mainViewModel.searchMode.value) { + IconButton(onClick = { + mainViewModel.searchMode + .value = true + mainViewModel.searchString.value = + "" + + }) { + Icon(Icons.Rounded.Search, null) + } + } else { + IconButton(onClick = { + mainViewModel.searchMode + .value = false + mainViewModel.searchString.value = + "" + }) { + Icon(Icons.Rounded.ArrowBack, null) + } + } + } + 1 -> { + if (!mainViewModel.searchMode.value) { + IconButton(onClick = { + mainViewModel.searchMode + .value = true + mainViewModel.searchString.value = + "" + + }) { + Icon(Icons.Rounded.Search, null) + } + } else { + IconButton(onClick = { + mainViewModel.searchMode + .value = false + mainViewModel.searchString.value = + "" + }) { + Icon(Icons.Rounded.ArrowBack, null) + } + } + } + 2 -> { + IconButton(onClick = { + mainViewModel.showUsernameDialog.value = + true + }) { + Icon(Icons.Outlined.Edit, null) + } + } + } + }, + scrollBehavior = mainViewModel.scrollBehavior.value, + title = { + if (!mainViewModel.searchMode.value) { + Text( + text = if (mainViewModel.selectedItem.value == 2) mainViewModel.profileTitle.value + else stringResource(mainViewModel.title.value), + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + } else { + val localFocusManager = + LocalFocusManager.current + BasicTextField( + modifier = Modifier.fillMaxWidth(), + value = mainViewModel.searchString.value, + textStyle = TextStyle( + fontSize = 22.sp, + color = MaterialTheme.colorScheme.onBackground, + textAlign = TextAlign.Start, + ), + keyboardActions = KeyboardActions( + onDone = { localFocusManager.clearFocus() } + ), + singleLine = true, + cursorBrush = SolidColor(MaterialTheme.colorScheme.onBackground), + onValueChange = { + mainViewModel.searchString.value = it + }) + if (mainViewModel.searchString.value.isEmpty()) { + Text( + text = stringResource(R.string.searchHere), + modifier = Modifier + .fillMaxWidth() + .padding(start = 12.dp), + style = TextStyle( + fontSize = 22.sp, + color = MaterialTheme.colorScheme.outline, + textAlign = TextAlign.Start, + ) + ) + } + } + }, + actions = { + if (!mainViewModel.searchMode.value) { + when (mainViewModel.selectedItem.value) { + 0 -> NoteActions(mainViewModel) + 1 -> GoalActions(mainViewModel) + 2 -> ProfileActions { + navController.navigate(Screen.NoteListScreen.route) { + navController.popBackStack() + launchSingleTop = true + } + android.widget.Toast.makeText( + context, + R.string.seeYouAgain, + android.widget.Toast.LENGTH_SHORT + ).show() + + mainViewModel.signOut() + } + } + } else { + IconButton(onClick = { + mainViewModel.searchString.value = "" + }) { + Icon(Icons.Rounded.Close, null) + } + } + } + ) + }, + floatingActionButton = { + ExtendedFloatingActionButton(onClick = { + when (mainViewModel.selectedItem.value) { + 0 -> { + mainViewModel.showNoteCreation.targetState = + true + mainViewModel.globalNote.value = null + } + 1 -> { + mainViewModel.showGoalCreation.targetState = + true + mainViewModel.globalGoal.value = null + } + 2 -> mainViewModel.resultLauncher.value?.launch("image/*") + } + }, icon = { + when (mainViewModel.selectedItem.value) { + 0 -> Icon(Icons.Outlined.Edit, null) + 1 -> Icon(Icons.Outlined.AddTask, null) + 2 -> Icon(Icons.Outlined.Image, null) + } + }, text = { + when (mainViewModel.selectedItem.value) { + 0 -> Text(stringResource(R.string.addNote)) + 1 -> Text(stringResource(R.string.makeGoal)) + 2 -> Text(stringResource(R.string.pickImage)) + } + }) + }, + bottomBar = { + BottomNavigationBar( + title = mainViewModel.title, + selectedItem = mainViewModel.selectedItem, + searchMode = mainViewModel.searchMode, + searchString = mainViewModel.searchString, + navController = navController, + items = listOf( + Screen.NoteListScreen, + Screen.GoalsScreen, + Screen.ProfileScreen + ), + alwaysShowLabel = false + ) + }, + snackbarHost = { SnackbarHost(LocalSnackbarHost.current) }, + modifier = modifier.nestedScroll(mainViewModel.scrollBehavior.value.nestedScrollConnection) + ) { contentPadding -> + Navigation(navController, contentPadding, mainViewModel) + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/MaterialDialog.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/MaterialDialog.kt index defbd49..ceee751 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/MaterialDialog.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/MaterialDialog.kt @@ -12,6 +12,7 @@ import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign @Composable fun MaterialDialog( @@ -28,9 +29,9 @@ fun MaterialDialog( ) { if (showDialog.value) { AlertDialog( - icon = { Icon(icon, contentDescription = null) }, + icon = { Icon(icon, null) }, title = { Text(title) }, - text = { Text(message) }, + text = { Text(message, textAlign = TextAlign.Center) }, confirmButton = { TextButton(onClick = { confirmAction() @@ -73,9 +74,9 @@ fun MaterialDialog( if (showDialog.value) { AlertDialog( - icon = { Icon(icon, contentDescription = null) }, + icon = { Icon(icon, null) }, title = { Text(stringResource(title)) }, - text = { Text(stringResource(message)) }, + text = { Text(stringResource(message), textAlign = TextAlign.Center) }, confirmButton = { TextButton(onClick = { confirmAction() diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarActions.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarActions.kt index 77ed801..452abfd 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarActions.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarActions.kt @@ -21,7 +21,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import ru.tech.firenote.R import ru.tech.firenote.ui.composable.single.MaterialDialog -import ru.tech.firenote.utils.Utils.isOnline +import ru.tech.firenote.utils.GlobalUtils.isOnline import ru.tech.firenote.viewModel.MainViewModel @Composable diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarWithInsets.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarWithInsets.kt index 0c92165..95585ad 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarWithInsets.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/AppBarWithInsets.kt @@ -2,11 +2,11 @@ package ru.tech.firenote.ui.composable.single.bar import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import com.google.accompanist.insets.statusBarsPadding @Composable fun AppBarWithInsets( diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/BottomNavigationBar.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/BottomNavigationBar.kt index a37d249..f99f9e6 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/BottomNavigationBar.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/BottomNavigationBar.kt @@ -21,7 +21,6 @@ fun BottomNavigationBar( ) { Surface(color = TopAppBarDefaults.smallTopAppBarColors().containerColor(100f).value) { NavigationBar(modifier = Modifier.navigationBarsPadding()) { - items.forEachIndexed { index, screen -> selectedItem.value = diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/EditableAppBar.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/EditableAppBar.kt index b415568..9e69e7b 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/EditableAppBar.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/bar/EditableAppBar.kt @@ -2,6 +2,7 @@ package ru.tech.firenote.ui.composable.single.bar import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState @@ -9,7 +10,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb -import com.google.accompanist.insets.statusBarsPadding import ru.tech.firenote.ui.composable.single.text.EditText @Composable diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/NoteItem.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/NoteItem.kt index ad446ed..4de5eaf 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/NoteItem.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/NoteItem.kt @@ -26,7 +26,7 @@ import androidx.compose.ui.unit.dp import ru.tech.firenote.model.Note import ru.tech.firenote.ui.composable.provider.LocalWindowSize import ru.tech.firenote.ui.composable.utils.WindowSize -import ru.tech.firenote.utils.Utils.blend +import ru.tech.firenote.utils.GlobalUtils.blend import java.text.SimpleDateFormat import java.util.* diff --git a/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/ProfileNoteItem.kt b/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/ProfileNoteItem.kt index 1ab1556..866cc69 100644 --- a/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/ProfileNoteItem.kt +++ b/app/src/main/java/ru/tech/firenote/ui/composable/single/lazyitem/ProfileNoteItem.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import ru.tech.firenote.utils.Utils.blend +import ru.tech.firenote.utils.GlobalUtils.blend @Composable fun ProfileNoteItem( diff --git a/app/src/main/java/ru/tech/firenote/ui/theme/Color.kt b/app/src/main/java/ru/tech/firenote/ui/theme/Color.kt index 1a9879a..bd87b04 100644 --- a/app/src/main/java/ru/tech/firenote/ui/theme/Color.kt +++ b/app/src/main/java/ru/tech/firenote/ui/theme/Color.kt @@ -109,59 +109,4 @@ val md_theme_dark_onSurfaceVariant = Color(0xFFd5c1c6) val md_theme_dark_outline = Color(0xFF9d8c90) val md_theme_dark_inverseOnSurface = Color(0xFF1f1a1b) val md_theme_dark_inverseSurface = Color(0xFFebdfe1) -val md_theme_dark_inversePrimary = Color(0xFF984065) - - -/* val md_theme_light_primary = Color(0xFF006e06) -val md_theme_light_onPrimary = Color(0xFFffffff) -val md_theme_light_primaryContainer = Color(0xFF6eff6a) -val md_theme_light_onPrimaryContainer = Color(0xFF002200) -val md_theme_light_secondary = Color(0xFF606200) -val md_theme_light_onSecondary = Color(0xFFffffff) -val md_theme_light_secondaryContainer = Color(0xFFe6e972) -val md_theme_light_onSecondaryContainer = Color(0xFF1c1d00) -val md_theme_light_tertiary = Color(0xFF006b5f) -val md_theme_light_onTertiary = Color(0xFFffffff) -val md_theme_light_tertiaryContainer = Color(0xFF75f8e4) -val md_theme_light_onTertiaryContainer = Color(0xFF00201b) -val md_theme_light_error = Color(0xFFB3261E) -val md_theme_light_errorContainer = Color(0xFFF9DEDC) -val md_theme_light_onError = Color(0xFFFFFFFF) -val md_theme_light_onErrorContainer = Color(0xFF410E0B) -val md_theme_light_background = Color(0xFFFFFBFE) -val md_theme_light_onBackground = Color(0xFF1C1B1F) -val md_theme_light_surface = Color(0xFFFFFBFE) -val md_theme_light_onSurface = Color(0xFF1C1B1F) -val md_theme_light_surfaceVariant = Color(0xFFE7E0EC) -val md_theme_light_onSurfaceVariant = Color(0xFF49454F) -val md_theme_light_outline = Color(0xFF79747E) -val md_theme_light_inverseOnSurface = Color(0xFFF4EFF4) -val md_theme_light_inverseSurface = Color(0xFF313033) -val md_theme_light_inversePrimary = Color(0xFF00e620) - -val md_theme_dark_primary = Color(0xFF00e620) -val md_theme_dark_onPrimary = Color(0xFF003a01) -val md_theme_dark_primaryContainer = Color(0xFF005303) -val md_theme_dark_onPrimaryContainer = Color(0xFF6eff6a) -val md_theme_dark_secondary = Color(0xFFcacd59) -val md_theme_dark_onSecondary = Color(0xFF313300) -val md_theme_dark_secondaryContainer = Color(0xFF474a00) -val md_theme_dark_onSecondaryContainer = Color(0xFFe6e972) -val md_theme_dark_tertiary = Color(0xFF54dbc8) -val md_theme_dark_onTertiary = Color(0xFF003730) -val md_theme_dark_tertiaryContainer = Color(0xFF005046) -val md_theme_dark_onTertiaryContainer = Color(0xFF75f8e4) -val md_theme_dark_error = Color(0xFFF2B8B5) -val md_theme_dark_errorContainer = Color(0xFF8C1D18) -val md_theme_dark_onError = Color(0xFF601410) -val md_theme_dark_onErrorContainer = Color(0xFFF9DEDC) -val md_theme_dark_background = Color(0xFF1C1B1F) -val md_theme_dark_onBackground = Color(0xFFE6E1E5) -val md_theme_dark_surface = Color(0xFF1C1B1F) -val md_theme_dark_onSurface = Color(0xFFE6E1E5) -val md_theme_dark_surfaceVariant = Color(0xFF49454F) -val md_theme_dark_onSurfaceVariant = Color(0xFFCAC4D0) -val md_theme_dark_outline = Color(0xFF938F99) -val md_theme_dark_inverseOnSurface = Color(0xFF1C1B1F) -val md_theme_dark_inverseSurface = Color(0xFFE6E1E5) -val md_theme_dark_inversePrimary = Color(0xFF006e06) */ \ No newline at end of file +val md_theme_dark_inversePrimary = Color(0xFF984065) \ No newline at end of file diff --git a/app/src/main/java/ru/tech/firenote/utils/Utils.kt b/app/src/main/java/ru/tech/firenote/utils/GlobalUtils.kt similarity index 98% rename from app/src/main/java/ru/tech/firenote/utils/Utils.kt rename to app/src/main/java/ru/tech/firenote/utils/GlobalUtils.kt index 934b575..f40b84e 100644 --- a/app/src/main/java/ru/tech/firenote/utils/Utils.kt +++ b/app/src/main/java/ru/tech/firenote/utils/GlobalUtils.kt @@ -7,7 +7,7 @@ import android.net.NetworkCapabilities import android.os.Build import androidx.core.graphics.ColorUtils -object Utils { +object GlobalUtils { fun Int.blend(ratio: Float = 0.2f, with: Int = 0x000000) = ColorUtils.blendARGB(this, with, ratio) diff --git a/app/src/main/java/ru/tech/firenote/viewModel/GoalCreationViewModel.kt b/app/src/main/java/ru/tech/firenote/viewModel/GoalCreationViewModel.kt index 2dc37dc..cdbb4f0 100644 --- a/app/src/main/java/ru/tech/firenote/viewModel/GoalCreationViewModel.kt +++ b/app/src/main/java/ru/tech/firenote/viewModel/GoalCreationViewModel.kt @@ -11,7 +11,7 @@ import ru.tech.firenote.model.GoalData import ru.tech.firenote.repository.NoteRepository import ru.tech.firenote.ui.theme.GoalGreen import ru.tech.firenote.ui.theme.NoteYellow -import ru.tech.firenote.utils.Utils.blend +import ru.tech.firenote.utils.GlobalUtils.blend import javax.inject.Inject @HiltViewModel diff --git a/app/src/main/java/ru/tech/firenote/viewModel/NoteCreationViewModel.kt b/app/src/main/java/ru/tech/firenote/viewModel/NoteCreationViewModel.kt index a9e3945..e8d32bf 100644 --- a/app/src/main/java/ru/tech/firenote/viewModel/NoteCreationViewModel.kt +++ b/app/src/main/java/ru/tech/firenote/viewModel/NoteCreationViewModel.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.launch import ru.tech.firenote.model.Note import ru.tech.firenote.repository.NoteRepository import ru.tech.firenote.ui.theme.NoteYellow -import ru.tech.firenote.utils.Utils.blend +import ru.tech.firenote.utils.GlobalUtils.blend import javax.inject.Inject @HiltViewModel diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index bae700f..20c5aad 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -70,7 +70,7 @@ Введите заголовок Добавить подзадачу Введите подзадачу - Прохождение + Выполненность Ищите тут Ничего не найдено по вашему запросу \ No newline at end of file