Skip to content

Commit

Permalink
Merge pull request #43 from kookmin-sw/milestone/#2
Browse files Browse the repository at this point in the history
Milestone/#2
  • Loading branch information
J-Yong99 authored Mar 31, 2024
2 parents 99dfe96 + 5b470dd commit e68ee24
Show file tree
Hide file tree
Showing 181 changed files with 6,247 additions and 1,423 deletions.
11 changes: 9 additions & 2 deletions Android/moment-android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,21 @@ android {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}


}

dependencies {

dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2")
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.compose.material3:material3-android:1.2.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down Expand Up @@ -102,4 +104,9 @@ dependencies {
val hilt_version = "2.44"
implementation("com.google.dagger:hilt-android:$hilt_version")
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")

implementation("io.woong.compose.grid:grid:1.2.2")

// swipe 구현을 위한 라이
implementation("androidx.compose.foundation:foundation:1.6.0-alpha04")
}
8 changes: 7 additions & 1 deletion Android/moment-android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:theme="@style/Theme.Application"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".ui.SplashActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Application">
Expand All @@ -23,6 +23,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".MainActivity"/>
<activity android:name=".ui.OnboardingActivity"/>
<activity android:name=".ui.PostTripActivity"/>
<activity android:name=".ui.CardActivity"/>
<activity android:name=".ui.TripFileActivity"/>
</application>

</manifest>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.capstone.android.application.app.composable

import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.TextFieldDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusDirection
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.graphics.toColorInt
import com.capstone.android.application.ui.theme.HintText
import com.capstone.android.application.ui.theme.PretendardFamily
import com.capstone.android.application.ui.theme.black
import com.capstone.android.application.ui.theme.neutral_100
import com.capstone.android.application.ui.theme.tertiary_500

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BottomSheetRecord(sheetState: SheetState, onClicked:() -> Unit,onDismiss:() -> Unit){
val scope = rememberCoroutineScope()
ModalBottomSheet(
sheetState = sheetState,
onDismissRequest = onDismiss
) {
// LazyColumn(
// modifier = Modifier.padding(bottom = WindowInsets.navigationBars.getBottom(LocalDensity.current).dp/2) ,
// horizontalAlignment = Alignment.CenterHorizontally
// ){
// item {
// Text(
// color = Color("#4992FF".toColorInt()),
// text = "녹음",
// fontSize = 20.sp,
// fontWeight = FontWeight.Bold
// )
// Spacer(modifier = Modifier.height(4.dp))
// }
//
// }
}
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun MomentTextField(
hint: String, onValueChanged: (String) -> Unit, onClicked: (Boolean) -> Unit, text: MutableState<String>,
keyboardType: KeyboardType = KeyboardType.Text, changecolor:Color,
focusRequester: FocusRequester, move: String, focusManager: FocusManager
){
//move
/* manyfirstmove 는 여러개 있는 상황에서 next를 사용해야할 경우 request가 필요
manynextmove 는 여러개 있는 상황에서 next를 사용해야할 경우 request가 안필요
manyendmove 는 여러개 있는 상황에서 clear를 사용해야할 경우 request가 안필요
onemove 는 하나 있는 상황이라 clear를 사용하며 request가 필요*/
//textclick
BasicTextField(
keyboardOptions = KeyboardOptions(keyboardType = keyboardType),
maxLines = 1,
value = if(text.value.length>20) text.value.removeRange(10,text.value.length) else text.value,
onValueChange = onValueChanged,
singleLine = true,
textStyle = TextStyle(
color = black,
fontFamily = PretendardFamily,
fontWeight = FontWeight.Medium,
fontSize = 18.sp),
keyboardActions = KeyboardActions(onDone = {
if(move =="manyfirstmove" || move == "manynextmove") focusManager.moveFocus(
FocusDirection.Next)
else focusManager.clearFocus()
}),
modifier = if(move == "manyfirstmove" || move == "onemove") Modifier
.fillMaxWidth()
.background(
color = tertiary_500
)
.padding(horizontal = 8.dp)
.focusRequester(focusRequester)
.clickable { Log.d("tjgus", "MomentTextField: tjgus") }
else Modifier
.fillMaxWidth()
.background(
color = tertiary_500
)
.padding(horizontal = 8.dp)
.clickable { Log.d("tjgus", "MomentTextField: tjgus") }

){
Row(){
TextFieldDefaults.TextFieldDecorationBox(
value = /*if(text.value.length>20) text.value.removeRange(10,text.value.length) else */text.value,
visualTransformation = VisualTransformation.None,
innerTextField = it,
singleLine = true,
enabled = true,
// same interaction source as the one passed to BasicTextField to read focus state
// for text field styling
placeholder = { if (text.value.isNotEmpty()) HintText(content = "") else HintText(hint) },
colors = TextFieldDefaults.textFieldColors(
textColor = black
),
interactionSource = remember { MutableInteractionSource() },
// keep vertical paddings but change the horizontal
contentPadding = TextFieldDefaults.textFieldWithoutLabelPadding(
start = 0.dp, top = 1.dp, end = 1.dp, bottom = 3.dp
)
)
}
}
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.capstone.android.application.app.screen

import com.capstone.android.application.R

sealed class BottomNavItem(
val title: Int,val screenRoute: String, val label:String,val selectedDrawableId:Int , val unselectedDrawableId:Int
) {
object Home : BottomNavItem(title = 0 , screenRoute = "Home",label = "", selectedDrawableId = R.drawable.ic_nav_home_black, unselectedDrawableId = R.drawable.ic_nav_home_grey)
object Receipt : BottomNavItem(title = 1 , screenRoute = "Receipt",label = "영수증",selectedDrawableId = R.drawable.ic_nav_receipt_black, unselectedDrawableId = R.drawable.ic_nav_receipt_grey)
object Record : BottomNavItem(title = 2 , screenRoute = "Record",label = "녹음",selectedDrawableId = 0, unselectedDrawableId = 0)
object Favorite : BottomNavItem(title = 3 , screenRoute = "Favorite",label = "즐겨찾기",selectedDrawableId = R.drawable.ic_nav_heart_black, unselectedDrawableId = R.drawable.ic_nav_heart_grey)
object Setting : BottomNavItem(title = 4 , screenRoute = "Setting",label = "세팅",selectedDrawableId = R.drawable.ic_nav_setting_black, unselectedDrawableId = R.drawable.ic_nav_setting_grey)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.capstone.android.application.app.screen

sealed class MainScreen(
val title: Int,val screenRoute: String,val rootRoute:String , val label:String
){

object ReceiptPost : MainScreen(title = 5, screenRoute = "ReceiptPost", rootRoute = "Receipt", label = "영수증 만들기")
object ReceiptCardChoice : MainScreen(title = 6, screenRoute = "ReceiptCardChoice", rootRoute = "Receipt", label = "카드 선택")
object HomeTrip : MainScreen(title = 7, screenRoute = "HomeTrip", rootRoute = "Home" ,label = "홈 여행")
object RecordDaily : MainScreen(title = 8, screenRoute = "RecordDaily", rootRoute = "Home", label = "일상기록")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.capstone.android.application.ui

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController

class CardActivity:ComponentActivity() {
lateinit var navController: NavHostController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent{
navController = rememberNavController()
Column(
modifier = Modifier.fillMaxSize()
) {
Text(
modifier = Modifier.clickable {
navController.navigate("detail")
},
text = "카드뷰"
)

NavHost(
navController,
startDestination = "main",
) {
composable("detail"){
cardDetail()
}

}
}
}

}

@Composable
fun cardDetail(){
Column(
modifier = Modifier.fillMaxSize()
) {
Text(text = "카드뷰 상세")
}
}
}
Loading

0 comments on commit e68ee24

Please sign in to comment.