| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,191 @@ |
| 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.features.settings |
|
| 18 |
+ |
|
| 19 |
+import android.content.res.* |
|
| 20 |
+import androidx.compose.foundation.* |
|
| 21 |
+import androidx.compose.foundation.layout.* |
|
| 22 |
+import androidx.compose.foundation.shape.* |
|
| 23 |
+import androidx.compose.material.icons.* |
|
| 24 |
+import androidx.compose.material.icons.automirrored.outlined.* |
|
| 25 |
+import androidx.compose.material.icons.outlined.* |
|
| 26 |
+import androidx.compose.material3.* |
|
| 27 |
+import androidx.compose.runtime.* |
|
| 28 |
+import androidx.compose.ui.* |
|
| 29 |
+import androidx.compose.ui.draw.* |
|
| 30 |
+import androidx.compose.ui.graphics.vector.* |
|
| 31 |
+import androidx.compose.ui.res.* |
|
| 32 |
+import androidx.compose.ui.text.* |
|
| 33 |
+import androidx.compose.ui.tooling.preview.* |
|
| 34 |
+import androidx.compose.ui.unit.* |
|
| 35 |
+import com.certified.audionote.R |
|
| 36 |
+import com.certified.audionote.ui.theme.* |
|
| 37 |
+ |
|
| 38 |
+/** |
|
| 39 |
+ * Created by MJ Jacobs on 2024/12/28 at 14:54 |
|
| 40 |
+ */ |
|
| 41 |
+ |
|
| 42 |
+@Composable |
|
| 43 |
+fun SettingsScreen( |
|
| 44 |
+ modifier: Modifier = Modifier |
|
| 45 |
+) {
|
|
| 46 |
+ SettingsScreenContent( |
|
| 47 |
+ modifier = modifier |
|
| 48 |
+ ) |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+@Composable |
|
| 52 |
+private fun SettingsScreenContent( |
|
| 53 |
+ modifier: Modifier = Modifier |
|
| 54 |
+) {
|
|
| 55 |
+ Column( |
|
| 56 |
+ modifier = modifier.fillMaxSize(), |
|
| 57 |
+ content = {
|
|
| 58 |
+ // Display title |
|
| 59 |
+ Text( |
|
| 60 |
+ modifier = Modifier |
|
| 61 |
+ .fillMaxWidth() |
|
| 62 |
+ .padding(start = largePadding + 24.dp), |
|
| 63 |
+ text = stringResource(R.string.display), |
|
| 64 |
+ style = TextStyle( |
|
| 65 |
+ color = if (isSystemInDarkTheme()) primaryDark else primaryLight, |
|
| 66 |
+ fontSize = 20.sp |
|
| 67 |
+ ) |
|
| 68 |
+ ) |
|
| 69 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 70 |
+ |
|
| 71 |
+ // Theme selection |
|
| 72 |
+ SettingsRowItem( |
|
| 73 |
+ icon = Icons.Outlined.BrightnessMedium, |
|
| 74 |
+ imageDescription = stringResource(R.string.theme), |
|
| 75 |
+ title = stringResource(R.string.theme), |
|
| 76 |
+ description = stringResource(R.string.theme_system_default), |
|
| 77 |
+ onClick = { /*TODO*/ }
|
|
| 78 |
+ ) |
|
| 79 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 80 |
+ // About title |
|
| 81 |
+ Text( |
|
| 82 |
+ modifier = Modifier |
|
| 83 |
+ .fillMaxWidth() |
|
| 84 |
+ .padding(start = largePadding + 24.dp), |
|
| 85 |
+ text = stringResource(R.string.about), |
|
| 86 |
+ style = TextStyle( |
|
| 87 |
+ color = if (isSystemInDarkTheme()) primaryDark else primaryLight, |
|
| 88 |
+ fontSize = 20.sp |
|
| 89 |
+ ) |
|
| 90 |
+ ) |
|
| 91 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 92 |
+ |
|
| 93 |
+ // Theme selection |
|
| 94 |
+ SettingsRowItem( |
|
| 95 |
+ icon = Icons.Outlined.Person, |
|
| 96 |
+ imageDescription = stringResource(R.string.developer), |
|
| 97 |
+ title = stringResource(R.string.developer), |
|
| 98 |
+ description = stringResource(R.string.developer_nick), |
|
| 99 |
+ onClick = { /*TODO*/ }
|
|
| 100 |
+ ) |
|
| 101 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 102 |
+ |
|
| 103 |
+ // Theme selection |
|
| 104 |
+ SettingsRowItem( |
|
| 105 |
+ icon = Icons.Outlined.Code, |
|
| 106 |
+ imageDescription = stringResource(R.string.contribute), |
|
| 107 |
+ title = stringResource(R.string.contribute), |
|
| 108 |
+ description = stringResource(R.string.contribute_summary), |
|
| 109 |
+ onClick = { /*TODO*/ }
|
|
| 110 |
+ ) |
|
| 111 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 112 |
+ |
|
| 113 |
+ // Theme selection |
|
| 114 |
+ SettingsRowItem( |
|
| 115 |
+ icon = Icons.AutoMirrored.Outlined.ContactSupport, |
|
| 116 |
+ imageDescription = stringResource(R.string.contact_feedback), |
|
| 117 |
+ title = stringResource(R.string.contact_feedback), |
|
| 118 |
+ description = stringResource(R.string.developer_mail), |
|
| 119 |
+ onClick = { /*TODO*/ }
|
|
| 120 |
+ ) |
|
| 121 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 122 |
+ |
|
| 123 |
+ // Theme selection |
|
| 124 |
+ SettingsRowItem( |
|
| 125 |
+ icon = Icons.Outlined.Info, |
|
| 126 |
+ imageDescription = stringResource(R.string.about), |
|
| 127 |
+ title = stringResource(R.string.about), |
|
| 128 |
+ description = stringResource(R.string.app_version_licence_and_more), |
|
| 129 |
+ onClick = { /*TODO*/ }
|
|
| 130 |
+ ) |
|
| 131 |
+ Spacer(modifier = Modifier.height(normalPadding)) |
|
| 132 |
+ } |
|
| 133 |
+ ) |
|
| 134 |
+} |
|
| 135 |
+ |
|
| 136 |
+@Composable |
|
| 137 |
+private fun SettingsRowItem( |
|
| 138 |
+ icon: ImageVector, |
|
| 139 |
+ imageDescription: String, |
|
| 140 |
+ title: String, |
|
| 141 |
+ description: String, |
|
| 142 |
+ onClick: () -> Unit, |
|
| 143 |
+) {
|
|
| 144 |
+ Row( |
|
| 145 |
+ modifier = Modifier |
|
| 146 |
+ .fillMaxWidth() |
|
| 147 |
+ .clip(RoundedCornerShape(defaultCornerSize)) |
|
| 148 |
+ .clickable { onClick() },
|
|
| 149 |
+ verticalAlignment = Alignment.CenterVertically, |
|
| 150 |
+ content = {
|
|
| 151 |
+ // Icon |
|
| 152 |
+ Icon( |
|
| 153 |
+ modifier = Modifier.padding(normalPadding), |
|
| 154 |
+ imageVector = icon, |
|
| 155 |
+ contentDescription = imageDescription |
|
| 156 |
+ ) |
|
| 157 |
+ |
|
| 158 |
+ Column( |
|
| 159 |
+ modifier = Modifier.fillMaxWidth(), |
|
| 160 |
+ content = {
|
|
| 161 |
+ // Title text field |
|
| 162 |
+ Text( |
|
| 163 |
+ text = title, |
|
| 164 |
+ style = MaterialTheme.typography.titleMedium |
|
| 165 |
+ ) |
|
| 166 |
+ |
|
| 167 |
+ Text( |
|
| 168 |
+ text = description, |
|
| 169 |
+ style = MaterialTheme.typography.bodyMedium |
|
| 170 |
+ ) |
|
| 171 |
+ } |
|
| 172 |
+ ) |
|
| 173 |
+ } |
|
| 174 |
+ ) |
|
| 175 |
+} |
|
| 176 |
+ |
|
| 177 |
+@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, showBackground = true) |
|
| 178 |
+@Composable |
|
| 179 |
+private fun PreviewSettingsScreenContentLightTheme() {
|
|
| 180 |
+ AudioNoteTheme {
|
|
| 181 |
+ SettingsScreenContent() |
|
| 182 |
+ } |
|
| 183 |
+} |
|
| 184 |
+ |
|
| 185 |
+@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, showBackground = true) |
|
| 186 |
+@Composable |
|
| 187 |
+private fun PreviewSettingsScreenContentDarkTheme() {
|
|
| 188 |
+ AudioNoteTheme {
|
|
| 189 |
+ SettingsScreenContent() |
|
| 190 |
+ } |
|
| 191 |
+} |
|
| 0 | 192 |
\ No newline at end of file |