144 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Kotlin
		
	
	
	
	
	
			
		
		
	
	
			144 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Kotlin
		
	
	
	
	
	
package com.example.namecard
 | 
						|
 | 
						|
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.example.namecard.ui.theme.NameCardTheme
 | 
						|
import androidx.compose.material3.MaterialTheme
 | 
						|
import androidx.compose.material3.Surface
 | 
						|
import androidx.compose.ui.unit.sp
 | 
						|
import androidx.compose.foundation.layout.Column
 | 
						|
import androidx.compose.foundation.layout.Arrangement
 | 
						|
import androidx.compose.ui.text.style.TextAlign
 | 
						|
import androidx.compose.ui.unit.dp
 | 
						|
import androidx.compose.ui.Alignment
 | 
						|
import androidx.compose.foundation.Image
 | 
						|
import androidx.compose.foundation.layout.Box
 | 
						|
import androidx.compose.ui.res.painterResource
 | 
						|
import androidx.compose.foundation.layout.Row
 | 
						|
import androidx.compose.foundation.layout.Spacer
 | 
						|
import androidx.compose.foundation.layout.height
 | 
						|
import androidx.compose.foundation.layout.width
 | 
						|
import androidx.compose.foundation.layout.size
 | 
						|
import androidx.compose.ui.text.font.FontWeight
 | 
						|
import androidx.compose.ui.layout.ContentScale
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
class MainActivity : ComponentActivity() {
 | 
						|
    override fun onCreate(savedInstanceState: Bundle?) {
 | 
						|
        super.onCreate(savedInstanceState)
 | 
						|
        setContent {
 | 
						|
            NameCardTheme {
 | 
						|
                Surface(
 | 
						|
                    modifier = Modifier.fillMaxSize(),
 | 
						|
                    color = MaterialTheme.colorScheme.background
 | 
						|
                ) {
 | 
						|
                    BusinessCard()
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
@Composable
 | 
						|
fun BusinessCard(modifier: Modifier = Modifier) {
 | 
						|
    val image = painterResource(R.drawable.ariq)
 | 
						|
    val background = painterResource(R.drawable.background)
 | 
						|
 | 
						|
    Image(
 | 
						|
        painter = background,
 | 
						|
        contentDescription = null,
 | 
						|
        contentScale = ContentScale.Crop,
 | 
						|
        modifier = Modifier.fillMaxSize()
 | 
						|
    )
 | 
						|
 | 
						|
    Column(
 | 
						|
        modifier = modifier.fillMaxSize(),
 | 
						|
        verticalArrangement = Arrangement.Center,
 | 
						|
        horizontalAlignment = Alignment.CenterHorizontally
 | 
						|
    ) {
 | 
						|
        Image(
 | 
						|
            painter = image,
 | 
						|
            contentDescription = null,
 | 
						|
            modifier = Modifier.size(150.dp)
 | 
						|
        )
 | 
						|
        Spacer(modifier = Modifier.height(16.dp))
 | 
						|
        Text(
 | 
						|
            text = "Raihan Ariq Muzakki",
 | 
						|
            fontSize = 32.sp,
 | 
						|
            fontWeight = FontWeight.Bold
 | 
						|
        )
 | 
						|
        Text(
 | 
						|
            text = "Data Scientist",
 | 
						|
            fontSize = 24.sp
 | 
						|
        )
 | 
						|
        Spacer(modifier = Modifier.height(100.dp))
 | 
						|
        ContactInfo()
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
@Composable
 | 
						|
fun ContactInfo(modifier: Modifier = Modifier) {
 | 
						|
    val icon_telp = painterResource(R.drawable.telepon)
 | 
						|
    val icon_insta = painterResource(R.drawable.instagram)
 | 
						|
    val icon_mail = painterResource(R.drawable.mail)
 | 
						|
 | 
						|
    Column(modifier = modifier) {
 | 
						|
        Row(verticalAlignment = Alignment.CenterVertically) {
 | 
						|
            Image(
 | 
						|
                painter = icon_telp,
 | 
						|
                contentDescription = null,
 | 
						|
                modifier = Modifier.size(24.dp)
 | 
						|
            )
 | 
						|
            Spacer(modifier = Modifier.width(16.dp))
 | 
						|
            Text(
 | 
						|
                text = "+62 (859) 3024 6632",
 | 
						|
                fontSize = 18.sp
 | 
						|
            )
 | 
						|
        }
 | 
						|
        Spacer(modifier = Modifier.height(8.dp))
 | 
						|
        Row(verticalAlignment = Alignment.CenterVertically) {
 | 
						|
            Image(
 | 
						|
                painter = icon_insta,
 | 
						|
                contentDescription = null,
 | 
						|
                modifier = Modifier.size(24.dp)
 | 
						|
            )
 | 
						|
            Spacer(modifier = Modifier.width(16.dp))
 | 
						|
            Text(
 | 
						|
                text = "@aaarique",
 | 
						|
                fontSize = 18.sp
 | 
						|
            )
 | 
						|
        }
 | 
						|
        Spacer(modifier = Modifier.height(8.dp))
 | 
						|
        Row(verticalAlignment = Alignment.CenterVertically) {
 | 
						|
            Image(
 | 
						|
                painter = icon_mail,
 | 
						|
                contentDescription = null,
 | 
						|
                modifier = Modifier.size(24.dp)
 | 
						|
            )
 | 
						|
            Spacer(modifier = Modifier.width(16.dp))
 | 
						|
            Text(
 | 
						|
                text = "raihanariq-work395@gmail.com",
 | 
						|
                fontSize = 18.sp
 | 
						|
            )
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
@Preview(showBackground = true)
 | 
						|
@Composable
 | 
						|
fun BusinessCardPreview() {
 | 
						|
    NameCardTheme {
 | 
						|
        BusinessCard()
 | 
						|
    }
 | 
						|
} |