51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Kotlin
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Kotlin
		
	
	
	
	
	
package com.example.indris_tugas2
 | 
						|
 | 
						|
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.Surface
 | 
						|
import androidx.compose.material3.Text
 | 
						|
import androidx.compose.runtime.Composable
 | 
						|
import androidx.compose.ui.Modifier
 | 
						|
import androidx.compose.ui.graphics.Color
 | 
						|
import androidx.compose.ui.tooling.preview.Preview
 | 
						|
import com.example.indris_tugas2.ui.theme.IndrisTugas2Theme
 | 
						|
 | 
						|
class MainActivity : ComponentActivity() {
 | 
						|
    override fun onCreate(savedInstanceState: Bundle?) {
 | 
						|
        super.onCreate(savedInstanceState)
 | 
						|
        enableEdgeToEdge()
 | 
						|
        setContent {
 | 
						|
            IndrisTugas2Theme {
 | 
						|
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
 | 
						|
                    Greeting(
 | 
						|
                        name = "Android",
 | 
						|
                        modifier = Modifier.padding(innerPadding)
 | 
						|
                    )
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
@Composable
 | 
						|
fun Greeting(name: String, modifier: Modifier = Modifier) {
 | 
						|
    Surface(color =Color.Cyan) {
 | 
						|
        Text(
 | 
						|
            text = "Hello $name!",
 | 
						|
            modifier = modifier
 | 
						|
        )
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
@Preview(showBackground = true)
 | 
						|
@Composable
 | 
						|
fun GreetingPreview() {
 | 
						|
    IndrisTugas2Theme {
 | 
						|
        Greeting("Android")
 | 
						|
    }
 | 
						|
} |