Browse code

Initial commit (losing old history)

Dario Rodriguez authored on 08/04/2026 17:25:38
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,78 @@
1
+/*
2
+ * Copyright (c) 2023 Samson Achiaga
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package com.certified.audionote.navigation
18
+
19
+import android.app.Activity
20
+import androidx.compose.foundation.layout.*
21
+import androidx.compose.material3.*
22
+import androidx.compose.runtime.*
23
+import androidx.compose.ui.*
24
+import androidx.navigation.compose.*
25
+import com.certified.audionote.navigation.nav_hosts.*
26
+import com.certified.audionote.ui.theme.*
27
+import com.certified.audionote.utils.*
28
+
29
+/**
30
+ * Created by MJ Jacobs on 2024/12/28 at 13:56
31
+ */
32
+
33
+//  TODO: 2024/12/28 - Decide on whether to use height or width to measure screen orientation
34
+
35
+@Composable
36
+fun AudioNoteNavHost(
37
+    activity: Activity,
38
+) {
39
+    val navController = rememberNavController()
40
+    
41
+    Scaffold(
42
+        content = { paddingValues ->
43
+            Box(
44
+                modifier = Modifier.padding(
45
+                    top = paddingValues.calculateTopPadding().plus(normalPadding),
46
+                    start = normalPadding,
47
+                    end = normalPadding,
48
+                    bottom = paddingValues.calculateBottomPadding().plus(normalPadding)
49
+                )
50
+            ) {
51
+                calculateWindowSize(
52
+                    activity = activity,
53
+                    windowWidthSizeClassChange = { windowSize ->
54
+                        when (windowSize) {
55
+                            WindowSizeClass.COMPACT -> {
56
+                                CompactNavHost(
57
+                                    navController = navController
58
+                                )
59
+                            }
60
+                            
61
+                            WindowSizeClass.MEDIUM -> {
62
+                                MediumNavHost(
63
+                                    navController = navController
64
+                                )
65
+                            }
66
+                            
67
+                            WindowSizeClass.EXPANDED -> {
68
+                                ExpandedNavHost(
69
+                                    navController = navController
70
+                                )
71
+                            }
72
+                        }
73
+                    }
74
+                )
75
+            }
76
+        }
77
+    )
78
+}
0 79
\ No newline at end of file