-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
680dc9f
commit ba335b8
Showing
28 changed files
with
201 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
app/src/main/java/siarhei/luskanau/managed/virtual/device/FirstFragment.kt
This file was deleted.
Oops, something went wrong.
86 changes: 38 additions & 48 deletions
86
app/src/main/java/siarhei/luskanau/managed/virtual/device/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,49 @@ | ||
@file:Suppress("FunctionNaming") | ||
|
||
package siarhei.luskanau.managed.virtual.device | ||
|
||
import android.os.Bundle | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.view.WindowCompat | ||
import androidx.navigation.findNavController | ||
import androidx.navigation.ui.AppBarConfiguration | ||
import androidx.navigation.ui.navigateUp | ||
import androidx.navigation.ui.setupActionBarWithNavController | ||
import com.google.android.material.snackbar.Snackbar | ||
import siarhei.luskanau.managed.virtual.device.databinding.ActivityMainBinding | ||
|
||
class MainActivity : AppCompatActivity() { | ||
private lateinit var appBarConfiguration: AppBarConfiguration | ||
private lateinit var binding: ActivityMainBinding | ||
|
||
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 siarhei.luskanau.managed.virtual.device.ui.theme.MyApplicationTheme | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
WindowCompat.setDecorFitsSystemWindows(window, false) | ||
super.onCreate(savedInstanceState) | ||
|
||
binding = ActivityMainBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
setSupportActionBar(binding.toolbar) | ||
|
||
val navController = findNavController(R.id.nav_host_fragment_content_main) | ||
appBarConfiguration = AppBarConfiguration(navController.graph) | ||
setupActionBarWithNavController(navController, appBarConfiguration) | ||
|
||
binding.fab.setOnClickListener { view -> | ||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||
.setAnchorView(R.id.fab) | ||
.setAction("Action", null).show() | ||
enableEdgeToEdge() | ||
setContent { | ||
MyApplicationTheme { | ||
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> | ||
Greeting( | ||
name = "Android", | ||
modifier = Modifier.padding(innerPadding) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
menuInflater.inflate(R.menu.menu_main, menu) | ||
return true | ||
} | ||
|
||
override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
return when (item.itemId) { | ||
R.id.action_settings -> true | ||
else -> super.onOptionsItemSelected(item) | ||
} | ||
} | ||
@Composable | ||
fun Greeting(name: String, modifier: Modifier = Modifier) { | ||
Text( | ||
text = "Hello $name!", | ||
modifier = modifier | ||
) | ||
} | ||
|
||
override fun onSupportNavigateUp(): Boolean { | ||
val navController = findNavController(R.id.nav_host_fragment_content_main) | ||
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||
@Preview(showBackground = true) | ||
@Composable | ||
fun GreetingPreview() { | ||
MyApplicationTheme { | ||
Greeting("Android") | ||
} | ||
} |
42 changes: 0 additions & 42 deletions
42
app/src/main/java/siarhei/luskanau/managed/virtual/device/SecondFragment.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
app/src/main/java/siarhei/luskanau/managed/virtual/device/ui/theme/Color.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@file:Suppress("MagicNumber") | ||
|
||
package siarhei.luskanau.managed.virtual.device.ui.theme | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
val Purple80 = Color(0xFFD0BCFF) | ||
val PurpleGrey80 = Color(0xFFCCC2DC) | ||
val Pink80 = Color(0xFFEFB8C8) | ||
|
||
val Purple40 = Color(0xFF6650a4) | ||
val PurpleGrey40 = Color(0xFF625b71) | ||
val Pink40 = Color(0xFF7D5260) |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/siarhei/luskanau/managed/virtual/device/ui/theme/Theme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@file:Suppress("FunctionNaming") | ||
|
||
package siarhei.luskanau.managed.virtual.device.ui.theme | ||
|
||
import android.os.Build | ||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.darkColorScheme | ||
import androidx.compose.material3.dynamicDarkColorScheme | ||
import androidx.compose.material3.dynamicLightColorScheme | ||
import androidx.compose.material3.lightColorScheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.LocalContext | ||
|
||
private val DarkColorScheme = darkColorScheme( | ||
primary = Purple80, | ||
secondary = PurpleGrey80, | ||
tertiary = Pink80 | ||
) | ||
|
||
private val LightColorScheme = lightColorScheme( | ||
primary = Purple40, | ||
secondary = PurpleGrey40, | ||
tertiary = Pink40 | ||
|
||
/* Other default colors to override | ||
background = Color(0xFFFFFBFE), | ||
surface = Color(0xFFFFFBFE), | ||
onPrimary = Color.White, | ||
onSecondary = Color.White, | ||
onTertiary = Color.White, | ||
onBackground = Color(0xFF1C1B1F), | ||
onSurface = Color(0xFF1C1B1F), | ||
*/ | ||
) | ||
|
||
@Composable | ||
fun MyApplicationTheme( | ||
darkTheme: Boolean = isSystemInDarkTheme(), | ||
// Dynamic color is available on Android 12+ | ||
dynamicColor: Boolean = true, | ||
content: @Composable () -> Unit | ||
) { | ||
val colorScheme = when { | ||
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { | ||
val context = LocalContext.current | ||
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) | ||
} | ||
|
||
darkTheme -> DarkColorScheme | ||
else -> LightColorScheme | ||
} | ||
|
||
MaterialTheme( | ||
colorScheme = colorScheme, | ||
typography = Typography, | ||
content = content | ||
) | ||
} |
34 changes: 34 additions & 0 deletions
34
app/src/main/java/siarhei/luskanau/managed/virtual/device/ui/theme/Type.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package siarhei.luskanau.managed.virtual.device.ui.theme | ||
|
||
import androidx.compose.material3.Typography | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
|
||
// Set of Material typography styles to start with | ||
val Typography = Typography( | ||
bodyLarge = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp, | ||
lineHeight = 24.sp, | ||
letterSpacing = 0.5.sp | ||
) | ||
/* Other default text styles to override | ||
titleLarge = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 22.sp, | ||
lineHeight = 28.sp, | ||
letterSpacing = 0.sp | ||
), | ||
labelSmall = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Medium, | ||
fontSize = 11.sp, | ||
lineHeight = 16.sp, | ||
letterSpacing = 0.5.sp | ||
) | ||
*/ | ||
) |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.