|
|
@ -42,14 +42,12 @@ import androidx.compose.foundation.lazy.staggeredgrid.rememberLazyStaggeredGridS
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import androidx.compose.runtime.DisposableEffect
|
|
|
|
|
|
|
|
import androidx.compose.runtime.LaunchedEffect
|
|
|
|
import androidx.compose.runtime.LaunchedEffect
|
|
|
|
import androidx.compose.runtime.getValue
|
|
|
|
import androidx.compose.runtime.getValue
|
|
|
|
import androidx.compose.ui.Alignment
|
|
|
|
import androidx.compose.ui.Alignment
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
|
import androidx.compose.ui.graphics.ColorFilter
|
|
|
|
import androidx.compose.ui.graphics.ColorFilter
|
|
|
|
import androidx.compose.ui.platform.LocalLifecycleOwner
|
|
|
|
|
|
|
|
import androidx.compose.ui.platform.testTag
|
|
|
|
import androidx.compose.ui.platform.testTag
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
@ -60,7 +58,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
import androidx.hilt.navigation.compose.hiltViewModel
|
|
|
|
import androidx.hilt.navigation.compose.hiltViewModel
|
|
|
|
import androidx.lifecycle.Lifecycle
|
|
|
|
import androidx.lifecycle.Lifecycle
|
|
|
|
import androidx.lifecycle.LifecycleEventObserver
|
|
|
|
import androidx.lifecycle.compose.LifecycleEventEffect
|
|
|
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaLoadingWheel
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaLoadingWheel
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.component.scrollbar.DraggableScrollbar
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.component.scrollbar.DraggableScrollbar
|
|
|
@ -128,16 +126,9 @@ internal fun BookmarksScreen(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val lifecycleOwner = LocalLifecycleOwner.current
|
|
|
|
LifecycleEventEffect(Lifecycle.Event.ON_STOP) {
|
|
|
|
DisposableEffect(lifecycleOwner) {
|
|
|
|
|
|
|
|
val observer = LifecycleEventObserver { _, event ->
|
|
|
|
|
|
|
|
if (event == Lifecycle.Event.ON_STOP) {
|
|
|
|
|
|
|
|
clearUndoState()
|
|
|
|
clearUndoState()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lifecycleOwner.lifecycle.addObserver(observer)
|
|
|
|
|
|
|
|
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
when (feedState) {
|
|
|
|
when (feedState) {
|
|
|
|
Loading -> LoadingState(modifier)
|
|
|
|
Loading -> LoadingState(modifier)
|
|
|
|