diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/deviceManager.xml b/.idea/deviceManager.xml new file mode 100644 index 0000000..91f9558 --- /dev/null +++ b/.idea/deviceManager.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..02c4aa5 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7061a0d --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,61 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b2c751a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..fdf1fc8 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/2\354\243\274\354\260\250 res/BagCircle.svg" "b/2\354\243\274\354\260\250 res/BagCircle.svg" new file mode 100644 index 0000000..48b83e8 --- /dev/null +++ "b/2\354\243\274\354\260\250 res/BagCircle.svg" @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/BagSimple.svg" "b/2\354\243\274\354\260\250 res/BagSimple.svg" new file mode 100644 index 0000000..e2ea05f --- /dev/null +++ "b/2\354\243\274\354\260\250 res/BagSimple.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/HeartStraight.svg" "b/2\354\243\274\354\260\250 res/HeartStraight.svg" new file mode 100644 index 0000000..5c4e6ad --- /dev/null +++ "b/2\354\243\274\354\260\250 res/HeartStraight.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/HouseSimple.svg" "b/2\354\243\274\354\260\250 res/HouseSimple.svg" new file mode 100644 index 0000000..02a02b6 --- /dev/null +++ "b/2\354\243\274\354\260\250 res/HouseSimple.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" "b/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" new file mode 100644 index 0000000..d8ba9fa --- /dev/null +++ "b/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/User.svg" "b/2\354\243\274\354\260\250 res/User.svg" new file mode 100644 index 0000000..b39d4ad --- /dev/null +++ "b/2\354\243\274\354\260\250 res/User.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" "b/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" new file mode 100644 index 0000000..f42aa9d Binary files /dev/null and "b/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" differ diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagCircle.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagCircle.svg" new file mode 100644 index 0000000..48b83e8 --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagCircle.svg" @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagSimple.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagSimple.svg" new file mode 100644 index 0000000..e2ea05f --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/BagSimple.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HeartStraight.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HeartStraight.svg" new file mode 100644 index 0000000..5c4e6ad --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HeartStraight.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HouseSimple.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HouseSimple.svg" new file mode 100644 index 0000000..02a02b6 --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/HouseSimple.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" new file mode 100644 index 0000000..d8ba9fa --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/User.svg" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/User.svg" new file mode 100644 index 0000000..b39d4ad --- /dev/null +++ "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/User.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" new file mode 100644 index 0000000..f42aa9d Binary files /dev/null and "b/2\354\243\274\354\260\250_res (1)/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" differ diff --git "a/MyApplication/.github/ISSUE_TEMPLATE/\342\255\220feature.md" "b/MyApplication/.github/ISSUE_TEMPLATE/\342\255\220feature.md" new file mode 100644 index 0000000..63e8059 --- /dev/null +++ "b/MyApplication/.github/ISSUE_TEMPLATE/\342\255\220feature.md" @@ -0,0 +1,19 @@ +--- +name: "⭐feature" +about: 기능추가 +title: "[Feat]" +labels: '' +assignees: '' +type: Feature + +--- + +## 📌 기능 설명 + + +## 🛠 작업 내용 +- [ ] 작업1 +- [ ] 작업2 + +## 📎 참고 자료 + diff --git "a/MyApplication/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-.md" "b/MyApplication/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-.md" new file mode 100644 index 0000000..588ada4 --- /dev/null +++ "b/MyApplication/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-.md" @@ -0,0 +1,21 @@ +--- +name: "\U0001F41E Bug " +about: 버그 수정 +title: "[Fix]" +labels: '' +assignees: '' +type: Bug + +--- + +## 🐛 문제 상황 + + +## 🔍 원인 (추정) + + +## 🛠 해결 방법 +- [ ] 수정1 +- [ ] 수정2 + +## 📸 스크린샷 diff --git a/MyApplication/.gitignore b/MyApplication/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/MyApplication/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/MyApplication/.idea/.gitignore b/MyApplication/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/MyApplication/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/MyApplication/.idea/.name b/MyApplication/.idea/.name new file mode 100644 index 0000000..b3405b3 --- /dev/null +++ b/MyApplication/.idea/.name @@ -0,0 +1 @@ +My Application \ No newline at end of file diff --git a/MyApplication/.idea/AndroidProjectSystem.xml b/MyApplication/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/MyApplication/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/compiler.xml b/MyApplication/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/MyApplication/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/deploymentTargetSelector.xml b/MyApplication/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/MyApplication/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/deviceManager.xml b/MyApplication/.idea/deviceManager.xml new file mode 100644 index 0000000..91f9558 --- /dev/null +++ b/MyApplication/.idea/deviceManager.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/gradle.xml b/MyApplication/.idea/gradle.xml new file mode 100644 index 0000000..02c4aa5 --- /dev/null +++ b/MyApplication/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/inspectionProfiles/Project_Default.xml b/MyApplication/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7061a0d --- /dev/null +++ b/MyApplication/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,61 @@ + + + + \ No newline at end of file diff --git a/MyApplication/.idea/misc.xml b/MyApplication/.idea/misc.xml new file mode 100644 index 0000000..b2c751a --- /dev/null +++ b/MyApplication/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/runConfigurations.xml b/MyApplication/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/MyApplication/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication/.idea/vcs.xml b/MyApplication/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/MyApplication/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication/README.md b/MyApplication/README.md new file mode 100644 index 0000000..2c7613b --- /dev/null +++ b/MyApplication/README.md @@ -0,0 +1,94 @@ +# 10th_Android + + +

팀원 구성

