Section 2 of android native implementation
All checks were successful
Deploy to production / deploy (push) Successful in 21s
All checks were successful
Deploy to production / deploy (push) Successful in 21s
This commit is contained in:
22
android/native/app/src/main/AndroidManifest.xml
Normal file
22
android/native/app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name=".YourPartNativeApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher_foreground"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@drawable/ic_launcher_foreground"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.YourPartNative">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,22 @@
|
||||
package de.yourpart.nativeapp
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import de.yourpart.nativeapp.ui.YourPartNativeApp
|
||||
import de.yourpart.nativeapp.ui.theme.YourPartTheme
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
YourPartTheme {
|
||||
YourPartNativeApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package de.yourpart.nativeapp
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
class YourPartNativeApplication : Application()
|
||||
@@ -0,0 +1,68 @@
|
||||
package de.yourpart.nativeapp.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import de.yourpart.nativeapp.BuildConfig
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun YourPartNativeApp() {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text("YourPart") },
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
titleContentColor = MaterialTheme.colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
},
|
||||
) { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(innerPadding)
|
||||
.padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
Text(
|
||||
text = "Native Android MVP",
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
)
|
||||
Text(
|
||||
text = "Projektbasis fuer Kotlin, Compose, Flavors, Hilt und Netzwerk ist angelegt.",
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
)
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||
),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Text("Environment", style = MaterialTheme.typography.titleMedium)
|
||||
Text("API: ${BuildConfig.API_BASE_URL}")
|
||||
Text("Socket.IO: ${BuildConfig.SOCKET_IO_URL}")
|
||||
Text("Daemon: ${BuildConfig.DAEMON_SOCKET_URL}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package de.yourpart.nativeapp.ui.theme
|
||||
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
private val YourPartLightScheme = lightColorScheme(
|
||||
primary = Color(0xFFF8A22B),
|
||||
onPrimary = Color(0xFF2B1F14),
|
||||
secondary = Color(0xFF78C38A),
|
||||
onSecondary = Color(0xFF173822),
|
||||
secondaryContainer = Color(0xFFE5F3E8),
|
||||
onSecondaryContainer = Color(0xFF1F5131),
|
||||
surface = Color(0xFFFFF8EE),
|
||||
onSurface = Color(0xFF2B1F14),
|
||||
background = Color(0xFFFFFCF7),
|
||||
onBackground = Color(0xFF2B1F14),
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun YourPartTheme(content: @Composable () -> Unit) {
|
||||
MaterialTheme(
|
||||
colorScheme = YourPartLightScheme,
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#F8A22B"
|
||||
android:pathData="M20,20h68a8,8 0,0 1,8 8v52a8,8 0,0 1,-8 8H20a8,8 0,0 1,-8 -8V28a8,8 0,0 1,8 -8z" />
|
||||
<path
|
||||
android:fillColor="#78C38A"
|
||||
android:pathData="M31,35h18a13,13 0,0 1,0 26H39v16H31zM39,43v10h10a5,5 0,0 0,0 -10z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M58,35h8v17h16v8H66v17h-8V60H42v-8h16z" />
|
||||
</vector>
|
||||
4
android/native/app/src/main/res/values/colors.xml
Normal file
4
android/native/app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFF8EE</color>
|
||||
</resources>
|
||||
4
android/native/app/src/main/res/values/strings.xml
Normal file
4
android/native/app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">YourPart Native</string>
|
||||
</resources>
|
||||
8
android/native/app/src/main/res/values/styles.xml
Normal file
8
android/native/app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.YourPartNative" parent="android:style/Theme.Material.Light.NoActionBar">
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
<item name="android:fontFamily">sans</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user