ui:material: Add activity in manifest and allow to configure the theme used
authorDa Risk <da_risk@geekorum.com>
Thu, 13 Apr 2023 19:36:46 -0400
changeset 5 448854642714
parent 4 3d88feb1156b
child 6 67743d62eda9
ui:material: Add activity in manifest and allow to configure the theme used
ui/material2/src/main/AndroidManifest.xml
ui/material2/src/main/java/com/geekorum/aboutoss/ui/material/OpenSourceLicensesActivity.kt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/material2/src/main/AndroidManifest.xml	Thu Apr 13 19:36:46 2023 -0400
@@ -0,0 +1,34 @@
+<!--
+
+    AboutOss is a utility library to retrieve and display
+    opensource licenses in Android applications.
+
+    Copyright (C) 2023 by Frederic-Charles Barthelery.
+
+    This file is part of AboutOss.
+
+    AboutOss is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    AboutOss is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with AboutOss.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+    <application>
+        <activity android:name=".OpenSourceLicensesActivity"
+            android:theme="@style/Theme.AppCompat.NoActionBar"
+            android:label="@string/title_oss_licenses"
+            android:exported="false"
+            />
+
+    </application>
+
+</manifest>
\ No newline at end of file
--- a/ui/material2/src/main/java/com/geekorum/aboutoss/ui/material/OpenSourceLicensesActivity.kt	Thu Apr 13 17:37:13 2023 -0400
+++ b/ui/material2/src/main/java/com/geekorum/aboutoss/ui/material/OpenSourceLicensesActivity.kt	Thu Apr 13 19:36:46 2023 -0400
@@ -37,16 +37,24 @@
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContent {
-            MaterialTheme {
+            themeProvider {
                 DependencyNavHost(
                     openSourceLicensesViewModel = viewModel,
                     navigateUp = {
-                        onNavigateUp()
+                        if (!onNavigateUp()) {
+                            finish()
+                        }
                     }
                 )
             }
         }
     }
+
+    companion object {
+        var themeProvider: @Composable (@Composable () -> Unit) -> Unit = { content ->
+            MaterialTheme(content = content)
+        }
+    }
 }