added navigation menu
This commit is contained in:
		
							parent
							
								
									66af123953
								
							
						
					
					
						commit
						912213e287
					
				|  | @ -0,0 +1,6 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <project version="4"> | ||||||
|  |   <component name="VcsDirectoryMappings"> | ||||||
|  |     <mapping directory="$PROJECT_DIR$" vcs="Git" /> | ||||||
|  |   </component> | ||||||
|  | </project> | ||||||
|  | @ -1,16 +1,29 @@ | ||||||
| package com.module.breeze | package com.module.breeze | ||||||
| 
 | 
 | ||||||
|  | import android.content.Intent | ||||||
| import android.os.Bundle | import android.os.Bundle | ||||||
|  | import android.provider.CalendarContract | ||||||
| import androidx.activity.ComponentActivity | import androidx.activity.ComponentActivity | ||||||
| import androidx.activity.compose.setContent | import androidx.activity.compose.setContent | ||||||
| import androidx.activity.enableEdgeToEdge | import androidx.activity.enableEdgeToEdge | ||||||
| import androidx.compose.foundation.layout.Arrangement | import androidx.compose.foundation.layout.Arrangement | ||||||
| import androidx.compose.foundation.layout.Column | import androidx.compose.foundation.layout.Column | ||||||
|  | import androidx.compose.foundation.layout.PaddingValues | ||||||
| import androidx.compose.foundation.layout.Row | import androidx.compose.foundation.layout.Row | ||||||
| import androidx.compose.foundation.layout.fillMaxSize | import androidx.compose.foundation.layout.fillMaxSize | ||||||
|  | import androidx.compose.foundation.layout.fillMaxWidth | ||||||
| import androidx.compose.foundation.layout.padding | import androidx.compose.foundation.layout.padding | ||||||
| import androidx.compose.foundation.layout.size | import androidx.compose.foundation.layout.size | ||||||
|  | import androidx.compose.foundation.layout.width | ||||||
|  | import androidx.compose.foundation.shape.CircleShape | ||||||
| import androidx.compose.material.icons.Icons | import androidx.compose.material.icons.Icons | ||||||
|  | import androidx.compose.material.icons.outlined.AcUnit | ||||||
|  | import androidx.compose.material.icons.outlined.Air | ||||||
|  | import androidx.compose.material.icons.outlined.ArrowDownward | ||||||
|  | import androidx.compose.material.icons.outlined.ArrowUpward | ||||||
|  | import androidx.compose.material.icons.outlined.Map | ||||||
|  | import androidx.compose.material.icons.outlined.Settings | ||||||
|  | import androidx.compose.material.icons.outlined.WaterDrop | ||||||
| import androidx.compose.material.icons.rounded.AcUnit | import androidx.compose.material.icons.rounded.AcUnit | ||||||
| import androidx.compose.material.icons.rounded.Air | import androidx.compose.material.icons.rounded.Air | ||||||
| import androidx.compose.material.icons.rounded.ArrowDownward | import androidx.compose.material.icons.rounded.ArrowDownward | ||||||
|  | @ -20,9 +33,13 @@ import androidx.compose.material.icons.rounded.KeyboardArrowDown | ||||||
| import androidx.compose.material.icons.rounded.KeyboardArrowUp | import androidx.compose.material.icons.rounded.KeyboardArrowUp | ||||||
| import androidx.compose.material.icons.rounded.LocationOn | import androidx.compose.material.icons.rounded.LocationOn | ||||||
| import androidx.compose.material.icons.rounded.Map | import androidx.compose.material.icons.rounded.Map | ||||||
|  | import androidx.compose.material.icons.rounded.Settings | ||||||
| import androidx.compose.material.icons.rounded.WaterDrop | import androidx.compose.material.icons.rounded.WaterDrop | ||||||
| import androidx.compose.material.icons.sharp.KeyboardArrowDown | import androidx.compose.material.icons.sharp.KeyboardArrowDown | ||||||
| import androidx.compose.material.icons.twotone.AccountCircle | import androidx.compose.material.icons.twotone.AccountCircle | ||||||
|  | import androidx.compose.material3.Button | ||||||
|  | import androidx.compose.material3.ButtonColors | ||||||
|  | import androidx.compose.material3.ButtonDefaults | ||||||
| import androidx.compose.material3.Icon | import androidx.compose.material3.Icon | ||||||
| import androidx.compose.material3.Scaffold | import androidx.compose.material3.Scaffold | ||||||
| import androidx.compose.material3.Text | import androidx.compose.material3.Text | ||||||
|  | @ -30,12 +47,24 @@ import androidx.compose.runtime.Composable | ||||||
| import androidx.compose.ui.Alignment | import androidx.compose.ui.Alignment | ||||||
| import androidx.compose.ui.Modifier | import androidx.compose.ui.Modifier | ||||||
| import androidx.compose.ui.draw.alpha | import androidx.compose.ui.draw.alpha | ||||||
|  | import androidx.compose.ui.graphics.Color | ||||||
|  | import androidx.compose.ui.graphics.RectangleShape | ||||||
|  | import androidx.compose.ui.graphics.vector.ImageVector | ||||||
|  | import androidx.compose.ui.platform.LocalContext | ||||||
| import androidx.compose.ui.text.font.FontWeight | import androidx.compose.ui.text.font.FontWeight | ||||||
| import androidx.compose.ui.tooling.preview.Preview | import androidx.compose.ui.tooling.preview.Preview | ||||||
| import androidx.compose.ui.unit.dp | import androidx.compose.ui.unit.dp | ||||||
| import androidx.compose.ui.unit.sp | import androidx.compose.ui.unit.sp | ||||||
| import com.module.breeze.ui.theme.BreezeTheme | import com.module.breeze.ui.theme.BreezeTheme | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | val fontSizeCurrentTemp = 48.sp | ||||||
|  | val fontSizeUpper = 16.sp | ||||||
|  | val fontSizeTitle = 24.sp | ||||||
|  | val breezeFontWeight = FontWeight.Bold | ||||||
|  | val iconStyle = Icons.Outlined; | ||||||
|  | val textColor = Color(0, 0, 0) | ||||||
|  | 
 | ||||||
