Skip to content

Commit

Permalink
Merge pull request #5 from panos1b/profile-addition
Browse files Browse the repository at this point in the history
Profile addition
  • Loading branch information
vtalos authored Dec 26, 2024
2 parents 98736ed + 3c713fa commit 9d6d6a2
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ android {
}

dependencies {
implementation("androidx.media3:media3-exoplayer:1.5.0")
implementation("androidx.media3:media3-exoplayer-dash:1.5.0")
implementation("androidx.media3:media3-ui:1.5.0")
implementation("io.coil-kt:coil-compose:2.4.0")


implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand Down
Binary file added app/src/main/assets/lilpop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/test.mp4
Binary file not shown.
200 changes: 200 additions & 0 deletions app/src/main/java/com/example/estiaseek/ui/profile/profile.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
import android.content.Intent
import android.net.Uri
import androidx.annotation.OptIn
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.Image
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import coil.compose.rememberAsyncImagePainter
import androidx.media3.common.MediaItem
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.ui.AspectRatioFrameLayout
import androidx.media3.ui.PlayerView


@OptIn(UnstableApi::class)
@Composable
fun Profile() {
val context = LocalContext.current

// Remember ExoPlayer instance
val exoPlayer = remember {
ExoPlayer.Builder(context).build().apply {
setMediaItem(MediaItem.fromUri(Uri.parse("file:///android_asset/test.mp4")))
prepare()
playWhenReady = true
volume = 0f // Mute by default
}
}

var isMuted by remember { mutableStateOf(true) } // Track mute state

// Dispose of ExoPlayer correctly
DisposableEffect(Unit) {
onDispose {
exoPlayer.release()
}
}

Column(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.background)
.verticalScroll(rememberScrollState())
) {
// Video Player Section
Box(
modifier = Modifier
.aspectRatio(16f / 9f)
.clickable {
// Toggle mute state on tap
isMuted = !isMuted
exoPlayer.volume = if (isMuted) 0f else 1f
}
) {
AndroidView(
factory = { ctx ->
PlayerView(ctx).apply {
player = exoPlayer
resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
useController = false // Hide video controls
}
},
modifier = Modifier.fillMaxSize()
)

// Profile Picture Overlay
Image(
painter = rememberAsyncImagePainter("file:///android_asset/lilpop.jpg"), // Load from assets
contentDescription = "Profile Picture",
contentScale = ContentScale.Crop,
modifier = Modifier
.align(Alignment.BottomStart)
.offset(x = 16.dp, y = 32.dp)
.size(width = 120.dp, height = 120.dp)
.clip(CircleShape)
.border(4.dp, Color.White, CircleShape)
)
}

// User Details Section
Column(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(top = 30.dp)
) {
// User Name
Text(
text = "Lil Pop",
style = MaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.Bold
)

// Location Chip
Box(
modifier = Modifier
.padding(top = 8.dp)
.background(
color = MaterialTheme.colorScheme.secondaryContainer,
shape = RoundedCornerShape(16.dp)
)
.padding(horizontal = 12.dp, vertical = 4.dp)
) {
Text(
text = "Las Vegas, NV",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSecondaryContainer
)
}

// Bio Section
Text(
text = "As a dedicated waiter with 87 years of experience in the hospitality industry, I pride myself on delivering exceptional dining experiences through top-tier customer service, attention to detail, and a positive attitude. Whether in fast-paced casual dining or upscale restaurants, I thrive in environments where I can connect with guests, anticipate their needs, and ensure every visit is memorable.",
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(top = 16.dp)
)

// Experience Section
Text(
text = "Experience:",
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(top = 16.dp)
)
Text(
text = "1. Delivered exceptional service in a fast-paced, 100+ seat restaurant, managing up to 8 tables at a time while maintaining a 98% customer satisfaction rating based on guest feedback surveys.\n" +
"2. Increased beverage sales by 20% through effective upselling techniques, menu knowledge, and personalized recommendations tailored to guest preferences.\n" +
"3. Trained and mentored a team of 5 new waitstaff, improving service efficiency and reducing order errors by 15% within the first three months.",
style = MaterialTheme.typography.bodyMedium
)

// Contact Section
Row(
modifier = Modifier
.fillMaxWidth()
.padding(top = 16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
val context = LocalContext.current

Button(
onClick = {
val intent = Intent(Intent.ACTION_DIAL).apply {
data =
Uri.parse("tel:+1234567890") // Replace with the desired phone number
}
context.startActivity(intent)
},
modifier = Modifier.weight(1f)
) {
Text("Call")
}

Button(
onClick = {
val intent = Intent(Intent.ACTION_SENDTO).apply {
data =
Uri.parse("mailto:[email protected]") // Replace with the desired email address
}
context.startActivity(intent)
},
modifier = Modifier.weight(1f)
) {
Text("Email")
}

}
}
}

// Dispose of ExoPlayer when the composable is disposed
DisposableEffect(exoPlayer) {
onDispose {
exoPlayer.release()
}
}
}

@Preview
@Composable
fun PreviewProfile() {
Profile()
}

0 comments on commit 9d6d6a2

Please sign in to comment.