+
+ + + + + + + + + + + + + + + + +
도리/ 김도연(팀장)제로/ 정규은(팀원)레몬/ 김지아(팀원)우가/ 강수아(팀원)묵은지/ 임은지(팀원)
+
+ @kimdoyeon1234 +
+
+ @jeongkyueun +
+
+ @Lemon0610 +
+
+ @sua710 +
+
+ @mookeunji05 +
+ +
+ +### Git 작업 순서 + +본인의 브랜치에서만 작업하고, `main` 브랜치는 직접 수정하지 않습니다. + +#### 1. 현재 브랜치 확인 +```sh +git branch +``` + +#### 2. 변경 사항 확인 +```sh +git status +``` + +#### 3. 변경된 파일 추가 +```sh +git add . +``` + +#### 4. 커밋 메시지 작성 +```sh +git commit -m "Commit Message" +``` + +#### 5. 원격 저장소에 본인 브랜치로 푸시 +```sh +git push origin <브랜치명> +``` + +### Commit Convention + +커밋 메시지는 `타입: n주차 미션 설명`의 형식을 갖추어 작성합니다. + +| 타입 | 설명 | +|-----------|--------------------------------| +| feat | 새로운 기능 추가 | +| fix | 버그 수정 | +| refactor | 코드 리팩토링 | +| docs | 문서 수정 (README 등) | +| style | 코드 스타일 변경 (세미콜론 추가 등)| +| chore | 빌드 및 패키지 설정 변경 | +| test | 테스트 코드 추가 | + +#### Commit Example +```sh +git commit -m "feat: 1주차 미션 화면 전환 기능" +git commit -m "fix: 5주차 미션 API 응답 오류 수정" +``` + +### PR Convention + +- Pull Request(PR)은 미션 별로 생성합니다. +- PR 제목은 `n주차 미션` 형식으로 작성합니다. +- 파트장이 승인한 후, main 브랜치로 Merge 합니다. diff --git a/MyApplication/app/.gitignore b/MyApplication/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/MyApplication/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/MyApplication/app/build.gradle.kts b/MyApplication/app/build.gradle.kts new file mode 100644 index 0000000..0552495 --- /dev/null +++ b/MyApplication/app/build.gradle.kts @@ -0,0 +1,60 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.compose) +} + +android { + namespace = "com.example.myapplication" + compileSdk { + version = release(36) { + minorApiLevel = 1 + } + } + + defaultConfig { + applicationId = "com.example.myapplication" + minSdk = 24 + targetSdk = 36 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + buildFeatures { + compose = true + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.material3) + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + debugImplementation(libs.androidx.compose.ui.tooling) + debugImplementation(libs.androidx.compose.ui.test.manifest) +} \ No newline at end of file diff --git a/MyApplication/app/proguard-rules.pro b/MyApplication/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/MyApplication/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt b/MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..e9283cf --- /dev/null +++ b/MyApplication/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.myapplication + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.myapplication", appContext.packageName) + } +} \ No newline at end of file diff --git a/MyApplication/app/src/main/AndroidManifest.xml b/MyApplication/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9451a84 --- /dev/null +++ b/MyApplication/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.kt b/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.kt new file mode 100644 index 0000000..886c8d3 --- /dev/null +++ b/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.kt @@ -0,0 +1,83 @@ +package com.example.myapplication + +import android.graphics.Color +import android.os.Bundle +import android.widget.ImageButton +import android.widget.LinearLayout +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity + +class MainActivity : AppCompatActivity() { + + lateinit var textHappy: TextView + lateinit var textExcited: TextView + lateinit var textNormal: TextView + lateinit var textAnxious: TextView + lateinit var textAngry: TextView + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_emotion_select) + + val btnBack = findViewById(R.id.btnBack) + + val itemHappy = findViewById(R.id.itemHappy) + val itemExcited = findViewById(R.id.itemExcited) + val itemNormal = findViewById(R.id.itemNormal) + val itemAnxious = findViewById(R.id.itemAnxious) + val itemAngry = findViewById(R.id.itemAngry) + + textHappy = findViewById(R.id.textHappy) + textExcited = findViewById(R.id.textExcited) + textNormal = findViewById(R.id.textNormal) + textAnxious = findViewById(R.id.textAnxious) + textAngry = findViewById(R.id.textAngry) + + btnBack.setOnClickListener { + finish() + } + + itemHappy.setOnClickListener { + resetTextColor() + textHappy.setTextColor(Color.parseColor("#FF9800")) + showEmotion("행복") + } + + itemExcited.setOnClickListener { + resetTextColor() + textExcited.setTextColor(Color.parseColor("#2196F3")) + showEmotion("흥분") + } + + itemNormal.setOnClickListener { + resetTextColor() + textNormal.setTextColor(Color.parseColor("#9E9E9E")) + showEmotion("평범") + } + + itemAnxious.setOnClickListener { + resetTextColor() + textAnxious.setTextColor(Color.parseColor("#4CAF50")) + showEmotion("불안") + } + + itemAngry.setOnClickListener { + resetTextColor() + textAngry.setTextColor(Color.parseColor("#F44336")) + showEmotion("화남") + } + } + + private fun resetTextColor() { + textHappy.setTextColor(Color.BLACK) + textExcited.setTextColor(Color.BLACK) + textNormal.setTextColor(Color.BLACK) + textAnxious.setTextColor(Color.BLACK) + textAngry.setTextColor(Color.BLACK) + } + + private fun showEmotion(emotion: String) { + Toast.makeText(this, "선택한 감정: $emotion", Toast.LENGTH_SHORT).show() + } +} \ No newline at end of file diff --git a/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Color.kt b/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Color.kt new file mode 100644 index 0000000..1ce3e5d --- /dev/null +++ b/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.myapplication.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Theme.kt b/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Theme.kt new file mode 100644 index 0000000..174f73f --- /dev/null +++ b/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.example.myapplication.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun MyApplicationTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Type.kt b/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Type.kt new file mode 100644 index 0000000..64846a0 --- /dev/null +++ b/MyApplication/app/src/main/java/com/example/myapplication/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.myapplication.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/MyApplication/app/src/main/res/drawable/btnback.xml b/MyApplication/app/src/main/res/drawable/btnback.xml new file mode 100644 index 0000000..af62026 --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/btnback.xml @@ -0,0 +1,9 @@ + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_emotion_angry.xml b/MyApplication/app/src/main/res/drawable/ic_emotion_angry.xml new file mode 100644 index 0000000..c6b43a2 --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_emotion_angry.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_emotion_anxious.xml b/MyApplication/app/src/main/res/drawable/ic_emotion_anxious.xml new file mode 100644 index 0000000..fe91f33 --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_emotion_anxious.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_emotion_excited.xml b/MyApplication/app/src/main/res/drawable/ic_emotion_excited.xml new file mode 100644 index 0000000..5c4b19d --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_emotion_excited.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_emotion_happy.xml b/MyApplication/app/src/main/res/drawable/ic_emotion_happy.xml new file mode 100644 index 0000000..72176da --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_emotion_happy.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_emotion_normal.xml b/MyApplication/app/src/main/res/drawable/ic_emotion_normal.xml new file mode 100644 index 0000000..9b02528 --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_emotion_normal.xml @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml b/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MyApplication/app/src/main/res/drawable/ic_launcher_foreground.xml b/MyApplication/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/MyApplication/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/layout/activity_emotion_select.xml b/MyApplication/app/src/main/res/layout/activity_emotion_select.xml new file mode 100644 index 0000000..b47ca79 --- /dev/null +++ b/MyApplication/app/src/main/res/layout/activity_emotion_select.xml @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/MyApplication/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/MyApplication/app/src/main/res/values/colors.xml b/MyApplication/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/MyApplication/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/values/strings.xml b/MyApplication/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..3de1a39 --- /dev/null +++ b/MyApplication/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + My Application + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/values/themes.xml b/MyApplication/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..3171f1e --- /dev/null +++ b/MyApplication/app/src/main/res/values/themes.xml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/xml/backup_rules.xml b/MyApplication/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..4df9255 --- /dev/null +++ b/MyApplication/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/MyApplication/app/src/main/res/xml/data_extraction_rules.xml b/MyApplication/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/MyApplication/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.kt b/MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.kt new file mode 100644 index 0000000..e500fb8 --- /dev/null +++ b/MyApplication/app/src/test/java/com/example/myapplication/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.example.myapplication + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/MyApplication/btnBack.svg b/MyApplication/btnBack.svg new file mode 100644 index 0000000..dab8b02 --- /dev/null +++ b/MyApplication/btnBack.svg @@ -0,0 +1,3 @@ + + + diff --git a/MyApplication/build.gradle.kts b/MyApplication/build.gradle.kts new file mode 100644 index 0000000..18318be --- /dev/null +++ b/MyApplication/build.gradle.kts @@ -0,0 +1,5 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.compose) apply false +} \ No newline at end of file diff --git a/MyApplication/emotion_angry.svg b/MyApplication/emotion_angry.svg new file mode 100644 index 0000000..45ef4e5 --- /dev/null +++ b/MyApplication/emotion_angry.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/MyApplication/emotion_anxious.svg b/MyApplication/emotion_anxious.svg new file mode 100644 index 0000000..b65626a --- /dev/null +++ b/MyApplication/emotion_anxious.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/MyApplication/emotion_happy.svg b/MyApplication/emotion_happy.svg new file mode 100644 index 0000000..b987bad --- /dev/null +++ b/MyApplication/emotion_happy.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/MyApplication/emotion_normal.svg b/MyApplication/emotion_normal.svg new file mode 100644 index 0000000..84ee0c6 --- /dev/null +++ b/MyApplication/emotion_normal.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/MyApplication/emtion_excited.svg b/MyApplication/emtion_excited.svg new file mode 100644 index 0000000..915d24f --- /dev/null +++ b/MyApplication/emtion_excited.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/MyApplication/gradle.properties b/MyApplication/gradle.properties new file mode 100644 index 0000000..34c5e9e --- /dev/null +++ b/MyApplication/gradle.properties @@ -0,0 +1,15 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. For more details, visit +# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects +# org.gradle.parallel=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official \ No newline at end of file diff --git a/MyApplication/gradle/gradle-daemon-jvm.properties b/MyApplication/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000..6c1139e --- /dev/null +++ b/MyApplication/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,12 @@ +#This file is generated by updateDaemonJvm +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect +toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect +toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/73bcfb608d1fde9fb62e462f834a3299/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/846ee0d876d26a26f37aa1ce8de73224/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9482ddec596298c84656d31d16652665/redirect +toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/39701d92e1756bb2f141eb67cd4c660e/redirect +toolchainVersion=21 diff --git a/MyApplication/gradle/libs.versions.toml b/MyApplication/gradle/libs.versions.toml new file mode 100644 index 0000000..38d6b4f --- /dev/null +++ b/MyApplication/gradle/libs.versions.toml @@ -0,0 +1,31 @@ +[versions] +agp = "9.1.0" +coreKtx = "1.10.1" +junit = "4.13.2" +junitVersion = "1.1.5" +espressoCore = "3.5.1" +lifecycleRuntimeKtx = "2.6.1" +activityCompose = "1.8.0" +kotlin = "2.2.10" +composeBom = "2024.09.00" + +[libraries] +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +junit = { group = "junit", name = "junit", version.ref = "junit" } +androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } +androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } + diff --git a/MyApplication/gradle/wrapper/gradle-wrapper.jar b/MyApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8bdaf60 Binary files /dev/null and b/MyApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MyApplication/gradle/wrapper/gradle-wrapper.properties b/MyApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..c3c0dbe --- /dev/null +++ b/MyApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,9 @@ +#Wed Mar 18 19:58:52 KST 2026 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06 +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/MyApplication/gradlew b/MyApplication/gradlew new file mode 100644 index 0000000..ef07e01 --- /dev/null +++ b/MyApplication/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/MyApplication/gradlew.bat b/MyApplication/gradlew.bat new file mode 100644 index 0000000..db3a6ac --- /dev/null +++ b/MyApplication/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MyApplication/pull_request_template.md b/MyApplication/pull_request_template.md new file mode 100644 index 0000000..aad16f8 --- /dev/null +++ b/MyApplication/pull_request_template.md @@ -0,0 +1,19 @@ +## 📌 PR 제목 + + +## 🔗 관련 이슈 +Closes #이슈번호 + +## ✨ 변경 사항 +- 기능1 추가 +- UI 수정 +- 버그 수정 + +## 🔍 테스트 +- [ ] 테스트 완료 +- [ ] 에러 없음 + +## 📸 스크린샷 (선택) + + +## 🚨 추가 이슈 diff --git a/MyApplication/settings.gradle.kts b/MyApplication/settings.gradle.kts new file mode 100644 index 0000000..18f8235 --- /dev/null +++ b/MyApplication/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "My Application" +include(":app") diff --git "a/Nike/.github/ISSUE_TEMPLATE/\342\255\220feature.md" "b/Nike/.github/ISSUE_TEMPLATE/\342\255\220feature.md" new file mode 100644 index 0000000..63e8059 --- /dev/null +++ "b/Nike/.github/ISSUE_TEMPLATE/\342\255\220feature.md" @@ -0,0 +1,19 @@ +--- +name: "⭐feature" +about: 기능추가 +title: "[Feat]" +labels: '' +assignees: '' +type: Feature + +--- + +## 📌 기능 설명 + + +## 🛠 작업 내용 +- [ ] 작업1 +- [ ] 작업2 + +## 📎 참고 자료 + diff --git "a/Nike/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-.md" "b/Nike/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-.md" new file mode 100644 index 0000000..588ada4 --- /dev/null +++ "b/Nike/.github/ISSUE_TEMPLATE/\360\237\220\236-bug-.md" @@ -0,0 +1,21 @@ +--- +name: "\U0001F41E Bug " +about: 버그 수정 +title: "[Fix]" +labels: '' +assignees: '' +type: Bug + +--- + +## 🐛 문제 상황 + + +## 🔍 원인 (추정) + + +## 🛠 해결 방법 +- [ ] 수정1 +- [ ] 수정2 + +## 📸 스크린샷 diff --git a/Nike/.gitignore b/Nike/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/Nike/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/Nike/.idea/AndroidProjectSystem.xml b/Nike/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/Nike/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/Nike/.idea/compiler.xml b/Nike/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/Nike/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Nike/.idea/deploymentTargetSelector.xml b/Nike/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/Nike/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/Nike/.idea/deviceManager.xml b/Nike/.idea/deviceManager.xml new file mode 100644 index 0000000..91f9558 --- /dev/null +++ b/Nike/.idea/deviceManager.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/Nike/.idea/gradle.xml b/Nike/.idea/gradle.xml new file mode 100644 index 0000000..02c4aa5 --- /dev/null +++ b/Nike/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/Nike/.idea/inspectionProfiles/Project_Default.xml b/Nike/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7061a0d --- /dev/null +++ b/Nike/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,61 @@ + + + + \ No newline at end of file diff --git a/Nike/.idea/misc.xml b/Nike/.idea/misc.xml new file mode 100644 index 0000000..b2c751a --- /dev/null +++ b/Nike/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/Nike/.idea/runConfigurations.xml b/Nike/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/Nike/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/Nike/.idea/vcs.xml b/Nike/.idea/vcs.xml new file mode 100644 index 0000000..6841f35 --- /dev/null +++ b/Nike/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/Nike/2\354\243\274\354\260\250 res/BagCircle.svg" "b/Nike/2\354\243\274\354\260\250 res/BagCircle.svg" new file mode 100644 index 0000000..48b83e8 --- /dev/null +++ "b/Nike/2\354\243\274\354\260\250 res/BagCircle.svg" @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git "a/Nike/2\354\243\274\354\260\250 res/BagSimple.svg" "b/Nike/2\354\243\274\354\260\250 res/BagSimple.svg" new file mode 100644 index 0000000..e2ea05f --- /dev/null +++ "b/Nike/2\354\243\274\354\260\250 res/BagSimple.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/Nike/2\354\243\274\354\260\250 res/HeartStraight.svg" "b/Nike/2\354\243\274\354\260\250 res/HeartStraight.svg" new file mode 100644 index 0000000..5c4e6ad --- /dev/null +++ "b/Nike/2\354\243\274\354\260\250 res/HeartStraight.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/Nike/2\354\243\274\354\260\250 res/HouseSimple.svg" "b/Nike/2\354\243\274\354\260\250 res/HouseSimple.svg" new file mode 100644 index 0000000..02a02b6 --- /dev/null +++ "b/Nike/2\354\243\274\354\260\250 res/HouseSimple.svg" @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git "a/Nike/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" "b/Nike/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" new file mode 100644 index 0000000..d8ba9fa --- /dev/null +++ "b/Nike/2\354\243\274\354\260\250 res/ListMagnifyingGlass.svg" @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git "a/Nike/2\354\243\274\354\260\250 res/User.svg" "b/Nike/2\354\243\274\354\260\250 res/User.svg" new file mode 100644 index 0000000..b39d4ad --- /dev/null +++ "b/Nike/2\354\243\274\354\260\250 res/User.svg" @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git "a/Nike/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" "b/Nike/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" new file mode 100644 index 0000000..f42aa9d Binary files /dev/null and "b/Nike/2\354\243\274\354\260\250 res/\355\231\210 \353\241\234\352\263\240.png" differ diff --git a/Nike/README.md b/Nike/README.md new file mode 100644 index 0000000..3c1d120 --- /dev/null +++ b/Nike/README.md @@ -0,0 +1,94 @@ +# 10th_Android + + +

