refactor: remove @Immutable from enum classes
This commit is contained in:
parent
3a08791cbe
commit
69689b8be6
18 changed files with 13 additions and 41 deletions
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.browse.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class BrowseLayout {
|
||||
LIST, GRID
|
||||
}
|
||||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.browse.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class BrowseSortOrder {
|
||||
NAME,
|
||||
FILE_FORMAT,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.library.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class LibraryLayout {
|
||||
GRID, LIST
|
||||
}
|
||||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.library.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class LibrarySortOrder {
|
||||
NAME,
|
||||
LAST_READ,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.library.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class LibraryTitlePosition {
|
||||
OFF, BELOW, INSIDE
|
||||
}
|
||||
|
|
@ -119,12 +119,12 @@ class MainActivity : AppCompatActivity() {
|
|||
else LibraryScreen,
|
||||
transitionSpec = { lastEvent ->
|
||||
when (lastEvent) {
|
||||
StackEvent.Default -> {
|
||||
StackEvent.DEFAULT -> {
|
||||
Transitions.SlidingTransitionIn
|
||||
.togetherWith(Transitions.SlidingTransitionOut)
|
||||
}
|
||||
|
||||
StackEvent.Pop -> {
|
||||
StackEvent.POP -> {
|
||||
Transitions.BackSlidingTransitionIn
|
||||
.togetherWith(Transitions.BackSlidingTransitionOut)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Navigator @AssistedInject constructor(
|
|||
initialValue = initialScreen
|
||||
)
|
||||
|
||||
val lastEvent = savedStateHandle.getStateFlow("stack_event", StackEvent.Default)
|
||||
val lastEvent = savedStateHandle.getStateFlow("stack_event", StackEvent.DEFAULT)
|
||||
private fun changeStackEvent(stackEvent: StackEvent) {
|
||||
savedStateHandle["stack_event"] = stackEvent
|
||||
}
|
||||
|
|
@ -56,8 +56,8 @@ class Navigator @AssistedInject constructor(
|
|||
if (!saveInBackStack) items.removeLast()
|
||||
|
||||
changeStackEvent(
|
||||
if (popping) StackEvent.Pop
|
||||
else StackEvent.Default
|
||||
if (popping) StackEvent.POP
|
||||
else StackEvent.DEFAULT
|
||||
)
|
||||
|
||||
if (lastItem.value::class == targetScreen::class) items.removeLast()
|
||||
|
|
@ -67,8 +67,8 @@ class Navigator @AssistedInject constructor(
|
|||
fun pop(popping: Boolean = true) {
|
||||
if (items.value.count() > 1) {
|
||||
changeStackEvent(
|
||||
if (popping) StackEvent.Pop
|
||||
else StackEvent.Default
|
||||
if (popping) StackEvent.POP
|
||||
else StackEvent.DEFAULT
|
||||
)
|
||||
items.removeLast()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@
|
|||
package ua.acclorite.book_story.presentation.navigator
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.compose.runtime.Immutable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Immutable
|
||||
@Parcelize
|
||||
enum class StackEvent : Parcelable {
|
||||
Default, Pop
|
||||
DEFAULT, POP
|
||||
}
|
||||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.reader.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class ReaderColorEffects {
|
||||
OFF,
|
||||
GRAYSCALE,
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.reader.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
|
||||
@Immutable
|
||||
enum class ReaderFontThickness(val thickness: FontWeight) {
|
||||
THIN(FontWeight.Thin),
|
||||
EXTRA_LIGHT(FontWeight.ExtraLight),
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.reader.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class ReaderHorizontalGesture {
|
||||
OFF,
|
||||
ON,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.reader.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class ReaderProgressCount {
|
||||
PERCENTAGE,
|
||||
QUANTITY
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
package ua.acclorite.book_story.presentation.reader.model
|
||||
|
||||
import android.content.pm.ActivityInfo
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class ReaderScreenOrientation(val code: Int) {
|
||||
DEFAULT(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED),
|
||||
FREE(ActivityInfo.SCREEN_ORIENTATION_USER),
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@
|
|||
|
||||
package ua.acclorite.book_story.presentation.reader.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
|
||||
@Immutable
|
||||
enum class ReaderTextAlignment(val textAlignment: TextAlign) {
|
||||
START(TextAlign.Start),
|
||||
JUSTIFY(TextAlign.Justify),
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ object StartScreen : Screen, Parcelable {
|
|||
val activity = LocalActivity.current
|
||||
|
||||
val currentPage = remember { mutableIntStateOf(0) }
|
||||
val stackEvent = remember { mutableStateOf(StackEvent.Default) }
|
||||
val stackEvent = remember { mutableStateOf(StackEvent.DEFAULT) }
|
||||
|
||||
val languages = remember(settings.language.value) {
|
||||
CoreData.languages.sortedBy { it.second }.map {
|
||||
|
|
@ -79,14 +79,14 @@ object StartScreen : Screen, Parcelable {
|
|||
return@StartContent
|
||||
}
|
||||
|
||||
stackEvent.value = StackEvent.Default
|
||||
stackEvent.value = StackEvent.DEFAULT
|
||||
currentPage.intValue += 1
|
||||
},
|
||||
navigateBack = {
|
||||
if ((currentPage.intValue - 1) < 0) {
|
||||
activity.finish()
|
||||
} else {
|
||||
stackEvent.value = StackEvent.Pop
|
||||
stackEvent.value = StackEvent.POP
|
||||
currentPage.intValue -= 1
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.ui.common.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class Direction {
|
||||
START, NEUTRAL, END
|
||||
}
|
||||
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
package ua.acclorite.book_story.ui.common.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
enum class Position {
|
||||
TOP, CENTER, BOTTOM, SOLO
|
||||
}
|
||||
|
|
@ -28,12 +28,12 @@ fun StartContentTransition(
|
|||
targetState = targetValue,
|
||||
transitionSpec = {
|
||||
when (stackEvent) {
|
||||
StackEvent.Default -> {
|
||||
StackEvent.DEFAULT -> {
|
||||
Transitions.SlidingTransitionIn
|
||||
.togetherWith(Transitions.SlidingTransitionOut)
|
||||
}
|
||||
|
||||
StackEvent.Pop -> {
|
||||
StackEvent.POP -> {
|
||||
Transitions.BackSlidingTransitionIn
|
||||
.togetherWith(Transitions.BackSlidingTransitionOut)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue