Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="#FFFFFF" android:pathData="M16,14v3H8v-7c0,-2.21 1.79,-4 4,-4c0.85,0 1.64,0.26 2.28,0.72l1.43,-1.43c-0.64,-0.51 -1.39,-0.88 -2.21,-1.09V3.5C13.5,2.67 12.83,2 12,2s-1.5,0.67 -1.5,1.5v0.7C7.91,4.86 6,7.21 6,10v7H4v2h16v-2h-2v-3H16zM12,22c1.1,0 2,-0.9 2,-2h-4C10,21.1 10.9,22 12,22zM24,8h-3V5h-2v3h-3v2h3v3h2v-3h3V8z"/>

</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="#FFFFFF" android:pathData="M7.58,4.08L6.15,2.65C3.75,4.48 2.17,7.3 2.03,10.5h2c0.15,-2.65 1.51,-4.97 3.55,-6.42zM19.97,10.5h2c-0.15,-3.2 -1.73,-6.02 -4.12,-7.85l-1.42,1.43c2.02,1.45 3.39,3.77 3.54,6.42zM18,11c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2v-5zM12,22c0.14,0 0.27,-0.01 0.4,-0.04 0.65,-0.14 1.18,-0.58 1.44,-1.18 0.1,-0.24 0.15,-0.5 0.15,-0.78h-4c0.01,1.1 0.9,2 2.01,2z"/>

</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="#FFFFFF" android:pathData="M10,20h4c0,1.1 -0.9,2 -2,2S10,21.1 10,20zM14,9c0,2.61 1.67,4.83 4,5.66L18,17h2v2H4v-2h2v-7c0,-2.79 1.91,-5.14 4.5,-5.8V3.5C10.5,2.67 11.17,2 12,2s1.5,0.67 1.5,1.5v0.7c0.71,0.18 1.36,0.49 1.95,0.9C14.54,6.14 14,7.51 14,9zM24,8h-3V5h-2v3h-3v2h3v3h2v-3h3V8z"/>

</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="#FFFFFF" android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM18,16v-5c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.64,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM16,17L8,17v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5v6z"/>

</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun HomeScreenRoot(
innerPadding: PaddingValues,
onSettingClick: () -> Unit = {},
) {
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
val state by viewModel.state.collectAsStateWithLifecycle()
val keyboardController = LocalSoftwareKeyboardController.current

Expand Down Expand Up @@ -69,8 +69,7 @@ fun HomeScreenRoot(
HomeScreen(
modifier = Modifier
.fillMaxWidth()
.padding(innerPadding)
.verticalScroll(rememberScrollState()),
.padding(innerPadding),
state = state,
onAction = { action ->
viewModel.onAction(action)
Expand All @@ -87,12 +86,11 @@ private fun HomeScreen(
onAction: (HomeAction) -> Unit = {}
) {
Column(modifier = modifier) {
UpcomingContestCardMostRecent()
ContestHorizontalPager(
onAction = {
onAction(it)
},
state = state
state = state,
)
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.onedroid.greedycoder.app.presentation.home.components

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -19,12 +19,10 @@ import androidx.compose.runtime.LaunchedEffect
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.text.font.FontWeight
import androidx.compose.ui.unit.dp
import org.onedroid.greedycoder.app.presentation.home.HomeAction
import org.onedroid.greedycoder.app.presentation.home.HomeState
import org.onedroid.greedycoder.core.theme.extraSmall
import org.onedroid.greedycoder.core.theme.small

@Composable
fun ContestHorizontalPager(
Expand All @@ -39,13 +37,18 @@ fun ContestHorizontalPager(
onAction(HomeAction.OnTabSelected(pagerState.currentPage))
}
Column(
modifier = Modifier.fillMaxWidth().padding(16.dp),
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
) {
TabRow(
modifier = Modifier
.padding(horizontal = extraSmall)
.clip(RoundedCornerShape(8.dp))
.padding(horizontal = 16.dp, vertical = 8.dp)
.clip(RoundedCornerShape(12.dp))
.border(
1.dp,
MaterialTheme.colorScheme.outline.copy(alpha = 0.1f),
RoundedCornerShape(12.dp)
)
.fillMaxWidth(),
selectedTabIndex = state.selectedTabIndex,
containerColor = MaterialTheme.colorScheme.surfaceContainer,
Expand Down Expand Up @@ -74,7 +77,8 @@ fun ContestHorizontalPager(
.align(Alignment.Center)
.padding(vertical = 12.dp),
text = "Upcoming",
style = MaterialTheme.typography.labelLarge
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Bold
)
}
}
Expand All @@ -101,27 +105,24 @@ fun ContestHorizontalPager(
.align(Alignment.Center)
.padding(vertical = 12.dp),
text = "Completed",
style = MaterialTheme.typography.labelLarge
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Bold
)
}
}
}

HorizontalPager(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.padding().fillMaxWidth(),
state = pagerState
) { pageIndex ->
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
when (pageIndex) {
0 -> {
Text(text = "Upcoming")
}
1 -> {
Text(text = "Completed")
}
when (pageIndex) {
0 -> {
UpComingContestList()
}

1 -> {
Text(text = "Completed")
}
}
}
Expand Down
Loading
Loading