Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/#113] news탭 compose setting #114

Merged
merged 7 commits into from
Nov 23, 2024
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,9 @@
package com.teamwable.designsystem.extension.composable

import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.vectorResource

@Composable
fun toImageVector(@DrawableRes id: Int): ImageVector = ImageVector.vectorResource(id = id)
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.remember
import androidx.compose.runtime.staticCompositionLocalOf
import com.teamwable.designsystem.extension.system.SetLightNavigationBar
import com.teamwable.designsystem.extension.system.SetStatusBarColor

private val LocalWableColors = staticCompositionLocalOf<WableColors> {
error("No WableColors provided")
Expand Down Expand Up @@ -59,8 +57,6 @@ fun WableTheme(
) {
val colors = wableLightColors()
val typography = wableTypography()
SetStatusBarColor(color = colors.white)
SetLightNavigationBar()
ProvideWableColorsAndTypography(colors, typography) {
MaterialTheme(
content = content, colorScheme = lightColorScheme(colors),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import com.teamwable.common.di.MAIN
import com.teamwable.common.intentprovider.IntentProvider
import com.teamwable.designsystem.extension.system.SetLightNavigationBar
import com.teamwable.designsystem.extension.system.SetStatusBarColor
import com.teamwable.designsystem.theme.WableTheme
import com.teamwable.designsystem.theme.WableTheme.colors
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

Expand All @@ -24,6 +27,8 @@ class MainComposeActivity : ComponentActivity() {
setContent {
WableTheme {
val navigator: MainNavigator = rememberMainNavigator()
SetStatusBarColor(color = colors.white)
SetLightNavigationBar()
MainScreen(
navigator = navigator,
intentProvider = intentProvider,
Expand Down
4 changes: 1 addition & 3 deletions feature/news/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
plugins {
id("com.teamwable.wable.feature")
id("com.teamwable.wable.test")
id("com.teamwable.wable.compose.feature")
}
android {
namespace = "com.teamwable.news"
}

dependencies {
implementation(project(":core:ui"))
implementation(project(":core:common"))
implementation(project(":core:model"))
implementation(project(":core:data"))

// AndroidX
implementation(libs.fragment.ktx)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.teamwable.news.model

data class NewsInfoModel(
val newsId: Int,
val newsTitle: String,
val newsText: String,
val newsImage: String,
val time: String,
)
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package com.teamwable.news.news

import androidx.compose.ui.platform.ViewCompositionStrategy
import com.teamwable.designsystem.theme.WableTheme
import com.teamwable.news.databinding.FragmentNewsNewsBinding
import com.teamwable.ui.base.BindingFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class NewsNewsFragment : BindingFragment<FragmentNewsNewsBinding>(FragmentNewsNewsBinding::inflate) {
override fun initView() {

binding.composeView.apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
WableTheme {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.teamwable.news.news

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.teamwable.designsystem.theme.WableTheme

@Composable
fun NewsNewsRoute() {
}

@Composable
fun NewsNewsScreen(){

}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
WableTheme {
NewsNewsScreen()
}
}
8 changes: 4 additions & 4 deletions feature/news/src/main/res/layout/fragment_news_news.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="news"
<androidx.compose.ui.platform.ComposeView
android:id="@+id/compose_view"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import com.teamwable.model.profile.MemberInfoEditModel
import com.teamwable.onboarding.R
import com.teamwable.onboarding.firstlckwatch.component.WableExposedDropdownBox
import com.teamwable.onboarding.firstlckwatch.model.FirstLckWatchSideEffect
import kotlinx.collections.immutable.toPersistentList
import kotlinx.collections.immutable.toImmutableList

@Composable
fun FirstLckWatchRoute(
Expand Down Expand Up @@ -70,7 +70,7 @@ fun FirstLckWatchScreen(
) {
SetStatusBarColor(color = WableTheme.colors.white)

val options = (2012..2024).toPersistentList()
val options = (2012..2024).toImmutableList()

var expanded by remember { mutableStateOf(false) }
var selectedIndex by rememberSaveable { mutableIntStateOf(options.lastIndex) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import androidx.compose.ui.unit.dp
import com.teamwable.designsystem.component.card.WableCustomCardWithStroke
import com.teamwable.designsystem.extension.modifier.noRippleClickable
import com.teamwable.designsystem.theme.WableTheme
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf

@Composable
fun WableExposedDropdownBox(
options: PersistentList<Int>,
options: ImmutableList<Int>,
expanded: Boolean = false,
selectedIndex: Int = 0,
listState: LazyListState,
Expand Down Expand Up @@ -80,7 +80,10 @@ fun WableExposedDropdownBox(
contentPadding = PaddingValues(vertical = 4.dp),
modifier = Modifier.fillMaxWidth(),
) {
itemsIndexed(options) { index, year ->
itemsIndexed(
items = options,
key = { _, year -> year },
) { index, year ->
LckYearDropdownItem(
year = year.toString(),
onClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -125,7 +125,10 @@ fun SelectLckTeamScreen(
horizontalArrangement = Arrangement.spacedBy(10.dp),
modifier = Modifier.padding(top = 18.dp),
) {
itemsIndexed(shuffledTeams) { index, team ->
items(
items = shuffledTeams,
key = { team -> team.teamName },
) { team ->
// 팀이 선택된 상태인지 확인
val isSelected = team == selectedTeam
LckTeamItem(
Expand Down