parent
ced1012f43
commit
2a71427dfb
@ -0,0 +1,43 @@ |
||||
package com.frank.ffmpeg.activity |
||||
|
||||
import android.os.Bundle |
||||
import androidx.activity.ComponentActivity |
||||
import androidx.activity.compose.setContent |
||||
import androidx.compose.foundation.layout.fillMaxSize |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.Surface |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.tooling.preview.Preview |
||||
import com.frank.ffmpeg.activity.ui.theme.FFmpegAndroidTheme |
||||
|
||||
class ComposeActivity : ComponentActivity() { |
||||
override fun onCreate(savedInstanceState: Bundle?) { |
||||
super.onCreate(savedInstanceState) |
||||
setContent { |
||||
FFmpegAndroidTheme { |
||||
// A surface container using the 'background' color from the theme |
||||
Surface( |
||||
modifier = Modifier.fillMaxSize(), |
||||
color = MaterialTheme.colors.background |
||||
) { |
||||
Greeting("Android") |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Composable |
||||
fun Greeting(name: String) { |
||||
Text(text = "Hello $name!") |
||||
} |
||||
|
||||
@Preview(showBackground = true) |
||||
@Composable |
||||
fun DefaultPreview() { |
||||
FFmpegAndroidTheme { |
||||
Greeting("Android") |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
package com.frank.ffmpeg.activity.ui.theme |
||||
|
||||
import androidx.compose.ui.graphics.Color |
||||
|
||||
val Purple200 = Color(0xFFBB86FC) |
||||
val Purple500 = Color(0xFF6200EE) |
||||
val Purple700 = Color(0xFF3700B3) |
||||
val Teal200 = Color(0xFF03DAC5) |
@ -0,0 +1,11 @@ |
||||
package com.frank.ffmpeg.activity.ui.theme |
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape |
||||
import androidx.compose.material.Shapes |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
val Shapes = Shapes( |
||||
small = RoundedCornerShape(4.dp), |
||||
medium = RoundedCornerShape(4.dp), |
||||
large = RoundedCornerShape(0.dp) |
||||
) |
@ -0,0 +1,47 @@ |
||||
package com.frank.ffmpeg.activity.ui.theme |
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.darkColors |
||||
import androidx.compose.material.lightColors |
||||
import androidx.compose.runtime.Composable |
||||
|
||||
private val DarkColorPalette = darkColors( |
||||
primary = Purple200, |
||||
primaryVariant = Purple700, |
||||
secondary = Teal200 |
||||
) |
||||
|
||||
private val LightColorPalette = lightColors( |
||||
primary = Purple500, |
||||
primaryVariant = Purple700, |
||||
secondary = Teal200 |
||||
|
||||
/* Other default colors to override |
||||
background = Color.White, |
||||
surface = Color.White, |
||||
onPrimary = Color.White, |
||||
onSecondary = Color.Black, |
||||
onBackground = Color.Black, |
||||
onSurface = Color.Black, |
||||
*/ |
||||
) |
||||
|
||||
@Composable |
||||
fun FFmpegAndroidTheme( |
||||
darkTheme: Boolean = isSystemInDarkTheme(), |
||||
content: @Composable () -> Unit |
||||
) { |
||||
val colors = if (darkTheme) { |
||||
DarkColorPalette |
||||
} else { |
||||
LightColorPalette |
||||
} |
||||
|
||||
MaterialTheme( |
||||
colors = colors, |
||||
typography = Typography, |
||||
shapes = Shapes, |
||||
content = content |
||||
) |
||||
} |
@ -0,0 +1,28 @@ |
||||
package com.frank.ffmpeg.activity.ui.theme |
||||
|
||||
import androidx.compose.material.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( |
||||
body1 = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 16.sp |
||||
) |
||||
/* Other default text styles to override |
||||
button = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.W500, |
||||
fontSize = 14.sp |
||||
), |
||||
caption = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 12.sp |
||||
) |
||||
*/ |
||||
) |
Loading…
Reference in new issue