mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2026-11-23 23:57:23 +00:00
Initial setup for navigation display with nav3
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
1 parent
909bd347a7
commit
89d55ede72
7 files changed
+107
-4
No files matched your search
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package net.newpipe
|
||||
|
||||
object Constants {
|
||||
|
||||
const val INTENT_SCREEN_KEY = "SCREEN"
|
||||
}
|
||||
@@ -9,6 +9,9 @@ import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import kotlinx.serialization.json.Json
|
||||
import net.newpipe.Constants
|
||||
import net.newpipe.app.navigation.Screen
|
||||
|
||||
/**
|
||||
* Entry point for compose-related UI components on Android
|
||||
@@ -19,7 +22,12 @@ class ComposeActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContent {
|
||||
App()
|
||||
App(
|
||||
// TODO: Change when everything is in compose and this is the primary activity
|
||||
startDestination = Json.decodeFromString<Screen>(
|
||||
intent.getStringExtra(Constants.INTENT_SCREEN_KEY)!!
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package net.newpipe.app.extensions
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import kotlin.jvm.java
|
||||
import kotlinx.serialization.json.Json
|
||||
import net.newpipe.Constants
|
||||
import net.newpipe.app.ComposeActivity
|
||||
import net.newpipe.app.navigation.Screen
|
||||
|
||||
/**
|
||||
* Navigates to a given compose destination
|
||||
*/
|
||||
fun Context.navigateTo(screen: Screen) = Intent(this, ComposeActivity::class.java).also { intent ->
|
||||
intent.putExtra(Constants.INTENT_SCREEN_KEY, Json.encodeToString(screen))
|
||||
startActivity(intent)
|
||||
}
|
||||
Reference in new issue
Block a user