팀원 구성

+
+ + + + + + + + + + + + + + + + +
도리/ 김도연
(파트장)
제로/ 정규은
(챌린저)
레몬/ 김지아
(챌린저)
우가/ 강수아
(챌린저)
묵은지/ 임은지
(챌린저)
+
+ @kimdoyeon1234 +
+
+ @jeongkyueun +
+
+ @Lemon0610 +
+
+ @sua710 +
+
+ @mookeunji05 +
+ +
+ +### Git 작업 순서 + +본인의 브랜치에서만 작업하고, `main` 브랜치는 직접 수정하지 않습니다. + +#### 1. 현재 브랜치 확인 +```sh +git branch +``` + +#### 2. 변경 사항 확인 +```sh +git status +``` + +#### 3. 변경된 파일 추가 +```sh +git add . +``` + +#### 4. 커밋 메시지 작성 +```sh +git commit -m "Commit Message" +``` + +#### 5. 원격 저장소에 본인 브랜치로 푸시 +```sh +git push origin <브랜치명> +``` + +### Commit Convention + +커밋 메시지는 `타입: n주차 미션 설명`의 형식을 갖추어 작성합니다. + +| 타입 | 설명 | +|-----------|--------------------------------| +| feat | 새로운 기능 추가 | +| fix | 버그 수정 | +| refactor | 코드 리팩토링 | +| docs | 문서 수정 (README 등) | +| style | 코드 스타일 변경 (세미콜론 추가 등)| +| chore | 빌드 및 패키지 설정 변경 | +| test | 테스트 코드 추가 | + +#### Commit Example +```sh +git commit -m "feat: 1주차 미션 화면 전환 기능" +git commit -m "fix: 5주차 미션 API 응답 오류 수정" +``` + +### PR Convention + +- Pull Request(PR)은 미션 별로 생성합니다. +- PR 제목은 `n주차 미션` 형식으로 작성합니다. +- 파트장이 승인한 후, main 브랜치로 Merge 합니다. diff --git a/Nike/app/.gitignore b/Nike/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/Nike/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/Nike/app/build.gradle.kts b/Nike/app/build.gradle.kts new file mode 100644 index 0000000..67fe669 --- /dev/null +++ b/Nike/app/build.gradle.kts @@ -0,0 +1,79 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.compose) +} + +android { + namespace = "com.example.nike" + compileSdk { + version = release(36) { + minorApiLevel = 1 + } + } + + defaultConfig { + applicationId = "com.example.nike" + minSdk = 24 + targetSdk = 36 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + buildFeatures { + compose = true + viewBinding = true + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.material3) + + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("androidx.activity:activity-ktx:1.9.1") + implementation("androidx.fragment:fragment-ktx:1.8.2") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + implementation("androidx.recyclerview:recyclerview:1.3.2") + implementation("androidx.viewpager2:viewpager2:1.1.0") + implementation("com.google.android.material:material:1.12.0") + + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.4") + implementation("androidx.datastore:datastore-preferences:1.1.1") + implementation("com.google.code.gson:gson:2.10.1") + implementation("com.squareup.retrofit2:retrofit:2.9.0") + implementation("com.squareup.retrofit2:converter-gson:2.9.0") + implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") + implementation("com.github.bumptech.glide:glide:4.16.0") + + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + debugImplementation(libs.androidx.compose.ui.tooling) + debugImplementation(libs.androidx.compose.ui.test.manifest) +} diff --git a/Nike/app/proguard-rules.pro b/Nike/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/Nike/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/Nike/app/src/androidTest/java/com/example/nike/ExampleInstrumentedTest.kt b/Nike/app/src/androidTest/java/com/example/nike/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..c0fa1dd --- /dev/null +++ b/Nike/app/src/androidTest/java/com/example/nike/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.nike + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.nike", appContext.packageName) + } +} \ No newline at end of file diff --git a/Nike/app/src/main/AndroidManifest.xml b/Nike/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c291941 --- /dev/null +++ b/Nike/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Nike/app/src/main/ic_home_banner-playstore.png b/Nike/app/src/main/ic_home_banner-playstore.png new file mode 100644 index 0000000..d99e965 Binary files /dev/null and b/Nike/app/src/main/ic_home_banner-playstore.png differ diff --git a/Nike/app/src/main/ic_homebanner-playstore.png b/Nike/app/src/main/ic_homebanner-playstore.png new file mode 100644 index 0000000..d99e965 Binary files /dev/null and b/Nike/app/src/main/ic_homebanner-playstore.png differ diff --git a/Nike/app/src/main/ic_main_banner-playstore.png b/Nike/app/src/main/ic_main_banner-playstore.png new file mode 100644 index 0000000..4eab898 Binary files /dev/null and b/Nike/app/src/main/ic_main_banner-playstore.png differ diff --git a/Nike/app/src/main/java/com/example/nike/MainActivity.kt b/Nike/app/src/main/java/com/example/nike/MainActivity.kt new file mode 100644 index 0000000..f7bc42c --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/MainActivity.kt @@ -0,0 +1,96 @@ +package com.example.nike + +import android.os.Bundle +import android.util.Log +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import com.example.nike.databinding.ActivityMainBinding +import com.example.nike.ui.cart.CartFragment +import com.example.nike.ui.cart.CartNavigator +import com.example.nike.ui.home.HomeFragment +import com.example.nike.ui.product.ProductDetailFragment +import com.example.nike.ui.product.ProductNavigator +import com.example.nike.ui.profile.ProfileFragment +import com.example.nike.ui.shop.ShopFragment +import com.example.nike.ui.wishlist.WishlistFragment + +class MainActivity : AppCompatActivity(), CartNavigator, ProductNavigator { + + private lateinit var binding: ActivityMainBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) + Log.d(TAG, "onCreate") + + if (savedInstanceState == null) { + binding.bottomNavigation.selectedItemId = R.id.menu_home + replaceFragment(HomeFragment()) + } + + binding.bottomNavigation.setOnItemSelectedListener { item -> + when (item.itemId) { + R.id.menu_home -> replaceFragment(HomeFragment()) + R.id.menu_shop -> replaceFragment(ShopFragment()) + R.id.menu_wishlist -> replaceFragment(WishlistFragment()) + R.id.menu_cart -> replaceFragment(CartFragment()) + R.id.menu_profile -> replaceFragment(ProfileFragment()) + else -> false + } + } + } + + override fun onStart() { + super.onStart() + Log.d(TAG, "onStart") + } + + override fun onResume() { + super.onResume() + Log.d(TAG, "onResume") + } + + override fun onPause() { + super.onPause() + Log.d(TAG, "onPause") + } + + override fun onStop() { + super.onStop() + Log.d(TAG, "onStop") + } + + override fun onDestroy() { + super.onDestroy() + Log.d(TAG, "onDestroy") + } + + override fun onRestart() { + super.onRestart() + Log.d(TAG, "onRestart") + } + + override fun goToShop() { + binding.bottomNavigation.selectedItemId = R.id.menu_shop + } + + override fun openProductDetail(productId: Int) { + supportFragmentManager.beginTransaction() + .replace(R.id.fragment_container, ProductDetailFragment.newInstance(productId)) + .addToBackStack(ProductDetailFragment.TAG) + .commit() + } + + private fun replaceFragment(fragment: Fragment): Boolean { + supportFragmentManager.popBackStack() + supportFragmentManager.beginTransaction() + .replace(R.id.fragment_container, fragment) + .commit() + return true + } + + companion object { + private const val TAG = "LIFE_QUIZ" + } +} diff --git a/Nike/app/src/main/java/com/example/nike/data/local/ProductDataStore.kt b/Nike/app/src/main/java/com/example/nike/data/local/ProductDataStore.kt new file mode 100644 index 0000000..bb18045 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/local/ProductDataStore.kt @@ -0,0 +1,66 @@ +package com.example.nike.data.local + +import android.content.Context +import androidx.datastore.preferences.core.edit +import androidx.datastore.preferences.core.stringPreferencesKey +import androidx.datastore.preferences.preferencesDataStore +import com.example.nike.data.model.Product +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.map + +private val Context.dataStore by preferencesDataStore(name = "shopping_prefs") + +class ProductDataStore(private val context: Context) { + + companion object { + private val PRODUCTS_KEY = stringPreferencesKey("products_json") + private val WISHLIST_KEY = stringPreferencesKey("wishlist_json") + private val CART_KEY = stringPreferencesKey("cart_json") + } + + private val gson = Gson() + + fun getProducts(): Flow> { + return context.dataStore.data.map { preferences -> + val json = preferences[PRODUCTS_KEY] ?: "[]" + val type = object : TypeToken>() {}.type + gson.fromJson(json, type) ?: emptyList() + } + } + + fun getWishlistIds(): Flow> { + return context.dataStore.data.map { preferences -> + val json = preferences[WISHLIST_KEY] ?: "[]" + val type = object : TypeToken>() {}.type + gson.fromJson(json, type) ?: emptyList() + } + } + + fun getCartIds(): Flow> { + return context.dataStore.data.map { preferences -> + val json = preferences[CART_KEY] ?: "[]" + val type = object : TypeToken>() {}.type + gson.fromJson(json, type) ?: emptyList() + } + } + + suspend fun saveProducts(products: List) { + context.dataStore.edit { preferences -> + preferences[PRODUCTS_KEY] = gson.toJson(products) + } + } + + suspend fun saveWishlistIds(ids: List) { + context.dataStore.edit { preferences -> + preferences[WISHLIST_KEY] = gson.toJson(ids) + } + } + + suspend fun saveCartIds(ids: List) { + context.dataStore.edit { preferences -> + preferences[CART_KEY] = gson.toJson(ids) + } + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/model/Product.kt b/Nike/app/src/main/java/com/example/nike/data/model/Product.kt new file mode 100644 index 0000000..886a127 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/model/Product.kt @@ -0,0 +1,14 @@ +package com.example.nike.data.model + +data class Product( + val id: Int, + val name: String, + val description: String = "", + val price: Int, + val imageResId: Int, + val colorCount: Int = 0, + val isBestSeller: Boolean = false, + var isLiked: Boolean = false, + val category: String = "TOP", + val isNew: Boolean = false +) \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/model/ProductDummyData.kt b/Nike/app/src/main/java/com/example/nike/data/model/ProductDummyData.kt new file mode 100644 index 0000000..cf31617 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/model/ProductDummyData.kt @@ -0,0 +1,59 @@ +package com.example.nike.data.model + +import com.example.nike.R + +object ProductDummyData { + + fun getProducts(): List { + return listOf( + Product( + id = 1, + name = "Nike Air Max", + price = 129000, + imageResId = R.drawable.nike_air_force, + category = "TOP", + isNew = true + ), + Product( + id = 2, + name = "Nike Hoodie", + price = 99000, + imageResId = R.drawable.nike_air_force, + category = "TOP", + isNew = true + ), + Product( + id = 3, + name = "Nike T-shirt", + price = 59000, + imageResId = R.drawable.nike_air_force, + category = "TOP", + isNew = false + ), + Product( + id = 4, + name = "Nike Sale Shoes", + price = 79000, + imageResId = R.drawable.nike_air_force, + category = "SALE", + isNew = false + ), + Product( + id = 5, + name = "Nike Sale Cap", + price = 35000, + imageResId = R.drawable.nike_air_force, + category = "SALE", + isNew = false + ), + Product( + id = 6, + name = "Nike Windrunner", + price = 149000, + imageResId = R.drawable.nike_air_force, + category = "TOP", + isNew = true + ) + ) + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/remote/api/AuthenticationInterceptor.kt b/Nike/app/src/main/java/com/example/nike/data/remote/api/AuthenticationInterceptor.kt new file mode 100644 index 0000000..9c701df --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/remote/api/AuthenticationInterceptor.kt @@ -0,0 +1,23 @@ +package com.example.nike.data.remote.api + +import android.util.Log +import okhttp3.Interceptor +import okhttp3.Response + +class AuthenticationInterceptor( + private val apiKeyProvider: () -> String +) : Interceptor { + + override fun intercept(chain: Interceptor.Chain): Response { + val apiKey = apiKeyProvider() + val request = chain.request().newBuilder() + .addHeader("x-api-key", apiKey) + .build() + + Log.d( + "RETROFIT", + "AuthenticationInterceptor - intercept() called / request header: ${request.headers}" + ) + return chain.proceed(request) + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/remote/api/ReqResApiClient.kt b/Nike/app/src/main/java/com/example/nike/data/remote/api/ReqResApiClient.kt new file mode 100644 index 0000000..2c60677 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/remote/api/ReqResApiClient.kt @@ -0,0 +1,35 @@ +package com.example.nike.data.remote.api + +import okhttp3.OkHttpClient +import okhttp3.logging.HttpLoggingInterceptor +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory +import java.util.concurrent.TimeUnit + +object ReqResApiClient { + private const val BASE_URL = "https://reqres.in/api/" + private const val API_KEY = "reqres_4b7b1e3a525043a4b967f4b1085f63ff" + + private val loggingInterceptor = HttpLoggingInterceptor().apply { + level = HttpLoggingInterceptor.Level.BODY + } + + private val authenticationInterceptor = AuthenticationInterceptor { + API_KEY + } + + private val okHttpClient = OkHttpClient.Builder() + .addInterceptor(authenticationInterceptor) + .addInterceptor(loggingInterceptor) + .connectTimeout(30, TimeUnit.SECONDS) + .readTimeout(30, TimeUnit.SECONDS) + .writeTimeout(30, TimeUnit.SECONDS) + .build() + + val service: ReqResService = Retrofit.Builder() + .baseUrl(BASE_URL) + .client(okHttpClient) + .addConverterFactory(GsonConverterFactory.create()) + .build() + .create(ReqResService::class.java) +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/remote/api/ReqResService.kt b/Nike/app/src/main/java/com/example/nike/data/remote/api/ReqResService.kt new file mode 100644 index 0000000..34255d8 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/remote/api/ReqResService.kt @@ -0,0 +1,21 @@ +package com.example.nike.data.remote.api + +import com.example.nike.data.remote.dto.ReqResSingleUserResponse +import com.example.nike.data.remote.dto.ReqResUserListResponse +import retrofit2.Response +import retrofit2.http.GET +import retrofit2.http.Path +import retrofit2.http.Query + +interface ReqResService { + + @GET("users/{userId}") + suspend fun getUser( + @Path("userId") userId: Int + ): Response + + @GET("users") + suspend fun getUsers( + @Query("page") page: Int = 1 + ): Response +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/remote/dto/ReqResUserDto.kt b/Nike/app/src/main/java/com/example/nike/data/remote/dto/ReqResUserDto.kt new file mode 100644 index 0000000..32d2122 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/remote/dto/ReqResUserDto.kt @@ -0,0 +1,23 @@ +package com.example.nike.data.remote.dto + +import com.google.gson.annotations.SerializedName + +data class ReqResSingleUserResponse( + @SerializedName("data") val data: ReqResUserDto +) + +data class ReqResUserListResponse( + @SerializedName("page") val page: Int, + @SerializedName("per_page") val perPage: Int, + @SerializedName("total") val total: Int, + @SerializedName("total_pages") val totalPages: Int, + @SerializedName("data") val data: List +) + +data class ReqResUserDto( + @SerializedName("id") val id: Int, + @SerializedName("email") val email: String, + @SerializedName("first_name") val firstName: String, + @SerializedName("last_name") val lastName: String, + @SerializedName("avatar") val avatar: String +) \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/data/repository/ProductRepository.kt b/Nike/app/src/main/java/com/example/nike/data/repository/ProductRepository.kt new file mode 100644 index 0000000..062055b --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/data/repository/ProductRepository.kt @@ -0,0 +1,92 @@ +package com.example.nike.data.repository + +import com.example.nike.data.local.ProductDataStore +import com.example.nike.data.model.Product +import com.example.nike.data.model.ProductDummyData +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.first + +data class ProductUiModel( + val id: Int, + val name: String, + val description: String = "", + val price: Int, + val imageResId: Int, + val colorCount: Int = 0, + val isBestSeller: Boolean = false, + var isLiked: Boolean, + val category: String, + val isNew: Boolean +) + +class ProductRepository( + private val dataStore: ProductDataStore +) { + + val allProducts: Flow> = + combine( + dataStore.getProducts(), + dataStore.getWishlistIds() + ) { products, wishlistIds -> + products.map { product -> + product.toUiModel(wishlistIds.contains(product.id)) + } + } + + suspend fun initProductsIfEmpty() { + val currentProducts = dataStore.getProducts().first() + if (currentProducts.isEmpty()) { + dataStore.saveProducts(ProductDummyData.getProducts()) + dataStore.saveWishlistIds(emptyList()) + dataStore.saveCartIds(emptyList()) + } + } + + suspend fun toggleWishlist(productId: Int) { + val currentWishlist = dataStore.getWishlistIds().first().toMutableList() + + if (currentWishlist.contains(productId)) { + currentWishlist.remove(productId) + } else { + currentWishlist.add(productId) + } + + dataStore.saveWishlistIds(currentWishlist) + } + + suspend fun addToCart(productId: Int) { + val currentCart = dataStore.getCartIds().first().toMutableList() + if (!currentCart.contains(productId)) { + currentCart.add(productId) + } + dataStore.saveCartIds(currentCart) + } + + suspend fun removeFromCart(productId: Int) { + val currentCart = dataStore.getCartIds().first().toMutableList() + currentCart.remove(productId) + dataStore.saveCartIds(currentCart) + } + + suspend fun getProductById(productId: Int): ProductUiModel? { + val products = dataStore.getProducts().first() + val wishlistIds = dataStore.getWishlistIds().first() + return products.find { it.id == productId }?.toUiModel(wishlistIds.contains(productId)) + } + + private fun Product.toUiModel(isLiked: Boolean): ProductUiModel { + return ProductUiModel( + id = id, + name = name, + description = description, + price = price, + imageResId = imageResId, + colorCount = colorCount, + isBestSeller = isBestSeller, + isLiked = isLiked, + category = category, + isNew = isNew + ) + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/cart/CartFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/cart/CartFragment.kt new file mode 100644 index 0000000..a340dd2 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/cart/CartFragment.kt @@ -0,0 +1,27 @@ +package com.example.nike.ui.cart + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import com.example.nike.R +import com.example.nike.databinding.FragmentCartBinding + +class CartFragment : Fragment(R.layout.fragment_cart) { + + private var _binding: FragmentCartBinding? = null + private val binding get() = _binding!! + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentCartBinding.bind(view) + + binding.btnOrder.setOnClickListener { + (activity as? CartNavigator)?.goToShop() + } + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/cart/CartNavigator.kt b/Nike/app/src/main/java/com/example/nike/ui/cart/CartNavigator.kt new file mode 100644 index 0000000..5e27a8c --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/cart/CartNavigator.kt @@ -0,0 +1,5 @@ +package com.example.nike.ui.cart + +interface CartNavigator { + fun goToShop() +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/common/ProductGridAdapter.kt b/Nike/app/src/main/java/com/example/nike/ui/common/ProductGridAdapter.kt new file mode 100644 index 0000000..866166f --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/common/ProductGridAdapter.kt @@ -0,0 +1,57 @@ +package com.example.nike.ui.common + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R +import com.example.nike.data.repository.ProductUiModel +import com.example.nike.databinding.ItemProductGridBinding + +class ProductGridAdapter( + private val onItemClick: (ProductUiModel) -> Unit, + private val onHeartClick: (ProductUiModel) -> Unit +) : RecyclerView.Adapter() { + + private val items = mutableListOf() + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProductViewHolder { + val binding = ItemProductGridBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return ProductViewHolder(binding) + } + + override fun onBindViewHolder(holder: ProductViewHolder, position: Int) { + holder.bind(items[position]) + } + + override fun getItemCount(): Int = items.size + + fun submitList(newItems: List) { + items.clear() + items.addAll(newItems) + notifyDataSetChanged() + } + + inner class ProductViewHolder( + private val binding: ItemProductGridBinding + ) : RecyclerView.ViewHolder(binding.root) { + + fun bind(product: ProductUiModel) { + binding.imgProduct.setImageResource(product.imageResId) + binding.tvBestSeller.visibility = if (product.isBestSeller) View.VISIBLE else View.GONE + binding.tvName.text = product.name + binding.tvDescription.text = product.description + binding.tvColorCount.text = "${product.colorCount} Colours" + binding.tvPrice.text = "US$${product.price}" + binding.imgLike.setImageResource( + if (product.isLiked) R.drawable.ic_heart_filled else R.drawable.ic_heartstraight + ) + binding.root.setOnClickListener { onItemClick(product) } + binding.imgLike.setOnClickListener { onHeartClick(product) } + } + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/home/HomeFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/home/HomeFragment.kt new file mode 100644 index 0000000..e5b7bcb --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/home/HomeFragment.kt @@ -0,0 +1,43 @@ +package com.example.nike.ui.home + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.recyclerview.widget.LinearLayoutManager +import com.example.nike.R +import com.example.nike.databinding.FragmentHomeBinding +import com.example.nike.ui.product.ProductNavigator +import com.example.nike.ui.product.ProductViewModel + +class HomeFragment : Fragment(R.layout.fragment_home) { + + private var _binding: FragmentHomeBinding? = null + private val binding get() = _binding!! + + private val viewModel: ProductViewModel by activityViewModels() + private lateinit var adapter: HomeProductAdapter + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentHomeBinding.bind(view) + + adapter = HomeProductAdapter( + onHeartClick = { product -> viewModel.toggleWishlist(product.id) }, + onItemClick = { product -> (activity as? ProductNavigator)?.openProductDetail(product.id) } + ) + + binding.rvLatestProducts.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.rvLatestProducts.adapter = adapter + + viewModel.allProducts.observe(viewLifecycleOwner) { products -> + adapter.submitList(products.filter { it.isNew }) + } + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/home/HomeProductAdapter.kt b/Nike/app/src/main/java/com/example/nike/ui/home/HomeProductAdapter.kt new file mode 100644 index 0000000..2f1046a --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/home/HomeProductAdapter.kt @@ -0,0 +1,53 @@ +package com.example.nike.ui.home + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.example.nike.R +import com.example.nike.data.repository.ProductUiModel +import com.example.nike.databinding.ItemProductBinding + +class HomeProductAdapter( + private val onHeartClick: (ProductUiModel) -> Unit, + private val onItemClick: (ProductUiModel) -> Unit +) : RecyclerView.Adapter() { + + private val items = mutableListOf() + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProductViewHolder { + val binding = ItemProductBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return ProductViewHolder(binding) + } + + override fun onBindViewHolder(holder: ProductViewHolder, position: Int) { + holder.bind(items[position]) + } + + override fun getItemCount(): Int = items.size + + fun submitList(newItems: List) { + items.clear() + items.addAll(newItems) + notifyDataSetChanged() + } + + inner class ProductViewHolder( + private val binding: ItemProductBinding + ) : RecyclerView.ViewHolder(binding.root) { + + fun bind(item: ProductUiModel) { + binding.ivProduct.setImageResource(item.imageResId) + binding.tvProductName.text = item.name + binding.tvProductPrice.text = "US$${item.price}" + binding.ivHeart.setImageResource( + if (item.isLiked) R.drawable.ic_heart_filled else R.drawable.ic_heartstraight + ) + binding.ivHeart.setOnClickListener { onHeartClick(item) } + binding.root.setOnClickListener { onItemClick(item) } + } + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/product/ProductDetailFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/product/ProductDetailFragment.kt new file mode 100644 index 0000000..b688ebc --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/product/ProductDetailFragment.kt @@ -0,0 +1,69 @@ +package com.example.nike.ui.product + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import com.example.nike.R +import com.example.nike.databinding.FragmentProductDetailBinding + +class ProductDetailFragment : Fragment(R.layout.fragment_product_detail) { + + private var _binding: FragmentProductDetailBinding? = null + private val binding get() = _binding!! + + private val viewModel: ProductViewModel by activityViewModels() + private var productId: Int = 0 + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + productId = requireArguments().getInt(ARG_PRODUCT_ID) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentProductDetailBinding.bind(view) + + binding.btnBack.setOnClickListener { + parentFragmentManager.popBackStack() + } + + binding.btnAddCart.setOnClickListener { + viewModel.addToCart(productId) + } + + binding.btnWishlist.setOnClickListener { + viewModel.toggleWishlist(productId) + } + + viewModel.allProducts.observe(viewLifecycleOwner) { products -> + products.firstOrNull { it.id == productId }?.let { product -> + binding.detailImage.setImageResource(product.imageResId) + binding.detailTitle.text = product.name + binding.detailCategory.text = product.description + binding.detailName.text = product.name + binding.detailPrice.text = "US$${product.price}" + binding.detailDescription.text = product.description + binding.btnWishlist.text = if (product.isLiked) "위시리스트 ♥" else "위시리스트 ♡" + } + } + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + companion object { + const val TAG = "ProductDetailFragment" + private const val ARG_PRODUCT_ID = "product_id" + + fun newInstance(productId: Int): ProductDetailFragment { + return ProductDetailFragment().apply { + arguments = Bundle().apply { + putInt(ARG_PRODUCT_ID, productId) + } + } + } + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/product/ProductNavigator.kt b/Nike/app/src/main/java/com/example/nike/ui/product/ProductNavigator.kt new file mode 100644 index 0000000..ab0e8e4 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/product/ProductNavigator.kt @@ -0,0 +1,5 @@ +package com.example.nike.ui.product + +interface ProductNavigator { + fun openProductDetail(productId: Int) +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/product/ProductViewModel.kt b/Nike/app/src/main/java/com/example/nike/ui/product/ProductViewModel.kt new file mode 100644 index 0000000..a5327b2 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/product/ProductViewModel.kt @@ -0,0 +1,34 @@ +package com.example.nike.ui.product + +import android.app.Application +import androidx.lifecycle.AndroidViewModel +import androidx.lifecycle.asLiveData +import androidx.lifecycle.viewModelScope +import com.example.nike.data.local.ProductDataStore +import com.example.nike.data.repository.ProductRepository +import kotlinx.coroutines.launch + +class ProductViewModel(application: Application) : AndroidViewModel(application) { + + private val repository = ProductRepository(ProductDataStore(application.applicationContext)) + + val allProducts = repository.allProducts.asLiveData() + + init { + viewModelScope.launch { + repository.initProductsIfEmpty() + } + } + + fun toggleWishlist(productId: Int) { + viewModelScope.launch { + repository.toggleWishlist(productId) + } + } + + fun addToCart(productId: Int) { + viewModelScope.launch { + repository.addToCart(productId) + } + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/profile/FollowingUserAdapter.kt b/Nike/app/src/main/java/com/example/nike/ui/profile/FollowingUserAdapter.kt new file mode 100644 index 0000000..5365aab --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/profile/FollowingUserAdapter.kt @@ -0,0 +1,51 @@ +package com.example.nike.ui.profile + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.bumptech.glide.Glide +import com.example.nike.databinding.ItemFollowingUserBinding + +class FollowingUserAdapter : ListAdapter(DIFF_CALLBACK) { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FollowingViewHolder { + val binding = ItemFollowingUserBinding.inflate( + LayoutInflater.from(parent.context), + parent, + false + ) + return FollowingViewHolder(binding) + } + + override fun onBindViewHolder(holder: FollowingViewHolder, position: Int) { + holder.bind(getItem(position)) + } + + class FollowingViewHolder( + private val binding: ItemFollowingUserBinding + ) : RecyclerView.ViewHolder(binding.root) { + + fun bind(user: ProfileUserUiModel) { + Glide.with(binding.root) + .load(user.avatarUrl) + .circleCrop() + .into(binding.ivFollowingAvatar) + } + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame( + oldItem: ProfileUserUiModel, + newItem: ProfileUserUiModel + ): Boolean = oldItem.id == newItem.id + + override fun areContentsTheSame( + oldItem: ProfileUserUiModel, + newItem: ProfileUserUiModel + ): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileFragment.kt new file mode 100644 index 0000000..6daf847 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileFragment.kt @@ -0,0 +1,80 @@ +package com.example.nike.ui.profile + +import android.os.Bundle +import android.view.View +import android.widget.Toast +import androidx.core.view.isVisible +import androidx.fragment.app.Fragment +import androidx.fragment.app.viewModels +import androidx.recyclerview.widget.LinearLayoutManager +import com.bumptech.glide.Glide +import com.example.nike.R +import com.example.nike.databinding.FragmentProfileBinding + +class ProfileFragment : Fragment(R.layout.fragment_profile) { + + private var _binding: FragmentProfileBinding? = null + private val binding get() = _binding!! + + private val viewModel: ProfileViewModel by viewModels { ProfileViewModelFactory() } + private val followingAdapter = FollowingUserAdapter() + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentProfileBinding.bind(view) + + setupFollowingList() + observeProfile() + viewModel.loadProfile() + } + + private fun setupFollowingList() { + binding.rvFollowingUsers.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + binding.rvFollowingUsers.adapter = followingAdapter + } + + private fun observeProfile() { + viewModel.uiState.observe(viewLifecycleOwner) { state -> + when (state) { + ProfileUiState.Loading -> { + binding.progressBar.isVisible = true + binding.tvProfileError.isVisible = false + } + is ProfileUiState.Success -> { + binding.progressBar.isVisible = false + binding.tvProfileError.isVisible = false + bindProfile(state.profile) + binding.tvFollowingTitle.text = if (state.isFollowingLoading) { + "팔로잉 불러오는 중" + } else { + "팔로잉 (${state.followingUsers.size})" + } + followingAdapter.submitList(state.followingUsers) + } + is ProfileUiState.Error -> { + binding.progressBar.isVisible = false + binding.tvProfileError.isVisible = true + binding.tvProfileError.text = state.message + Toast.makeText(requireContext(), state.message, Toast.LENGTH_SHORT).show() + } + } + } + } + + private fun bindProfile(profile: ProfileUserUiModel) { + binding.tvNickname.text = profile.name + Glide.with(this) + .load(profile.avatarUrl) + .placeholder(R.drawable.profile_avatar_placeholder) + .error(R.drawable.profile_avatar_placeholder) + .circleCrop() + .into(binding.ivProfileAvatar) + } + + override fun onDestroyView() { + super.onDestroyView() + binding.rvFollowingUsers.adapter = null + _binding = null + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileRepository.kt b/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileRepository.kt new file mode 100644 index 0000000..1f839d0 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileRepository.kt @@ -0,0 +1,48 @@ +package com.example.nike.ui.profile + +import com.example.nike.data.remote.api.ReqResApiClient +import com.example.nike.data.remote.api.ReqResService +import com.example.nike.data.remote.dto.ReqResUserDto + +class ProfileRepository( + private val service: ReqResService = ReqResApiClient.service +) { + + suspend fun getProfile(userId: Int): Result { + return runCatching { + val response = service.getUser(userId) + val body = response.body() + if (!response.isSuccessful || body == null) { + throw IllegalStateException("HTTP ${response.code()}: ${response.message()}") + } + body.data.toUiModel() + } + } + + suspend fun getFollowingUsers(page: Int = 1): Result> { + return runCatching { + val response = service.getUsers(page) + val body = response.body() + if (!response.isSuccessful || body == null) { + throw IllegalStateException("HTTP ${response.code()}: ${response.message()}") + } + body.data.map { it.toUiModel() } + } + } + + private fun ReqResUserDto.toUiModel(): ProfileUserUiModel { + return ProfileUserUiModel( + id = id, + name = "$firstName $lastName", + email = email, + avatarUrl = avatar + ) + } +} + +data class ProfileUserUiModel( + val id: Int, + val name: String, + val email: String, + val avatarUrl: String +) \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileViewModel.kt b/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileViewModel.kt new file mode 100644 index 0000000..ed7313d --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/profile/ProfileViewModel.kt @@ -0,0 +1,87 @@ +package com.example.nike.ui.profile + +import android.util.Log +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import kotlinx.coroutines.launch + +class ProfileViewModel( + private val repository: ProfileRepository +) : ViewModel() { + + private val _uiState = MutableLiveData(ProfileUiState.Loading) + val uiState: LiveData = _uiState + + fun loadProfile() { + _uiState.value = ProfileUiState.Loading + viewModelScope.launch { + repository.getProfile(MY_USER_ID) + .onSuccess { profile -> + Log.d(TAG, "profile loaded: $profile") + _uiState.value = ProfileUiState.Success( + profile = profile, + followingUsers = emptyList(), + isFollowingLoading = true + ) + loadFollowingUsers(profile) + } + .onFailure { error -> + Log.e(TAG, "profile load failed", error) + _uiState.value = ProfileUiState.Error( + error.message ?: "프로필 정보를 불러오지 못했습니다." + ) + } + } + } + + private suspend fun loadFollowingUsers(profile: ProfileUserUiModel) { + repository.getFollowingUsers(page = 1) + .onSuccess { users -> + val following = users.filterNot { it.id == profile.id } + Log.d(TAG, "following loaded: ${following.size}") + _uiState.value = ProfileUiState.Success( + profile = profile, + followingUsers = following, + isFollowingLoading = false + ) + } + .onFailure { error -> + Log.e(TAG, "following load failed", error) + _uiState.value = ProfileUiState.Success( + profile = profile, + followingUsers = emptyList(), + isFollowingLoading = false + ) + } + } + + companion object { + private const val TAG = "ProfileViewModel" + private const val MY_USER_ID = 1 + } +} + +sealed interface ProfileUiState { + data object Loading : ProfileUiState + data class Success( + val profile: ProfileUserUiModel, + val followingUsers: List, + val isFollowingLoading: Boolean + ) : ProfileUiState + data class Error(val message: String) : ProfileUiState +} + +class ProfileViewModelFactory( + private val repository: ProfileRepository = ProfileRepository() +) : ViewModelProvider.Factory { + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T { + if (modelClass.isAssignableFrom(ProfileViewModel::class.java)) { + return ProfileViewModel(repository) as T + } + throw IllegalArgumentException("Unknown ViewModel class: ${modelClass.name}") + } +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/shop/SaleFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/shop/SaleFragment.kt new file mode 100644 index 0000000..019a16f --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/shop/SaleFragment.kt @@ -0,0 +1,47 @@ +package com.example.nike.ui.shop + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.recyclerview.widget.GridLayoutManager +import com.example.nike.R +import com.example.nike.databinding.FragmentSaleBinding +import com.example.nike.ui.common.ProductGridAdapter +import com.example.nike.ui.product.ProductNavigator +import com.example.nike.ui.product.ProductViewModel + +class SaleFragment : Fragment(R.layout.fragment_sale) { + + private var _binding: FragmentSaleBinding? = null + private val binding get() = _binding!! + + private val viewModel: ProductViewModel by activityViewModels() + private lateinit var adapter: ProductGridAdapter + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentSaleBinding.bind(view) + + adapter = ProductGridAdapter( + onItemClick = { product -> (activity as? ProductNavigator)?.openProductDetail(product.id) }, + onHeartClick = { product -> viewModel.toggleWishlist(product.id) } + ) + + binding.rvSale.layoutManager = GridLayoutManager(requireContext(), 2) + binding.rvSale.adapter = adapter + + viewModel.allProducts.observe(viewLifecycleOwner) { products -> + adapter.submitList(products.filter { it.category == CATEGORY_SALE }) + } + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + companion object { + private const val CATEGORY_SALE = "SALE" + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/shop/ShopFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/shop/ShopFragment.kt new file mode 100644 index 0000000..55b7f3c --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/shop/ShopFragment.kt @@ -0,0 +1,34 @@ +package com.example.nike.ui.shop + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import com.example.nike.R +import com.example.nike.databinding.FragmentShopBinding +import com.google.android.material.tabs.TabLayoutMediator + +class ShopFragment : Fragment(R.layout.fragment_shop) { + + private var _binding: FragmentShopBinding? = null + private val binding get() = _binding!! + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentShopBinding.bind(view) + + binding.viewPager.adapter = ShopPagerAdapter(this) + + TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position -> + tab.text = when (position) { + 0 -> "Top & T-shirts" + 1 -> "Sale" + else -> "" + } + }.attach() + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/shop/ShopPagerAdapter.kt b/Nike/app/src/main/java/com/example/nike/ui/shop/ShopPagerAdapter.kt new file mode 100644 index 0000000..913233c --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/shop/ShopPagerAdapter.kt @@ -0,0 +1,17 @@ +package com.example.nike.ui.shop + +import androidx.fragment.app.Fragment +import androidx.viewpager2.adapter.FragmentStateAdapter + +class ShopPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) { + + override fun getItemCount(): Int = 2 + + override fun createFragment(position: Int): Fragment { + return when (position) { + 0 -> TopFragment() + 1 -> SaleFragment() + else -> TopFragment() + } + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/shop/TopFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/shop/TopFragment.kt new file mode 100644 index 0000000..fa76c7f --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/shop/TopFragment.kt @@ -0,0 +1,47 @@ +package com.example.nike.ui.shop + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.recyclerview.widget.GridLayoutManager +import com.example.nike.R +import com.example.nike.databinding.FragmentTopBinding +import com.example.nike.ui.common.ProductGridAdapter +import com.example.nike.ui.product.ProductNavigator +import com.example.nike.ui.product.ProductViewModel + +class TopFragment : Fragment(R.layout.fragment_top) { + + private var _binding: FragmentTopBinding? = null + private val binding get() = _binding!! + + private val viewModel: ProductViewModel by activityViewModels() + private lateinit var adapter: ProductGridAdapter + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentTopBinding.bind(view) + + adapter = ProductGridAdapter( + onItemClick = { product -> (activity as? ProductNavigator)?.openProductDetail(product.id) }, + onHeartClick = { product -> viewModel.toggleWishlist(product.id) } + ) + + binding.rvTop.layoutManager = GridLayoutManager(requireContext(), 2) + binding.rvTop.adapter = adapter + + viewModel.allProducts.observe(viewLifecycleOwner) { products -> + adapter.submitList(products.filter { it.category == CATEGORY_TOP }) + } + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + companion object { + private const val CATEGORY_TOP = "TOP" + } +} diff --git a/Nike/app/src/main/java/com/example/nike/ui/theme/Color.kt b/Nike/app/src/main/java/com/example/nike/ui/theme/Color.kt new file mode 100644 index 0000000..afa56c4 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.nike.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/theme/Theme.kt b/Nike/app/src/main/java/com/example/nike/ui/theme/Theme.kt new file mode 100644 index 0000000..93fd686 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.example.nike.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun NikeTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/theme/Type.kt b/Nike/app/src/main/java/com/example/nike/ui/theme/Type.kt new file mode 100644 index 0000000..d6427ff --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.nike.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/Nike/app/src/main/java/com/example/nike/ui/wishlist/WishListFragment.kt b/Nike/app/src/main/java/com/example/nike/ui/wishlist/WishListFragment.kt new file mode 100644 index 0000000..e3f1697 --- /dev/null +++ b/Nike/app/src/main/java/com/example/nike/ui/wishlist/WishListFragment.kt @@ -0,0 +1,43 @@ +package com.example.nike.ui.wishlist + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import androidx.recyclerview.widget.GridLayoutManager +import com.example.nike.R +import com.example.nike.databinding.FragmentWishListBinding +import com.example.nike.ui.common.ProductGridAdapter +import com.example.nike.ui.product.ProductNavigator +import com.example.nike.ui.product.ProductViewModel + +class WishlistFragment : Fragment(R.layout.fragment_wish_list) { + + private var _binding: FragmentWishListBinding? = null + private val binding get() = _binding!! + + private val viewModel: ProductViewModel by activityViewModels() + private lateinit var adapter: ProductGridAdapter + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + _binding = FragmentWishListBinding.bind(view) + + adapter = ProductGridAdapter( + onItemClick = { product -> (activity as? ProductNavigator)?.openProductDetail(product.id) }, + onHeartClick = { product -> viewModel.toggleWishlist(product.id) } + ) + + binding.rvWishlist.layoutManager = GridLayoutManager(requireContext(), 2) + binding.rvWishlist.adapter = adapter + + viewModel.allProducts.observe(viewLifecycleOwner) { products -> + adapter.submitList(products.filter { it.isLiked }) + } + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } +} diff --git a/Nike/app/src/main/res/color/bottom_nav_selector.xml b/Nike/app/src/main/res/color/bottom_nav_selector.xml new file mode 100644 index 0000000..740c138 --- /dev/null +++ b/Nike/app/src/main/res/color/bottom_nav_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Nike/app/src/main/res/drawable/air_jordan_xxxvi.png b/Nike/app/src/main/res/drawable/air_jordan_xxxvi.png new file mode 100644 index 0000000..af62947 Binary files /dev/null and b/Nike/app/src/main/res/drawable/air_jordan_xxxvi.png differ diff --git a/Nike/app/src/main/res/drawable/detail_outline_button_bg.xml b/Nike/app/src/main/res/drawable/detail_outline_button_bg.xml new file mode 100644 index 0000000..7155e6d --- /dev/null +++ b/Nike/app/src/main/res/drawable/detail_outline_button_bg.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/Nike/app/src/main/res/drawable/home_banner.png b/Nike/app/src/main/res/drawable/home_banner.png new file mode 100644 index 0000000..49b926f Binary files /dev/null and b/Nike/app/src/main/res/drawable/home_banner.png differ diff --git a/Nike/app/src/main/res/drawable/ic_bagcircle.xml b/Nike/app/src/main/res/drawable/ic_bagcircle.xml new file mode 100644 index 0000000..1af2ce6 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_bagcircle.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/Nike/app/src/main/res/drawable/ic_bagsimple.xml b/Nike/app/src/main/res/drawable/ic_bagsimple.xml new file mode 100644 index 0000000..3b6e816 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_bagsimple.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/Nike/app/src/main/res/drawable/ic_heart_filled.xml b/Nike/app/src/main/res/drawable/ic_heart_filled.xml new file mode 100644 index 0000000..9d7cc1b --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_heart_filled.xml @@ -0,0 +1,13 @@ + + + diff --git a/Nike/app/src/main/res/drawable/ic_heartstraight.xml b/Nike/app/src/main/res/drawable/ic_heartstraight.xml new file mode 100644 index 0000000..6597a4a --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_heartstraight.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/Nike/app/src/main/res/drawable/ic_housesimple.xml b/Nike/app/src/main/res/drawable/ic_housesimple.xml new file mode 100644 index 0000000..a0d86b9 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_housesimple.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/Nike/app/src/main/res/drawable/ic_launcher_background.xml b/Nike/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..701ef27 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/Nike/app/src/main/res/drawable/ic_launcher_foreground.xml b/Nike/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Nike/app/src/main/res/drawable/ic_listmagnifyingglass.xml b/Nike/app/src/main/res/drawable/ic_listmagnifyingglass.xml new file mode 100644 index 0000000..483d117 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_listmagnifyingglass.xml @@ -0,0 +1,38 @@ + + + + + + + + + diff --git a/Nike/app/src/main/res/drawable/ic_user.xml b/Nike/app/src/main/res/drawable/ic_user.xml new file mode 100644 index 0000000..1fc97b8 --- /dev/null +++ b/Nike/app/src/main/res/drawable/ic_user.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/Nike/app/src/main/res/drawable/nike_air_force.png b/Nike/app/src/main/res/drawable/nike_air_force.png new file mode 100644 index 0000000..3bf50b1 Binary files /dev/null and b/Nike/app/src/main/res/drawable/nike_air_force.png differ diff --git a/Nike/app/src/main/res/drawable/profile_avatar_placeholder.xml b/Nike/app/src/main/res/drawable/profile_avatar_placeholder.xml new file mode 100644 index 0000000..d7933fd --- /dev/null +++ b/Nike/app/src/main/res/drawable/profile_avatar_placeholder.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Nike/app/src/main/res/drawable/profile_outline_button_bg.xml b/Nike/app/src/main/res/drawable/profile_outline_button_bg.xml new file mode 100644 index 0000000..8ec01ad --- /dev/null +++ b/Nike/app/src/main/res/drawable/profile_outline_button_bg.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Nike/app/src/main/res/layout/activity_main.xml b/Nike/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..7868a03 --- /dev/null +++ b/Nike/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/Nike/app/src/main/res/layout/fragment_cart.xml b/Nike/app/src/main/res/layout/fragment_cart.xml new file mode 100644 index 0000000..1ea66ad --- /dev/null +++ b/Nike/app/src/main/res/layout/fragment_cart.xml @@ -0,0 +1,52 @@ + + + + + + + + + + +