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/#62 video upload UI #138

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
Expand Up @@ -42,9 +42,9 @@ fun RecordyButton(
text = text,
shape = shape,
onClick = onClick,
backgroundColor = if (enabled) backgroundColor else RecordyTheme.colors.gray08,
backgroundColor = if (enabled) backgroundColor else RecordyTheme.colors.gray11,
rippleColor = rippleColor,
textColor = if (enabled) textColor else RecordyTheme.colors.gray06,
textColor = if (enabled) textColor else RecordyTheme.colors.gray08,
clickable = clickable,
padding = PaddingValues(15.dp),
textStyle = textStyle,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.record.designsystem.component.button

import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
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.graphics.Shape
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.record.designsystem.R
import com.record.designsystem.theme.Black
import com.record.designsystem.theme.RecordyTheme
import com.record.ui.extension.customClickable
import timber.log.Timber

@Composable
fun RecordyImgButton(
modifier: Modifier = Modifier,
text: String,
textStyle: TextStyle = RecordyTheme.typography.body2M,
shape: Shape = RoundedCornerShape(8.dp),
onClick: () -> Unit = {},
backgroundColor: Color = RecordyTheme.colors.gray10,
textColor: Color = RecordyTheme.colors.gray06,
@DrawableRes icon: Int,
) {
Box(
modifier = modifier
.fillMaxWidth()
.clip(shape)
.background(color = backgroundColor)
.border(width = 1.dp, color = backgroundColor, shape = shape)
.padding(vertical = 14.dp, horizontal = 18.dp)
.customClickable(rippleEnabled = false, onClick = { onClick() }),
) {
Image(modifier = Modifier.align(Alignment.CenterEnd).padding(end = 4.dp), painter = painterResource(id = icon), contentDescription = null)
Text(
text = text,
style = textStyle,
color = textColor,
modifier = Modifier.align(Alignment.CenterStart),
)
}
}

@Preview(showBackground = true, backgroundColor = 0xFFFFFF)
@Composable
fun RecordyImgButtonPreview() {
RecordyTheme {
RecordyTheme {
Column(
modifier = Modifier
.background(Black)
.padding(vertical = 10.dp, horizontal = 10.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
RecordyImgButton(
icon = R.drawable.ic_move_18,
text = "ํ‚ค์›Œ๋“œ",
onClick = { Timber.d("basic key word") },
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fun RecordyDialog(
Column(
modifier = Modifier
.fillMaxWidth()
.background(color = RecordyTheme.colors.gray08, shape = shape)
.background(color = RecordyTheme.colors.gray10, shape = shape)
.padding(horizontal = 16.dp)
.padding(bottom = 24.dp, top = 28.dp),
horizontalAlignment = Alignment.CenterHorizontally,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,19 @@ fun TopNavigationBar(
title: String = "",
enableGradation: Boolean = false,
) {
val gradient = Brush.verticalGradient(
colors = listOf(
if (enableGradation) Background.copy(alpha = 0f) else Background,
Background,
),
)
val gradient = Brush.verticalGradient(listOf(Color(0x339babfb), Color(0x00000000)))
Box(
modifier = if (enableGradation) {
modifier
.background(brush = Brush.verticalGradient(listOf(Color(0x339babfb), Color(0x00000000))))
.background(RecordyTheme.colors.background)
.fillMaxWidth()
.padding(
top = 45.dp,
bottom = 15.dp,
)
} else {
modifier
.background(Background)
.background(RecordyTheme.colors.background)
.fillMaxWidth()
.padding(
top = 45.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.record.designsystem.theme.Alert01
import com.record.designsystem.theme.Black
import com.record.designsystem.theme.Gray01
import com.record.designsystem.theme.Gray03
import com.record.designsystem.theme.Gray05
import com.record.designsystem.theme.Gray06
import com.record.designsystem.theme.Gray08
import com.record.designsystem.theme.Gray10
import com.record.designsystem.theme.RecordyTheme
import com.record.designsystem.theme.ViskitYellow500

Expand Down Expand Up @@ -84,7 +84,7 @@ fun RecordyBasicTextField(
if (newValue.replace(" ", "").length <= maxLength) onValueChange(newValue)
},
singleLine = maxLines == 1,
textStyle = textStyle.copy(Gray01),
textStyle = textStyle.copy(Gray05),
maxLines = if (minLines > maxLines) minLines else maxLines,
minLines = minLines,
interactionSource = interactionSource,
Expand All @@ -103,7 +103,7 @@ fun RecordyBasicTextField(
.heightIn(minHeight)
.fillMaxWidth()
.clip(shape = shape)
.background(color = Gray08)
.background(color = Gray10)
.border(
width = 1.dp,
color = borderLineColor,
Expand Down
39 changes: 39 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_alert_warning_80.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="80dp"
android:height="80dp"
android:viewportWidth="80"
android:viewportHeight="80">
<path
android:strokeWidth="1"
android:pathData="M61.886,17.031C60.294,17.624 58.593,17.946 56.83,17.946C48.132,17.946 41.107,10.204 40.427,0.506C35.946,0.388 31.426,2.117 27.772,5.713L27.611,5.872L27.386,5.855L25.298,5.704C25.298,5.704 25.298,5.704 25.298,5.704C17.004,5.106 9.643,12.126 8.648,21.869L8.625,22.089L8.447,22.22L6.371,23.752C0.104,28.378 -1.423,38.295 3.138,45.167L2.721,45.444L3.138,45.167L4.196,46.761L4.317,46.944L4.265,47.157L3.894,48.665L3.409,48.546L3.894,48.665C1.823,57.092 6.198,65.741 13.402,67.837L16.5,68.738L16.715,68.801L16.811,69.003C21.098,77.965 30.389,81.793 38.525,78.099C38.525,78.099 38.526,78.099 38.526,78.099L39.793,77.522L40,77.427L40.207,77.522L41.474,78.099L61.886,17.031ZM61.886,17.031C63.708,22.386 68.236,26.244 73.606,26.244C74.42,26.244 75.213,26.151 75.979,25.982C80.211,31.099 80.778,39.265 76.862,45.167L75.803,46.761L75.682,46.944L75.734,47.157L76.105,48.665L76.591,48.546L76.105,48.665C78.177,57.092 73.799,65.741 66.597,67.837C66.597,67.837 66.597,67.837 66.597,67.837L63.5,68.738L63.285,68.801L63.188,69.003C58.904,77.966 49.61,81.796 41.474,78.099L61.886,17.031Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="40"
android:startY="-0"
android:endX="10.196"
android:endY="108.235"
android:type="linear">
<item android:offset="0" android:color="#FFF1E150"/>
<item android:offset="0.941" android:color="#FFFFD428"/>
</gradient>
</aapt:attr>
<aapt:attr name="android:strokeColor">
<gradient
android:startX="40"
android:startY="0"
android:endX="19.216"
android:endY="97.255"
android:type="linear">
<item android:offset="0" android:color="#FFFFF6AD"/>
<item android:offset="0.958" android:color="#FFE3B644"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M40,51.892C39.081,51.892 38.311,51.604 37.689,51.028C37.068,50.453 36.757,49.74 36.757,48.889V27.868C36.757,27.017 37.068,26.304 37.689,25.728C38.311,25.153 39.081,24.865 40,24.865C40.919,24.865 41.689,25.153 42.311,25.728C42.932,26.304 43.243,27.017 43.243,27.868V48.889C43.243,49.74 42.932,50.453 42.311,51.028C41.689,51.604 40.919,51.892 40,51.892Z"
android:fillColor="#FF690B"/>
<path
android:pathData="M36.757,59.459a3.243,3.243 0,1 0,6.486 0a3.243,3.243 0,1 0,-6.486 0z"
android:fillColor="#FF690B"/>
</vector>
9 changes: 9 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_move_18.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="18"
android:viewportHeight="18">
<path
android:pathData="M7.136,13.365C6.947,13.575 6.956,13.908 7.157,14.107C7.357,14.306 7.674,14.296 7.863,14.085L12.113,9.361C12.295,9.159 12.295,8.842 12.113,8.64L7.864,3.915C7.674,3.704 7.357,3.694 7.157,3.893C6.956,4.092 6.947,4.425 7.136,4.635L11.062,9L7.136,13.365Z"
android:fillColor="#EEEEEE"/>
</vector>
9 changes: 9 additions & 0 deletions core/model/src/main/java/com/record/model/AlertInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.record.model

data class AlertInfo(
val showDialog: Boolean = false,
val title: String = "",
val subTitle: String = "",
val negativeButtonLabel: String = "",
val positiveButtonLabel: String = "",
)
6 changes: 0 additions & 6 deletions core/model/src/main/java/com/record/model/CoreData.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fun MypageRoute(
navigateToFollower: () -> Unit,
navigateToFollowing: () -> Unit,
navigateToUplaod: () -> Unit,
navigateToHome: () -> Unit,
navigateVideoHome: () -> Unit,
navigateToVideo: (VideoType, Long) -> Unit,
) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
Expand Down Expand Up @@ -109,7 +109,7 @@ fun MypageRoute(
onLoadMoreRecords = viewModel::loadMoreUserVideos,
onBookmarkClick = viewModel::bookmark,
navigateToUpload = navigateToUplaod,
navigateToHome = navigateToHome,
navigateVideoHome = navigateVideoHome,
)
}
}
Expand All @@ -124,9 +124,9 @@ fun MypageScreen(
onFollowingClick: () -> Unit,
navigateToVideo: (VideoType, Long) -> Unit,
navigateToUpload: () -> Unit,
navigateToHome: () -> Unit,
onLoadMoreRecords: () -> Unit,
onLoadMoreBookmarks: () -> Unit,
navigateVideoHome: () -> Unit,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

navigateTo ๊ฐ€ ๋ถ™๋Š”๊ฑฐ๋ž‘ navigate๋งŒ ์žˆ๋Š” ๊ฒƒ์˜ ์ฐจ์ด๋Š” ๋ญ”๊ฐ€์š”?

onBookmarkClick: (Long) -> Unit,
) {
val pagerState = rememberPagerState(
Expand Down Expand Up @@ -229,7 +229,7 @@ fun MypageScreen(
onItemClick = navigateToVideo,
onLoadMore = onLoadMoreBookmarks,
onBookmarkClick = onBookmarkClick,
navigateToHome = navigateToHome,
navigateToVideo = navigateVideoHome,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fun NavGraphBuilder.mypageNavGraph(
navigateToUpload: () -> Unit,
navigateToHome: () -> Unit,
navigateToProfile: (Long) -> Unit,
navigateVideoHome: () -> Unit,
navigateToVideo: (VideoType, Long) -> Unit,
) {
composable(route = MypageRoute.route) {
Expand All @@ -43,7 +44,7 @@ fun NavGraphBuilder.mypageNavGraph(
navigateToFollower = navigateToFollower,
navigateToVideo = navigateToVideo,
navigateToUplaod = navigateToUpload,
navigateToHome = navigateToHome,
navigateVideoHome = navigateVideoHome,
)
}
composable(route = MypageRoute.followingRoute) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun BookmarkScreen(
onItemClick: (VideoType, Long) -> Unit,
onLoadMore: () -> Unit,
onBookmarkClick: (Long) -> Unit,
navigateToHome: () -> Unit,
navigateToVideo: () -> Unit,
) {
val lazyGridState = rememberLazyGridState()
lazyGridState.OnBottomReached(2) {
Expand Down Expand Up @@ -63,7 +63,7 @@ fun BookmarkScreen(
showButton = true,
selectedTab = MypageTab.BOOKMARK,
onButtonClick = {
navigateToHome()
navigateToVideo()
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ internal class MainNavigator(
fun navigateMypage() {
navController.navigateMypage(navOptions { })
}

fun navigateToVideo() {
navController.navigateVideo(null)
}
fun navigateVideoDetail(videoType: VideoType, videoId: Long, keyword: String? = "all", userId: Long = 0) {
navController.navigateVideoDetail(
videoType = videoType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ internal fun MainScreen(
navigateToProfile = navigator::navigateProfile,
navigateToUpload = navigator::navigateToUpload,
navigateToHome = navigator::navigateHome,
navigateVideoHome = navigator::navigateToVideo,
)

settingNavGraph(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.record.upload

import com.record.designsystem.component.snackbar.SnackBarType
import com.record.model.AlertInfo
import com.record.ui.base.SideEffect
import com.record.ui.base.UiState
import com.record.upload.model.GalleryVideo
Expand All @@ -15,8 +16,7 @@ data class UploadState(
val galleryPage: Int = 1,
val isItemLoading: Boolean = false,
val video: GalleryVideo? = null,
val showShouldShowRationaleDialog: Boolean = false,
val showExitUploadDialog: Boolean = false,
val alertInfo: AlertInfo = AlertInfo(),
val isSelectedVideoSheetOpen: Boolean = false,
val isSelectedDefinedContentSheetOpen: Boolean = false,
val buttonEnabled: Boolean = false,
Expand Down
33 changes: 25 additions & 8 deletions feature/upload/src/main/java/com/record/upload/UploadViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.lifecycle.viewModelScope
import com.record.common.util.encodingString
import com.record.designsystem.component.snackbar.SnackBarType
import com.record.keyword.repository.KeywordRepository
import com.record.model.AlertInfo
import com.record.ui.base.BaseViewModel
import com.record.upload.model.GalleryVideo
import com.record.upload.model.RecordInfo
Expand Down Expand Up @@ -75,19 +76,35 @@ class UploadViewModel @Inject constructor(
}

fun showShouldShowRationaleDialog() = intent {
copy(showShouldShowRationaleDialog = true)
copy(
alertInfo = AlertInfo(
showDialog = true,
title = "ํ•„์ˆ˜ ๊ถŒํ•œ์„ ํ—ˆ์šฉํ•ด์ฃผ์„ธ์š”",
subTitle = "ํ”„๋กœํ•„ ์‚ฌ์ง„ ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•ด \n์‚ฌ์ง„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ์ ‘๊ทผํ•˜๋„๋ก ํ—ˆ์šฉํ•ด ์ฃผ์„ธ์š”.",
negativeButtonLabel = "๋‹ซ๊ธฐ",
positiveButtonLabel = "์ง€๊ธˆ ์„ค์ •",
),
)
}

fun hideShouldShowRationaleDialog() = intent {
copy(showShouldShowRationaleDialog = false)
fun hideUploadDialog() = intent {
copy(
alertInfo = AlertInfo(
showDialog = false,
),
)
}

fun showExitUploadDialog() = intent {
copy(showExitUploadDialog = true)
}

fun hideExitUploadDialog() = intent {
copy(showExitUploadDialog = false)
copy(
alertInfo = AlertInfo(
showDialog = true,
title = "ํ™”๋ฉด์„ ๋‚˜๊ฐ€์‹œ๊ฒ ์–ด์š”?",
subTitle = "์ง€๊ธˆ๊นŒ์ง€ ์ž‘์„ฑํ•˜์‹  ๋‚ด์šฉ์ด ๋ชจ๋‘ ์‚ฌ๋ผ์ ธ์š”.",
negativeButtonLabel = "์ทจ์†Œ",
positiveButtonLabel = "๋‚˜๊ฐ€๊ธฐ",
),
)
}

fun showIsSelectedVideoSheetOpen() = intent {
Expand Down
Loading