Skip to content

Commit

Permalink
-New Resource Impl & Platform Enhancement (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhubaibKhan4 committed Mar 28, 2024
1 parent a224afb commit 8f8ea20
Show file tree
Hide file tree
Showing 31 changed files with 151 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -81,7 +82,9 @@ fun SearchChannelItem(
.size(75.dp)
.clip(shape = CircleShape),
onLoading = {
CircularProgressIndicator(it)
CircularProgressIndicator(
progress = { it },
)
},
onFailure = {
Text(text = "Failed to Load Image")
Expand Down Expand Up @@ -146,7 +149,7 @@ fun SearchChannelItem(
Icon(imageVector = Icons.Default.MoreVert, contentDescription = null)
}
}
Divider(
HorizontalDivider(
modifier = Modifier.fillMaxWidth(),
thickness = 1.dp,
color = Color.LightGray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Comment
import androidx.compose.material.icons.filled.Comment
import androidx.compose.material.icons.filled.IosShare
import androidx.compose.material.icons.filled.MoreVert
Expand Down Expand Up @@ -176,7 +177,7 @@ fun ChannelCommunityItems(videos: Item, channelImage: String) {
)
Spacer(modifier = Modifier.width(8.dp))
Icon(
imageVector = Icons.Default.Comment,
imageVector = Icons.AutoMirrored.Filled.Comment,
contentDescription = "Comments",
modifier = Modifier.size(20.dp),
tint = if (isDark) Color.White else Color.Gray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ fun FeatureChannelItems(channel: org.company.app.domain.model.channel.Item) {
Text(text = "Failed to Load Image")
},
onLoading = {
CircularProgressIndicator(progress = it, modifier = Modifier.size(200.dp))
CircularProgressIndicator(
progress = { it },
modifier = Modifier.size(200.dp),
)
},
animationSpec = tween()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
import androidx.compose.material.icons.automirrored.outlined.PlaylistAddCheck
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material.icons.filled.MoreVert
Expand Down Expand Up @@ -135,7 +137,9 @@ fun ChannelHomeItems(videos: org.company.app.domain.model.videos.Item) {
Text("Failed to Load Image")
},
onLoading = {
CircularProgressIndicator(progress = it)
CircularProgressIndicator(
progress = { it },
)
},
animationSpec = tween()
)
Expand Down Expand Up @@ -208,7 +212,7 @@ fun ChannelHomeItems(videos: org.company.app.domain.model.videos.Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand All @@ -220,7 +224,7 @@ fun ChannelHomeItems(videos: org.company.app.domain.model.videos.Item) {
color = if (isDark) Color.White else Color.Black
)
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAddCheck,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAddCheck,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down Expand Up @@ -251,7 +255,7 @@ fun ChannelHomeItems(videos: org.company.app.domain.model.videos.Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
import androidx.compose.material.icons.automirrored.outlined.PlaylistAddCheck
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.PlaylistAdd
Expand Down Expand Up @@ -99,7 +101,7 @@ fun ChannelLiveStreamItems(videos: Item) {
contentAlignment = Alignment.BottomEnd
) {
val image: Resource<Painter> =
asyncPainterResource(data = videos.snippet?.thumbnails?.high?.url.toString())
asyncPainterResource(data = videos.snippet.thumbnails.high.url)
KamelImage(
resource = image,
contentDescription = "Thumbnail",
Expand All @@ -116,7 +118,9 @@ fun ChannelLiveStreamItems(videos: Item) {
Text("Failed to Load Image")
},
onLoading = {
CircularProgressIndicator(progress = it)
CircularProgressIndicator(
progress = { it },
)
},
animationSpec = tween()
)
Expand Down Expand Up @@ -192,7 +196,7 @@ fun ChannelLiveStreamItems(videos: Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand All @@ -204,7 +208,7 @@ fun ChannelLiveStreamItems(videos: Item) {
color = if (isDark) Color.White else Color.Black
)
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAddCheck,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAddCheck,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down Expand Up @@ -235,7 +239,7 @@ fun ChannelLiveStreamItems(videos: Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.FeaturedPlayList
import androidx.compose.material.icons.automirrored.filled.Sort
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
import androidx.compose.material.icons.automirrored.outlined.PlaylistAddCheck
import androidx.compose.material.icons.filled.FeaturedPlayList
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.MoreVert
Expand Down Expand Up @@ -71,7 +75,7 @@ fun ChannelPlaylists(
item {
Row {
Icon(
imageVector = Icons.Default.Sort, contentDescription = null,
imageVector = Icons.AutoMirrored.Filled.Sort, contentDescription = null,
tint = if (isDark) Color.White else Color.Black
)
Text(
Expand Down Expand Up @@ -129,7 +133,9 @@ fun ChannelPlaylistsItems(videos: org.company.app.domain.model.videos.Item) {
Text("Failed to Load Image")
},
onLoading = {
CircularProgressIndicator(progress = it)
CircularProgressIndicator(
progress = { it },
)
},
animationSpec = tween()
)
Expand All @@ -152,7 +158,7 @@ fun ChannelPlaylistsItems(videos: org.company.app.domain.model.videos.Item) {
horizontalArrangement = Arrangement.Center
) {
Icon(
imageVector = Icons.Default.FeaturedPlayList,
imageVector = Icons.AutoMirrored.Filled.FeaturedPlayList,
contentDescription = "Playlists",
tint = if (isDark) Color.White else Color.Black
)
Expand Down Expand Up @@ -235,7 +241,7 @@ fun ChannelPlaylistsItems(videos: org.company.app.domain.model.videos.Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand All @@ -247,7 +253,7 @@ fun ChannelPlaylistsItems(videos: org.company.app.domain.model.videos.Item) {
color =if (isDark) Color.White else Color.Black
)
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAddCheck,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAddCheck,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down Expand Up @@ -278,7 +284,7 @@ fun ChannelPlaylistsItems(videos: org.company.app.domain.model.videos.Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
import androidx.compose.material.icons.automirrored.outlined.PlaylistAddCheck
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.PlaylistAdd
Expand Down Expand Up @@ -124,7 +126,9 @@ fun ChannelVideosItems(videos: Item) {
Text("Failed to Load Image")
},
onLoading = {
CircularProgressIndicator(progress = it)
CircularProgressIndicator(
progress = { it },
)
},
animationSpec = tween()
)
Expand Down Expand Up @@ -214,7 +218,7 @@ fun ChannelVideosItems(videos: Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand All @@ -226,7 +230,7 @@ fun ChannelVideosItems(videos: Item) {
color = if (isDark) Color.White else Color.Black
)
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAddCheck,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAddCheck,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down Expand Up @@ -257,7 +261,7 @@ fun ChannelVideosItems(videos: Item) {
verticalAlignment = Alignment.CenterVertically
) {
androidx.compose.material3.Icon(
imageVector = Icons.Outlined.PlaylistAdd,
imageVector = Icons.AutoMirrored.Outlined.PlaylistAdd,
contentDescription = "Time",
tint = if (isDark) Color.White else Color.Black
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Comment
import androidx.compose.material.icons.filled.PinDrop
import androidx.compose.material.icons.filled.Verified
import androidx.compose.material.icons.outlined.Comment
Expand Down Expand Up @@ -284,7 +285,7 @@ fun CommentItems(comments: Item, viewModel: MainViewModel = koinInject<MainViewM
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
Icon(
imageVector = Icons.Outlined.Comment,
imageVector = Icons.AutoMirrored.Outlined.Comment,
contentDescription = "Comment",
tint = if (isDark) Color.White else Color.Gray,
modifier = Modifier.size(18.dp)
Expand Down Expand Up @@ -344,8 +345,10 @@ fun CommentItemWithReplies(commentItem: Item) {
.clip(CircleShape),
onLoading = {
CircularProgressIndicator(
progress = {
it
},
modifier = Modifier.size(35.dp),
progress = it
)
},
onFailure = {
Expand Down Expand Up @@ -460,7 +463,7 @@ fun CommentItemWithReplies(commentItem: Item) {
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
Icon(
imageVector = Icons.Outlined.Comment,
imageVector = Icons.AutoMirrored.Outlined.Comment,
contentDescription = "Comment",
tint = if (isDark) Color.White else Color.Gray,
modifier = Modifier.size(18.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import org.company.app.theme.LocalThemeIsDark
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource
import youtube_clone.composeapp.generated.resources.Res
import youtube_clone.composeapp.generated.resources.no_internet

@OptIn(ExperimentalResourceApi::class)
@Composable
Expand All @@ -41,7 +44,7 @@ fun NoInternet() {
horizontalAlignment = Alignment.CenterHorizontally
) {
Image(
painter = painterResource("no_internet.webp"),
painter = painterResource(Res.drawable.no_internet),
contentDescription = "No Internet",
modifier = Modifier.size(300.dp),
contentScale = ContentScale.FillBounds
Expand Down
Loading

0 comments on commit 8f8ea20

Please sign in to comment.