Skip to content

Commit

Permalink
Standalone: Properly launch media preview
Browse files Browse the repository at this point in the history
Use single task to open media preview in parallel of the main app

Fixes #339

Signed-off-by: IacobIonut01 <[email protected]>
  • Loading branch information
IacobIonut01 committed Feb 18, 2024
1 parent d72e644 commit ca533f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<activity
android:name=".feature_node.presentation.standalone.StandaloneActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.Gallery">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.text.toLowerCase
import androidx.core.view.WindowCompat
import androidx.hilt.navigation.compose.hiltViewModel
import coil3.annotation.ExperimentalCoilApi
import coil3.compose.setSingletonImageLoaderFactory
import com.dot.gallery.core.AlbumState
import com.dot.gallery.feature_node.presentation.mediaview.MediaViewScreen
import com.dot.gallery.feature_node.presentation.util.newImageLoader
import com.dot.gallery.feature_node.presentation.util.toggleOrientation
import com.dot.gallery.ui.theme.GalleryTheme
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -25,6 +28,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
@AndroidEntryPoint
class StandaloneActivity : ComponentActivity() {

@OptIn(ExperimentalCoilApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
Expand All @@ -40,6 +44,7 @@ class StandaloneActivity : ComponentActivity() {
}
setShowWhenLocked(isSecure)
setContent {
setSingletonImageLoaderFactory(::newImageLoader)
GalleryTheme(darkTheme = true) {
Scaffold { paddingValues ->
val viewModel = hiltViewModel<StandaloneViewModel>().apply {
Expand Down

0 comments on commit ca533f9

Please sign in to comment.