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