Skip to content

Commit

Permalink
Udon local
Browse files Browse the repository at this point in the history
EGP追加
  • Loading branch information
naotiki committed Apr 27, 2023
1 parent c8f0126 commit 93bb310
Show file tree
Hide file tree
Showing 34 changed files with 475 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .idea/artifacts/ese_core_js_0_0_B.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/artifacts/ese_core_jvm_0_0_B.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions clients/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ kotlin {
val androidMain by getting {
dependencies {
implementation(projects.composeShared)
val nav_version = "2.5.3"
implementation("androidx.navigation:navigation-compose:$nav_version")
}
}
}
Expand Down
106 changes: 92 additions & 14 deletions clients/androidApp/src/main/java/me/naotiki/ese/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,36 +1,114 @@
package me.naotiki.ese

import AppContainer
import LocalDefaultFont
import Terminal
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.foundation.layout.padding
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import initializeComposeCommon
import kotlinx.coroutines.CoroutineScope
import me.naotiki.ese.Screen.Companion.buildRoute
import me.naotiki.ese.core.PlatformImpl
import me.naotiki.ese.core.appName
import me.naotiki.ese.core.initializePlatformImpl
import targetActivity
import java.io.File



class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
println("Starting... ${appName}")
targetActivity=this

targetActivity = this
initializeComposeCommon()
initializePlatformImpl(object :PlatformImpl{
override fun getEseHomeDir(): File? {
return getExternalFilesDir(null)
}
})
var file: File? = null
/*val launcher = registerForActivityResult(object : ActivityResultContracts.OpenDocumentTree() {
override fun createIntent(context: Context, input: Uri?): Intent {
return super.createIntent(context, input).apply {
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
}
}
}) {
if (it != null) {
contentResolver.takePersistableUriPermission(it, Intent.FLAG_GRANT_READ_URI_PERMISSION)
DocumentFile.fromTreeUri(this, it)
}
}*/

setContent {
AppContainer {
Terminal()
val navController = rememberNavController()
Scaffold(topBar = {
TopAppBar(title = {
Text("Ese Android")
}, actions = {
IconButton({
navController.navigate(Screen.Settings.route) {
// Pop up to the start destination of the graph to
// avoid building up a large stack of destinations
// on the back stack as users select items

popUpTo(navController.graph.startDestinationId) {
saveState = true

}
// Avoid multiple copies of the same destination when
// reselecting the same item
launchSingleTop = true
// Restore state when reselecting a previously selected item
restoreState = true
}
}) {
Icon(Icons.Default.Settings,null)
}
})
}) { paddingValues ->
val coroutineScope= rememberCoroutineScope()
NavHost(navController, Screen.Terminal.route, Modifier.padding(paddingValues)) {
buildRoute(coroutineScope)
}

}
}
}
}
}

enum class Screen(val route: String, val content: @Composable (NavBackStackEntry,CoroutineScope) -> Unit) {
Terminal("terminal", {_,c->
Terminal()
}),
Settings("settings", {a,b->
Text("設定")
});

companion object{
fun NavGraphBuilder.buildRoute(coroutineScope: CoroutineScope) {
values().forEach {
composable(it.route,content={nav->
it.content(nav,coroutineScope)

})
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions clients/androidApp/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="Theme.EseLinux" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="Theme.EseLinux" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryDark">@color/purple_700</item>
Expand Down
2 changes: 1 addition & 1 deletion clients/androidApp/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.EseLinux" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="Theme.EseLinux" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryDark">@color/purple_700</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import android.app.Activity
import android.content.Context
import android.view.KeyEvent.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Row
Expand Down
Loading

0 comments on commit 93bb310

Please sign in to comment.