| class MainActivity : ComponentActivity() { | class MainActivity : ComponentActivity() { | ||||||
|     override fun onCreate(savedInstanceState: Bundle?) { |     override fun onCreate(savedInstanceState: Bundle?) { | ||||||
|         super.onCreate(savedInstanceState) |         super.onCreate(savedInstanceState) | ||||||
|  | @ -54,15 +83,18 @@ class MainActivity : ComponentActivity() { | ||||||
| 
 | 
 | ||||||
| @Composable | @Composable | ||||||
| fun WeatherInfo(modifier: Modifier = Modifier) { | fun WeatherInfo(modifier: Modifier = Modifier) { | ||||||
|     val fontSizeCurrentTemp = 48.sp |     val ctx = LocalContext.current | ||||||
|     val fontSizeUpper = 16.sp | 
 | ||||||
|     val breezeFontWeight = FontWeight.Bold |  | ||||||
|     val iconStyle = Icons.Rounded; |  | ||||||
| 
 | 
 | ||||||
|     var displayRain = false; |     var displayRain = false; | ||||||
|     var displaySnow = false; |     var displaySnow = false; | ||||||
|     var displayWind = false; |     var displayWind = false; | ||||||
| 
 | 
 | ||||||
|  |     Navigation(iconStyle.Settings, "Settings Icon", onClick = { | ||||||
|  |         var intent = Intent(ctx, SettingsActivity::class.java) | ||||||
|  |         ctx.startActivity(intent) | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|     Column( |     Column( | ||||||
|         modifier = Modifier.fillMaxSize(), |         modifier = Modifier.fillMaxSize(), | ||||||
|         verticalArrangement = Arrangement.Center, |         verticalArrangement = Arrangement.Center, | ||||||
|  | @ -129,3 +161,31 @@ fun GreetingPreview() { | ||||||
|         WeatherInfo() |         WeatherInfo() | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | @Composable | ||||||
|  | public fun Navigation(icon: ImageVector, iconDescription: String, onClick: () -> Unit = {}) { | ||||||
|  |     Row( | ||||||
|  |         horizontalArrangement = Arrangement.End, | ||||||
|  |         modifier = Modifier.fillMaxWidth() | ||||||
|  |     ) | ||||||
|  |     { | ||||||
|  |         Button( | ||||||
|  |             onClick = onClick, | ||||||
|  |             colors = ButtonDefaults.buttonColors( | ||||||
|  |                 containerColor = Color(255, 0, 0, 0), | ||||||
|  |                 contentColor = textColor | ||||||
|  |             ), | ||||||
|  |             shape = CircleShape, | ||||||
|  |             contentPadding = PaddingValues(0.dp), | ||||||
|  |             modifier = Modifier | ||||||
|  |                 .padding(0.dp, 40.dp, 28.dp, 0.dp) | ||||||
|  |         ) { | ||||||
|  |             Icon( | ||||||
|  |                 imageVector = icon, | ||||||
|  |                 contentDescription = iconDescription, | ||||||
|  |                 modifier = Modifier | ||||||
|  |                     .size(40.dp) | ||||||
|  |             ) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -0,0 +1,47 @@ | ||||||
|  | package com.module.breeze | ||||||
|  | 
 | ||||||
|  | import android.os.Bundle | ||||||
|  | import androidx.activity.ComponentActivity | ||||||
|  | import androidx.activity.compose.setContent | ||||||
|  | import androidx.activity.enableEdgeToEdge | ||||||
|  | import androidx.compose.foundation.layout.fillMaxSize | ||||||
|  | import androidx.compose.foundation.layout.padding | ||||||
|  | import androidx.compose.material3.Scaffold | ||||||
|  | import androidx.compose.material3.Text | ||||||
|  | import androidx.compose.runtime.Composable | ||||||
|  | import androidx.compose.ui.Modifier | ||||||
|  | import androidx.compose.ui.tooling.preview.Preview | ||||||
|  | import com.module.breeze.ui.theme.BreezeTheme | ||||||
|  | 
 | ||||||
|  | class SettingsActivity : ComponentActivity() { | ||||||
|  |     override fun onCreate(savedInstanceState: Bundle?) { | ||||||
|  |         super.onCreate(savedInstanceState) | ||||||
|  |         enableEdgeToEdge() | ||||||
|  |         setContent { | ||||||
|  |             BreezeTheme { | ||||||
|  |                 Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> | ||||||
|  |                     Greeting( | ||||||
|  |                         name = "Android", | ||||||
|  |                         modifier = Modifier.padding(innerPadding) | ||||||
|  |                     ) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @Composable | ||||||
|  | fun Greeting(name: String, modifier: Modifier = Modifier) { | ||||||
|  |     Text( | ||||||
|  |         text = "Hello $name!", | ||||||
|  |         modifier = modifier | ||||||
|  |     ) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @Preview(showBackground = true) | ||||||
|  | @Composable | ||||||
|  | fun GreetingPreview2() { | ||||||
|  |     BreezeTheme { | ||||||
|  |         Greeting("Android") | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue