64 lines
1.7 KiB
Plaintext
64 lines
1.7 KiB
Plaintext
package com.example.muhyusronamrullah
|
|
|
|
import android.os.Bundle
|
|
import androidx.activity.ComponentActivity
|
|
import androidx.activity.compose.setContent
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
import androidx.compose.material3.MaterialTheme // Import MaterialTheme
|
|
import androidx.compose.material3.Surface // Import Surface
|
|
import androidx.compose.material3.Text
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
import com.example.muhyusronamrullah.ui.theme.MuhYusronAmrullahTheme // Assuming this is your correct theme
|
|
|
|
class MainActivity : ComponentActivity() {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
setContent {
|
|
MuhYusronAmrullahTheme {
|
|
Surface(
|
|
modifier = Modifier.fillMaxSize(),
|
|
color = MaterialTheme.colorScheme.background
|
|
) {
|
|
Greeting("Android")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Composable
|
|
fun Greeting(name: String, modifier: Modifier = Modifier) {
|
|
Text(
|
|
text = "Hello $name!",
|
|
modifier = modifier
|
|
)
|
|
}
|
|
|
|
|
|
@Composable
|
|
fun PersonalizedGreeting(name: String, modifier: Modifier = Modifier) {
|
|
Text(
|
|
text = "Hi, my name is $name!",
|
|
modifier = modifier
|
|
)
|
|
}
|
|
|
|
@Preview(showBackground = true)
|
|
@Composable
|
|
fun GreetingPreview() {
|
|
MuhYusronAmrullahTheme {
|
|
Greeting("Android")
|
|
}
|
|
}
|
|
|
|
|
|
@Preview(showBackground = true)
|
|
@Composable
|
|
fun PersonalizedGreetingPreview() {
|
|
MuhYusronAmrullahTheme {
|
|
PersonalizedGreeting("Yusron") //
|
|
}
|
|
}
|