Skip to content

Commit

Permalink
fix ci cd
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin2dehury committed Dec 6, 2023
1 parent 55742a8 commit 8e751dd
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 62 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/GenerateApk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:

steps:
- name: Checkout the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Set up Gradle with Cache
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3

- name: Generate Release Apk
run: ./gradlew assembleRelease --scan
Expand Down
15 changes: 14 additions & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/render.experimental.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package github.sachin2dehury.myanimelistcompose.presentation
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 androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
Expand All @@ -24,27 +20,22 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
setContent {
MyAnimeListComposeTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = "paginated",
) {
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = "paginated",
composable("paginated") {
PaginatedScreen(navController = navController)
}
composable(
"detail/{id}",
arguments = listOf(navArgument("id") { type = NavType.IntType }),
) {
composable("paginated") {
PaginatedScreen(navController = navController)
}
composable(
"detail/{id}",
arguments = listOf(navArgument("id") { type = NavType.IntType })
) {
DetailScreen(id = it.arguments?.getInt("id").orZero())
}
DetailScreen(id = it.arguments?.getInt("id").orZero())
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package github.sachin2dehury.myanimelistcompose.presentation.paginated

import androidx.compose.ui.graphics.Color

data class ItemColor(
val dominantBgColor: Color = Color.Transparent,
val mutedBgColor: Color = Color.Transparent,
val dominantTextColor: Color = Color.Transparent,
val mutedTextColor: Color = Color.Transparent,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package github.sachin2dehury.myanimelistcompose.presentation.paginated

import android.graphics.Bitmap
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -21,6 +20,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextAlign
Expand All @@ -33,29 +33,22 @@ import github.sachin2dehury.myanimelistcompose.domain.orZero

@Composable
fun PaginatedItem(modifier: Modifier = Modifier, data: PaginatedModel, callback: () -> Unit) {
var dominantBgColor by remember {
mutableStateOf(Color.Transparent)
}
var mutedBgColor by remember {
mutableStateOf(Color.Transparent)
}
var dominantTextColor by remember {
mutableStateOf(Color.Transparent)
}
var mutedTextColor by remember {
mutableStateOf(Color.Transparent)
var itemColor by remember {
mutableStateOf(ItemColor())
}
Column(
modifier = modifier
.fillMaxSize()
.clip(RoundedCornerShape(16.dp))
.background(mutedBgColor)
.drawBehind {
drawRect(itemColor.mutedBgColor)
}
.clickable {
callback.invoke()
}
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
horizontalAlignment = Alignment.CenterHorizontally,
) {
AsyncImage(
model = data.images,
Expand All @@ -67,61 +60,64 @@ fun PaginatedItem(modifier: Modifier = Modifier, data: PaginatedModel, callback:
val palette =
Palette.from(it.result.drawable.toBitmap().copy(Bitmap.Config.ARGB_8888, true))
.generate()
dominantBgColor = Color(palette.dominantSwatch?.rgb.orZero())
mutedBgColor = Color(palette.mutedSwatch?.rgb.orZero())
dominantTextColor = Color(palette.dominantSwatch?.bodyTextColor.orZero())
mutedTextColor = Color(palette.mutedSwatch?.bodyTextColor.orZero())
val dominantBgColor = Color(palette.dominantSwatch?.rgb.orZero())
val mutedBgColor = Color(palette.mutedSwatch?.rgb.orZero())
val dominantTextColor = Color(palette.dominantSwatch?.bodyTextColor.orZero())
val mutedTextColor = Color(palette.mutedSwatch?.bodyTextColor.orZero())
itemColor = ItemColor(dominantBgColor, mutedBgColor, dominantTextColor, mutedTextColor)
},
contentScale = ContentScale.Crop
contentScale = ContentScale.Crop,
)
Text(
text = data.titleEnglish.ifEmpty { data.title }.trim(),
style = MaterialTheme.typography.titleMedium,
color = mutedTextColor,
textAlign = TextAlign.Center
color = itemColor.mutedTextColor,
textAlign = TextAlign.Center,
)

Text(
modifier = Modifier
.background(dominantBgColor),
.drawBehind {
drawRect(itemColor.dominantBgColor)
},
text = data.titleJapanese.trim(),
style = MaterialTheme.typography.titleMedium,
color = dominantTextColor,
textAlign = TextAlign.Center
color = itemColor.dominantTextColor,
textAlign = TextAlign.Center,
)

Row(
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text = "Rating: ${data.score}",
style = MaterialTheme.typography.labelLarge,
color = mutedTextColor
color = itemColor.mutedTextColor,
)
Text(
text = "Rank: ${data.rank}",
style = MaterialTheme.typography.labelLarge,
color = mutedTextColor
color = itemColor.mutedTextColor,
)
}

Row(
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text = "Episodes: ${data.episodes}",
style = MaterialTheme.typography.labelLarge,
color = mutedTextColor
color = itemColor.mutedTextColor,
)
Text(
text = data.duration,
style = MaterialTheme.typography.labelLarge,
color = mutedTextColor
color = itemColor.mutedTextColor,
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavHostController
import androidx.paging.LoadState
import androidx.paging.compose.collectAsLazyPagingItems
import github.sachin2dehury.myanimelistcompose.domain.orZero
import github.sachin2dehury.myanimelistcompose.presentation.ErrorSection

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
Expand All @@ -30,14 +31,16 @@ import github.sachin2dehury.myanimelistcompose.presentation.ErrorSection
fun PaginatedScreen(
modifier: Modifier = Modifier,
viewModel: PaginatedViewModel = hiltViewModel(),
navController: NavHostController
navController: NavHostController,
) {
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
Scaffold(modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
Scaffold(
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
val query = viewModel.state.collectAsState().value.query.orEmpty()
SearchSection(query = query, viewModel = viewModel, scrollBehavior = scrollBehavior)
}) { paddingValues ->
},
) { paddingValues ->

val state = viewModel.state.collectAsState().value
val pagingState = viewModel.pager.collectAsLazyPagingItems()
Expand All @@ -53,7 +56,6 @@ fun PaginatedScreen(
verticalItemSpacing = 8.dp,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {

item(span = StaggeredGridItemSpan.FullLine) {
if (itemCount > 0) {
FilterSection(state = state, viewModel = viewModel)
Expand Down

0 comments on commit 8e751dd

Please sign in to comment.