diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index fdf8d99..0fc3113 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index a61a7f2..29aad70 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -15,6 +15,9 @@ android {
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ vectorDrawables {
+ useSupportLibrary = true
+ }
}
buildTypes {
@@ -35,6 +38,15 @@ android {
}
buildFeatures {
viewBinding = true
+ compose = true
+ }
+ composeOptions {
+ kotlinCompilerExtensionVersion = "1.4.3"
+ }
+ packaging {
+ resources {
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
+ }
}
}
@@ -50,7 +62,17 @@ dependencies {
implementation("androidx.navigation:navigation-ui-ktx:2.7.5")
implementation("androidx.compose.material3:material3:1.1.2")
implementation("org.matrix.android:matrix-android-sdk2:1.5.30")
+ implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
+ implementation("androidx.activity:activity-compose:1.7.0")
+ implementation(platform("androidx.compose:compose-bom:2023.03.00"))
+ implementation("androidx.compose.ui:ui")
+ implementation("androidx.compose.ui:ui-graphics")
+ implementation("androidx.compose.ui:ui-tooling-preview")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
+ androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
+ androidTestImplementation("androidx.compose.ui:ui-test-junit4")
+ debugImplementation("androidx.compose.ui:ui-tooling")
+ debugImplementation("androidx.compose.ui:ui-test-manifest")
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fac7d67..7ea0076 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -10,13 +10,10 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
- android:theme="@style/Theme.TwoM"
- tools:targetApi="31">
+ >
+ android:exported="true">
diff --git a/app/src/main/java/eu/steffo/twom/MainActivity.kt b/app/src/main/java/eu/steffo/twom/MainActivity.kt
index caba5f6..06696f5 100644
--- a/app/src/main/java/eu/steffo/twom/MainActivity.kt
+++ b/app/src/main/java/eu/steffo/twom/MainActivity.kt
@@ -1,60 +1,49 @@
package eu.steffo.twom
import android.os.Bundle
-import android.view.Menu
-import com.google.android.material.snackbar.Snackbar
-import com.google.android.material.navigation.NavigationView
-import androidx.navigation.findNavController
-import androidx.navigation.ui.AppBarConfiguration
-import androidx.navigation.ui.navigateUp
-import androidx.navigation.ui.setupActionBarWithNavController
-import androidx.navigation.ui.setupWithNavController
-import androidx.drawerlayout.widget.DrawerLayout
-import androidx.appcompat.app.AppCompatActivity
-import eu.steffo.twom.databinding.ActivityMainBinding
-
-/**
- * The main activity of the application.
- */
-class MainActivity : AppCompatActivity() {
-
- private lateinit var appBarConfiguration: AppBarConfiguration
- private lateinit var binding: ActivityMainBinding
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material3.Divider
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.ModalDrawerSheet
+import androidx.compose.material3.ModalNavigationDrawer
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.tooling.preview.Preview
+import eu.steffo.twom.ui.theme.TwoMTheme
+class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- binding = ActivityMainBinding.inflate(layoutInflater)
- setContentView(binding.root)
-
- setSupportActionBar(binding.appBarMain.toolbar)
-
- binding.appBarMain.fab.setOnClickListener { view ->
- Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
- .setAction("Action", null).show()
+ setContent {
+ TwoMTheme {
+ // A surface container using the 'background' color from the theme
+ ModalNavigationDrawer(
+ drawerContent = {
+ Drawer()
+ }
+ ) {
+ Surface(
+ modifier = Modifier.fillMaxSize(),
+ color = MaterialTheme.colorScheme.background
+ ) {
+ Text(text = "Garasbici")
+ }
+ }
+ }
}
- val drawerLayout: DrawerLayout = binding.drawerLayout
- val navView: NavigationView = binding.navView
- val navController = findNavController(R.id.nav_host_fragment_content_main)
- // Passing each menu ID as a set of Ids because each
- // menu should be considered as top level destinations.
- appBarConfiguration = AppBarConfiguration(
- setOf(
- R.id.nav_events
- ), drawerLayout
- )
- setupActionBarWithNavController(navController, appBarConfiguration)
- navView.setupWithNavController(navController)
}
+}
- override fun onCreateOptionsMenu(menu: Menu): Boolean {
- // Inflate the menu; this adds items to the action bar if it is present.
- menuInflater.inflate(R.menu.main, menu)
- return true
- }
-
- override fun onSupportNavigateUp(): Boolean {
- val navController = findNavController(R.id.nav_host_fragment_content_main)
- return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
+@Preview
+@Composable
+fun Drawer() {
+ ModalDrawerSheet {
+ Text(text = "garasauto")
+ Divider()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/ui/events/EventsFragment.kt b/app/src/main/java/eu/steffo/twom/ui/events/EventsFragment.kt
deleted file mode 100644
index f9a7928..0000000
--- a/app/src/main/java/eu/steffo/twom/ui/events/EventsFragment.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package eu.steffo.twom.ui.events
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.TextView
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.ViewModelProvider
-import eu.steffo.twom.databinding.FragmentHomeBinding
-
-class EventsFragment : Fragment() {
-
- private var _binding: FragmentHomeBinding? = null
-
- // This property is only valid between onCreateView and
- // onDestroyView.
- private val binding get() = _binding!!
-
- override fun onCreateView(
- inflater: LayoutInflater,
- container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- val eventsViewModel =
- ViewModelProvider(this).get(EventsViewModel::class.java)
-
- _binding = FragmentHomeBinding.inflate(inflater, container, false)
- val root: View = binding.root
-
- val textView: TextView = binding.textHome
- eventsViewModel.text.observe(viewLifecycleOwner) {
- textView.text = it
- }
- return root
- }
-
- override fun onDestroyView() {
- super.onDestroyView()
- _binding = null
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/ui/events/EventsViewModel.kt b/app/src/main/java/eu/steffo/twom/ui/events/EventsViewModel.kt
deleted file mode 100644
index ccc6b9b..0000000
--- a/app/src/main/java/eu/steffo/twom/ui/events/EventsViewModel.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package eu.steffo.twom.ui.events
-
-import androidx.lifecycle.LiveData
-import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.ViewModel
-
-class EventsViewModel : ViewModel() {
-
- private val _text = MutableLiveData().apply {
- value = "This is home Fragment"
- }
- val text: LiveData = _text
-}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/ui/theme/Theme.kt b/app/src/main/java/eu/steffo/twom/ui/theme/Theme.kt
new file mode 100644
index 0000000..93116a7
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/ui/theme/Theme.kt
@@ -0,0 +1,42 @@
+package eu.steffo.twom.ui.theme
+
+import android.app.Activity
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.dynamicDarkColorScheme
+import androidx.compose.material3.dynamicLightColorScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.SideEffect
+import androidx.compose.ui.graphics.toArgb
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalView
+import androidx.core.view.WindowCompat
+
+
+@Composable
+fun TwoMTheme(
+ content: @Composable () -> Unit
+) {
+ val context = LocalContext.current
+ val darkTheme = isSystemInDarkTheme()
+ val colorScheme = if (darkTheme) {
+ dynamicDarkColorScheme(context)
+ } else {
+ dynamicLightColorScheme(context)
+ }
+
+ val view = LocalView.current
+ if (!view.isInEditMode) {
+ SideEffect {
+ val window = (view.context as Activity).window
+ window.statusBarColor = colorScheme.primary.toArgb()
+ WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
+ }
+ }
+
+ MaterialTheme(
+ colorScheme = colorScheme,
+ typography = Typography,
+ content = content
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/eu/steffo/twom/ui/theme/Type.kt b/app/src/main/java/eu/steffo/twom/ui/theme/Type.kt
new file mode 100644
index 0000000..8149127
--- /dev/null
+++ b/app/src/main/java/eu/steffo/twom/ui/theme/Type.kt
@@ -0,0 +1,6 @@
+package eu.steffo.twom.ui.theme
+
+import androidx.compose.material3.Typography
+
+// Set of Material typography styles to start with
+val Typography = Typography()
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_menu_camera.xml b/app/src/main/res/drawable/ic_menu_camera.xml
deleted file mode 100644
index 634fe92..0000000
--- a/app/src/main/res/drawable/ic_menu_camera.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/drawable/ic_menu_gallery.xml b/app/src/main/res/drawable/ic_menu_gallery.xml
deleted file mode 100644
index 03c7709..0000000
--- a/app/src/main/res/drawable/ic_menu_gallery.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_menu_slideshow.xml b/app/src/main/res/drawable/ic_menu_slideshow.xml
deleted file mode 100644
index 5e9e163..0000000
--- a/app/src/main/res/drawable/ic_menu_slideshow.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/side_nav_bar.xml b/app/src/main/res/drawable/side_nav_bar.xml
deleted file mode 100644
index 6d81870..0000000
--- a/app/src/main/res/drawable/side_nav_bar.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 6c7dd7c..0000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
deleted file mode 100644
index ac92ba2..0000000
--- a/app/src/main/res/layout/app_bar_main.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
deleted file mode 100644
index 6e0ea39..0000000
--- a/app/src/main/res/layout/content_main.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_gallery.xml b/app/src/main/res/layout/fragment_gallery.xml
deleted file mode 100644
index 643fe25..0000000
--- a/app/src/main/res/layout/fragment_gallery.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
deleted file mode 100644
index 80c0873..0000000
--- a/app/src/main/res/layout/fragment_home.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_slideshow.xml b/app/src/main/res/layout/fragment_slideshow.xml
deleted file mode 100644
index 2141a33..0000000
--- a/app/src/main/res/layout/fragment_slideshow.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml
deleted file mode 100644
index c145545..0000000
--- a/app/src/main/res/layout/nav_header_main.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
deleted file mode 100644
index 8dc1e5c..0000000
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml
deleted file mode 100644
index 412d5f8..0000000
--- a/app/src/main/res/menu/main.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml
deleted file mode 100644
index a7b6b70..0000000
--- a/app/src/main/res/navigation/mobile_navigation.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml
deleted file mode 100644
index 22d7f00..0000000
--- a/app/src/main/res/values-land/dimens.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 48dp
-
\ No newline at end of file
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
deleted file mode 100644
index 185d121..0000000
--- a/app/src/main/res/values-night/themes.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-w1240dp/dimens.xml b/app/src/main/res/values-w1240dp/dimens.xml
deleted file mode 100644
index d73f4a3..0000000
--- a/app/src/main/res/values-w1240dp/dimens.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 200dp
-
\ No newline at end of file
diff --git a/app/src/main/res/values-w600dp/dimens.xml b/app/src/main/res/values-w600dp/dimens.xml
deleted file mode 100644
index 22d7f00..0000000
--- a/app/src/main/res/values-w600dp/dimens.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- 48dp
-
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
deleted file mode 100644
index f8c6127..0000000
--- a/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- #FFBB86FC
- #FF6200EE
- #FF3700B3
- #FF03DAC5
- #FF018786
- #FF000000
- #FFFFFFFF
-
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 4ab4520..0000000
--- a/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- 16dp
- 16dp
- 8dp
- 176dp
- 16dp
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 56461f6..8858b3b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,11 +1,3 @@
TwoM
- Open navigation drawer
- Close navigation drawer
- Android Studio
- android.studio@android.com
- Navigation header
- Settings
-
- Events
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
deleted file mode 100644
index e8ce3e0..0000000
--- a/app/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 6d9d338..9861456 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.1" apply false
- id("org.jetbrains.kotlin.android") version "1.9.0" apply false
+ id("org.jetbrains.kotlin.android") version "1.8.10" apply false
}
\ No newline at end of file