From dfed22e509120baec3ac9fb8c092d0beb81e2ef1 Mon Sep 17 00:00:00 2001
From: hwan04 <73435826+hwan04@users.noreply.github.com>
Date: Wed, 13 Nov 2024 19:12:31 +0900
Subject: [PATCH 1/7] =?UTF-8?q?design(Main):=20Main=ED=99=94=EB=A9=B4=20?=
=?UTF-8?q?=EB=94=94=EC=9E=90=EC=9D=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/compiler.xml | 6 +
.idea/deploymentTargetSelector.xml | 10 +
.idea/gradle.xml | 19 ++
.idea/kotlinc.xml | 6 +
.idea/migrations.xml | 10 +
.idea/misc.xml | 5 +
.idea/other.xml | 329 ++++++++++++++++++++++
.idea/vcs.xml | 6 +
app/src/main/res/layout/activity_main.xml | 19 +-
gradle/wrapper/gradle-wrapper.properties | 4 +-
10 files changed, 410 insertions(+), 4 deletions(-)
create mode 100644 .idea/compiler.xml
create mode 100644 .idea/deploymentTargetSelector.xml
create mode 100644 .idea/gradle.xml
create mode 100644 .idea/kotlinc.xml
create mode 100644 .idea/migrations.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/other.xml
create mode 100644 .idea/vcs.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..b589d56
--- /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/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..0897082
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..fdf8d99
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..824785d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/other.xml b/.idea/other.xml
new file mode 100644
index 0000000..49481ad
--- /dev/null
+++ b/.idea/other.xml
@@ -0,0 +1,329 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 86a5d97..5da4bc7 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -8,12 +8,27 @@
tools:context=".MainActivity">
+
+
+
+
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index fb05eea..d845e79 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Oct 30 23:55:34 KST 2024
+#Wed Nov 13 17:45:35 KST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
From 57601eb0b4eea1c6d13ecdddb9d9667f13425afb Mon Sep 17 00:00:00 2001
From: hwan04 <73435826+hwan04@users.noreply.github.com>
Date: Wed, 13 Nov 2024 19:30:28 +0900
Subject: [PATCH 2/7] =?UTF-8?q?design(AddGoods):=20=ED=99=94=EB=A9=B4=20?=
=?UTF-8?q?=EB=94=94=EC=9E=90=EC=9D=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/AndroidManifest.xml | 3 +
.../alom/androidstudy2/AddGoodsActivity.kt | 20 +++++
.../main/res/layout/activity_add_goods.xml | 90 +++++++++++++++++++
app/src/main/res/layout/activity_main.xml | 4 +-
4 files changed, 115 insertions(+), 2 deletions(-)
create mode 100644 app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
create mode 100644 app/src/main/res/layout/activity_add_goods.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0acee2a..3b1fe63 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -12,6 +12,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.Android_study_14_2"
tools:targetApi="31">
+
diff --git a/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt b/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
new file mode 100644
index 0000000..5f1705d
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
@@ -0,0 +1,20 @@
+package com.alom.androidstudy2
+
+import android.os.Bundle
+import androidx.activity.enableEdgeToEdge
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
+
+class AddGoodsActivity : AppCompatActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enableEdgeToEdge()
+ setContentView(R.layout.activity_add_goods)
+ ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
+ val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
+ insets
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_add_goods.xml b/app/src/main/res/layout/activity_add_goods.xml
new file mode 100644
index 0000000..382ba98
--- /dev/null
+++ b/app/src/main/res/layout/activity_add_goods.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 5da4bc7..b70b171 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -17,7 +17,7 @@
app:layout_constraintTop_toTopOf="parent" />
Date: Wed, 13 Nov 2024 21:07:18 +0900
Subject: [PATCH 3/7] =?UTF-8?q?feat(API):=20API=20=EA=B8=B0=EB=B3=B8=20?=
=?UTF-8?q?=ED=8B=80=20=EC=A0=9C=EC=9E=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle.kts | 14 ++++++++
app/src/main/AndroidManifest.xml | 2 ++
.../main/java/com/alom/androidstudy2/Goods.kt | 28 +++++++++++++++
.../java/com/alom/androidstudy2/GoodsApi.kt | 13 +++++++
.../com/alom/androidstudy2/RetrofitClient.kt | 34 +++++++++++++++++++
gradle/libs.versions.toml | 6 ++++
6 files changed, 97 insertions(+)
create mode 100644 app/src/main/java/com/alom/androidstudy2/Goods.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/GoodsApi.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index d3941a7..e947430 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -1,8 +1,13 @@
+import java.util.Properties
+
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
}
+val properties = Properties()
+properties.load(project.rootProject.file("local.properties").inputStream())
+
android {
namespace = "com.alom.androidstudy2"
compileSdk = 34
@@ -15,6 +20,7 @@ android {
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ buildConfigField ("String", "API_KEY", "\"${properties.getProperty("API_KEY")}\"")
}
buildTypes {
@@ -23,6 +29,9 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
+ buildFeatures {
+ buildConfig = true
+ }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
@@ -42,4 +51,9 @@ dependencies {
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
+
+ implementation(libs.retrofit)
+ implementation(libs.converter.gson)
+ implementation(libs.okhttp)
+ implementation(libs.logging.interceptor)
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3b1fe63..a4a40b3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,6 +2,8 @@
+
+
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/GoodsApi.kt b/app/src/main/java/com/alom/androidstudy2/GoodsApi.kt
new file mode 100644
index 0000000..9221211
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/GoodsApi.kt
@@ -0,0 +1,13 @@
+package com.alom.androidstudy2
+
+import retrofit2.Call
+import retrofit2.http.Body
+import retrofit2.http.POST
+
+interface GoodsApi {
+ @POST("rpc/add_item2")
+ fun addItmes(@Body newItem: NewGoods):Call
+
+ @POST("rpc/get_item2")
+ fun getItems(): Call
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt b/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
new file mode 100644
index 0000000..aaed65a
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
@@ -0,0 +1,34 @@
+package com.alom.androidstudy2
+
+import okhttp3.OkHttpClient
+import okhttp3.logging.HttpLoggingInterceptor
+import retrofit2.Retrofit
+import retrofit2.converter.gson.GsonConverterFactory
+
+object RetrofitClient {
+ private const val BASE_URL = "https://dapi.kakao.com"
+
+ private fun createOkHttpClient(): OkHttpClient {
+ val interceptor = HttpLoggingInterceptor()
+ interceptor.level = HttpLoggingInterceptor.Level.BODY //okhttp에서 어떤부분을 로깅할지 지정
+
+
+ return OkHttpClient.Builder()
+ .addInterceptor { chain ->
+ val original = chain.request()
+ val requestBuilder = original.newBuilder() // 리퀘스트 빌더 만들고
+ .header("apikey", BuildConfig.API_KEY) // 거기에 헤더 추가
+ val request = requestBuilder.build()
+ chain.proceed(request)
+ }
+ .build()
+ }
+
+ private val retrofit: Retrofit = Retrofit.Builder()
+ .baseUrl(BASE_URL) // baseurl 달고
+ .addConverterFactory(GsonConverterFactory.create()) // json을 data class로 편하게 바꿔주는 gson
+ .client(createOkHttpClient()) // okhttp 클라이언트 달고
+ .build()
+
+ val goodsApi: GoodsApi = retrofit.create(GoodsApi::class.java)
+}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 9b2b101..e89c88f 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,24 +1,30 @@
[versions]
agp = "8.5.2"
+converterGson = "2.9.0"
kotlin = "1.9.0"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
+loggingInterceptor = "4.9.3"
material = "1.12.0"
activity = "1.9.3"
constraintlayout = "2.1.4"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
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-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
+logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
+okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "loggingInterceptor" }
+retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "converterGson" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
From 7249ec7ba83f5ec81966e2d1235a9a393fed26bb Mon Sep 17 00:00:00 2001
From: hwan04 <73435826+hwan04@users.noreply.github.com>
Date: Wed, 13 Nov 2024 21:37:00 +0900
Subject: [PATCH 4/7] =?UTF-8?q?feat(Repository):=20=EA=B8=B0=EB=8A=A5=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../main/java/com/alom/androidstudy2/Goods.kt | 11 ++++++++-
.../com/alom/androidstudy2/GoodsRepository.kt | 23 +++++++++++++++++++
.../com/alom/androidstudy2/RetrofitClient.kt | 2 +-
3 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt
diff --git a/app/src/main/java/com/alom/androidstudy2/Goods.kt b/app/src/main/java/com/alom/androidstudy2/Goods.kt
index 365ae26..f047b52 100644
--- a/app/src/main/java/com/alom/androidstudy2/Goods.kt
+++ b/app/src/main/java/com/alom/androidstudy2/Goods.kt
@@ -25,4 +25,13 @@ data class ApiResponse(
val result: Int,
val message: String,
val data: List
-)
\ No newline at end of file
+)
+
+sealed class APIResponse(
+ val data: T? = null,
+ val message: String? = null
+) {
+ class Success(data: T?) : APIResponse(data)
+ class Loading(data: T? = null) : APIResponse(data)
+ class Error(message: String, data: T? = null) : APIResponse(data, message)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt b/app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt
new file mode 100644
index 0000000..aa623a0
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt
@@ -0,0 +1,23 @@
+package com.alom.androidstudy2
+
+class GoodsRepository(private val api: GoodsApi) {
+ fun getItems(): APIResponse> {
+ val response = api.getItems().execute()
+ if(response.isSuccessful){
+ response.body()?.let { result ->
+ return APIResponse.Success(result.data)
+ }
+ }
+
+ return APIResponse.Error(response.message())
+ }
+
+ fun addItems(newGoods: NewGoods): APIResponse {
+ val response = api.addItmes(newGoods).execute()
+ if (response.isSuccessful) {
+ return APIResponse.Success(null)
+ }
+
+ return APIResponse.Error(response.message())
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt b/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
index aaed65a..62eb515 100644
--- a/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
+++ b/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
@@ -6,7 +6,7 @@ import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
object RetrofitClient {
- private const val BASE_URL = "https://dapi.kakao.com"
+ private const val BASE_URL = "https://goaplrynweyxovekoezl.supabase.co/rest/v1/"
private fun createOkHttpClient(): OkHttpClient {
val interceptor = HttpLoggingInterceptor()
From df553c513802512265b34fa4fab0607071e1add9 Mon Sep 17 00:00:00 2001
From: hwan04 <73435826+hwan04@users.noreply.github.com>
Date: Sun, 16 Feb 2025 20:51:20 +0900
Subject: [PATCH 5/7] =?UTF-8?q?feat(Project):=20=EC=A0=84=EC=B2=B4=20?=
=?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EB=8B=A4=20=EB=B0=94=EA=BE=B8=EA=B8=B0..?=
=?UTF-8?q?=3F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/deploymentTargetSelector.xml | 8 ++
.idea/misc.xml | 1 -
.idea/other.xml | 123 +++++++++++++++++-
app/build.gradle.kts | 8 +-
.../alom/androidstudy2/AddGoodsActivity.kt | 33 ++++-
.../main/java/com/alom/androidstudy2/Goods.kt | 37 ------
.../com/alom/androidstudy2/GoodsRepository.kt | 23 ----
.../androidstudy2/{GoodsApi.kt => ItemAPI.kt} | 8 +-
.../com/alom/androidstudy2/ItemListAdapter.kt | 43 ++++++
.../com/alom/androidstudy2/ItemRepository.kt | 6 +
.../alom/androidstudy2/ItemRepositoryImpl.kt | 14 ++
.../com/alom/androidstudy2/ItemResponse.kt | 25 ++++
.../com/alom/androidstudy2/MainActivity.kt | 51 ++++++--
.../com/alom/androidstudy2/MainViewModel.kt | 34 +++++
.../com/alom/androidstudy2/RetrofitClient.kt | 19 ++-
.../alom/androidstudy2/ViewModelFactory.kt | 13 ++
.../com/alom/androidstudy2/itemRequest.kt | 12 ++
.../main/res/layout/activity_add_goods.xml | 8 ++
app/src/main/res/layout/activity_main.xml | 2 +-
app/src/main/res/layout/item_data.xml | 48 +++++++
gradle/libs.versions.toml | 8 +-
21 files changed, 433 insertions(+), 91 deletions(-)
delete mode 100644 app/src/main/java/com/alom/androidstudy2/Goods.kt
delete mode 100644 app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt
rename app/src/main/java/com/alom/androidstudy2/{GoodsApi.kt => ItemAPI.kt} (55%)
create mode 100644 app/src/main/java/com/alom/androidstudy2/ItemListAdapter.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/ItemRepository.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/ItemRepositoryImpl.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/ItemResponse.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/MainViewModel.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/ViewModelFactory.kt
create mode 100644 app/src/main/java/com/alom/androidstudy2/itemRequest.kt
create mode 100644 app/src/main/res/layout/item_data.xml
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
index b268ef3..d1d02e7 100644
--- a/.idea/deploymentTargetSelector.xml
+++ b/.idea/deploymentTargetSelector.xml
@@ -4,6 +4,14 @@
+
+
+
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 824785d..adb8ae0 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/.idea/other.xml b/.idea/other.xml
index 49481ad..1811ddc 100644
--- a/.idea/other.xml
+++ b/.idea/other.xml
@@ -14,6 +14,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -36,6 +47,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -58,6 +80,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -113,6 +146,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -135,6 +179,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -168,6 +234,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -223,6 +322,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -262,7 +372,7 @@
-
+
@@ -279,6 +389,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index e947430..eb80b66 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -12,6 +12,10 @@ android {
namespace = "com.alom.androidstudy2"
compileSdk = 34
+ buildFeatures{
+ viewBinding = true
+ }
+
defaultConfig {
applicationId = "com.alom.androidstudy2"
minSdk = 26
@@ -20,7 +24,7 @@ android {
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
- buildConfigField ("String", "API_KEY", "\"${properties.getProperty("API_KEY")}\"")
+ buildConfigField ("String", "API_KEY", properties.getProperty("API_KEY"))
}
buildTypes {
@@ -56,4 +60,6 @@ dependencies {
implementation(libs.converter.gson)
implementation(libs.okhttp)
implementation(libs.logging.interceptor)
+ implementation(libs.androidx.lifecycle.viewmodel.ktx)
+ implementation(libs.glide)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt b/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
index 5f1705d..01059f8 100644
--- a/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
+++ b/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
@@ -1,20 +1,41 @@
package com.alom.androidstudy2
+import android.content.Intent
import android.os.Bundle
+import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
+import androidx.lifecycle.ViewModelProvider
+import com.alom.androidstudy2.databinding.ActivityAddGoodsBinding
class AddGoodsActivity : AppCompatActivity() {
+ private lateinit var binding: ActivityAddGoodsBinding
+ private lateinit var mainViewModel: MainViewModel
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- enableEdgeToEdge()
- setContentView(R.layout.activity_add_goods)
- ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
- val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
- v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
- insets
+ binding = ActivityAddGoodsBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ val repository = ItemRepositoryImpl()
+ val factory = ViewModelFactory(repository)
+
+ mainViewModel = ViewModelProvider(this, factory)[MainViewModel::class.java]
+
+ binding.btnSaveGoods.setOnClickListener{
+ val title = binding.etGoodsTitle.text.toString()
+ val price = binding.etGoodsPrice.text.toString()
+ val time = binding.etGoodsTime.text.toString()
+
+ val item = itemRequest(title, price, time)
+
+ mainViewModel.addValue(item)
+ }
+
+ binding.tvBack.setOnClickListener {
+ finish()
}
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/Goods.kt b/app/src/main/java/com/alom/androidstudy2/Goods.kt
deleted file mode 100644
index f047b52..0000000
--- a/app/src/main/java/com/alom/androidstudy2/Goods.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.alom.androidstudy2
-
-import com.google.gson.annotations.SerializedName
-
-data class Goods(
- val id: Int,
- val title: String,
- val price: String,
- val imageUrl: String,
- val time: String
-)
-
-data class NewGoods(
- @SerializedName("p_title")
- val p_title: String,
-
- @SerializedName("p_price")
- val p_price: String,
-
- @SerializedName("p_time")
- val p_time: String
-)
-
-data class ApiResponse(
- val result: Int,
- val message: String,
- val data: List
-)
-
-sealed class APIResponse(
- val data: T? = null,
- val message: String? = null
-) {
- class Success(data: T?) : APIResponse(data)
- class Loading(data: T? = null) : APIResponse(data)
- class Error(message: String, data: T? = null) : APIResponse(data, message)
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt b/app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt
deleted file mode 100644
index aa623a0..0000000
--- a/app/src/main/java/com/alom/androidstudy2/GoodsRepository.kt
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.alom.androidstudy2
-
-class GoodsRepository(private val api: GoodsApi) {
- fun getItems(): APIResponse> {
- val response = api.getItems().execute()
- if(response.isSuccessful){
- response.body()?.let { result ->
- return APIResponse.Success(result.data)
- }
- }
-
- return APIResponse.Error(response.message())
- }
-
- fun addItems(newGoods: NewGoods): APIResponse {
- val response = api.addItmes(newGoods).execute()
- if (response.isSuccessful) {
- return APIResponse.Success(null)
- }
-
- return APIResponse.Error(response.message())
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/GoodsApi.kt b/app/src/main/java/com/alom/androidstudy2/ItemAPI.kt
similarity index 55%
rename from app/src/main/java/com/alom/androidstudy2/GoodsApi.kt
rename to app/src/main/java/com/alom/androidstudy2/ItemAPI.kt
index 9221211..11ff21a 100644
--- a/app/src/main/java/com/alom/androidstudy2/GoodsApi.kt
+++ b/app/src/main/java/com/alom/androidstudy2/ItemAPI.kt
@@ -4,10 +4,12 @@ import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.POST
-interface GoodsApi {
+interface ItemAPI {
@POST("rpc/add_item2")
- fun addItmes(@Body newItem: NewGoods):Call
+ suspend fun addItems(
+ @Body body: itemRequest
+ ): Unit
@POST("rpc/get_item2")
- fun getItems(): Call
+ suspend fun getItems(): ItemResponse
}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/ItemListAdapter.kt b/app/src/main/java/com/alom/androidstudy2/ItemListAdapter.kt
new file mode 100644
index 0000000..ed0d37d
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/ItemListAdapter.kt
@@ -0,0 +1,43 @@
+package com.alom.androidstudy2
+
+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.alom.androidstudy2.databinding.ItemDataBinding
+import com.bumptech.glide.Glide
+
+class ItemListAdapter: ListAdapter(
+ object: DiffUtil.ItemCallback(){
+ override fun areItemsTheSame(oldItem: Data, newItem: Data): Boolean = oldItem.id == newItem.id
+
+ override fun areContentsTheSame(oldItem: Data, newItem: Data): Boolean = oldItem == newItem
+ }
+) {
+ override fun onCreateViewHolder(
+ parent: ViewGroup,
+ viewType: Int
+ ): ViewHolder {
+ val binding = LayoutInflater.from(parent.context).inflate(R.layout.item_data, parent, false)
+ return ViewHolder(ItemDataBinding.bind(binding))
+ }
+
+ override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+ val goods = getItem(position)
+ holder.bind(goods)
+ }
+
+ inner class ViewHolder(private val binding: ItemDataBinding): RecyclerView.ViewHolder(binding.root) {
+ fun bind(goods: Data) {
+ with(binding) {
+ Glide.with(root.context)
+ .load(goods.imageUrl)
+ .into(ivGoodsImageItem)
+ tvGoodsTitleItem.text = goods.title
+ tvGoodsPriceItem.text = goods.price
+ tvGoodsTimeItem.text = goods.time
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/ItemRepository.kt b/app/src/main/java/com/alom/androidstudy2/ItemRepository.kt
new file mode 100644
index 0000000..3044d96
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/ItemRepository.kt
@@ -0,0 +1,6 @@
+package com.alom.androidstudy2
+
+interface ItemRepository {
+ suspend fun getItem(): List
+ suspend fun addItem(item: itemRequest)
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/ItemRepositoryImpl.kt b/app/src/main/java/com/alom/androidstudy2/ItemRepositoryImpl.kt
new file mode 100644
index 0000000..10b9795
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/ItemRepositoryImpl.kt
@@ -0,0 +1,14 @@
+package com.alom.androidstudy2
+
+import retrofit2.Call
+
+class ItemRepositoryImpl : ItemRepository {
+ override suspend fun getItem(): List {
+ val response = RetrofitClient.itemApi.getItems()
+ return response.data ?: emptyList()
+ }
+
+ override suspend fun addItem(item: itemRequest) {
+ RetrofitClient.itemApi.addItems(item)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/ItemResponse.kt b/app/src/main/java/com/alom/androidstudy2/ItemResponse.kt
new file mode 100644
index 0000000..1e5dc24
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/ItemResponse.kt
@@ -0,0 +1,25 @@
+package com.alom.androidstudy2
+
+import com.google.gson.annotations.SerializedName
+
+data class ItemResponse(
+ @SerializedName("result")
+ val result: String,
+ @SerializedName("message")
+ val message: String,
+ @SerializedName("data")
+ val data: List
+)
+
+data class Data(
+ @SerializedName("id")
+ val id: Int,
+ @SerializedName("title")
+ val title: String,
+ @SerializedName("price")
+ val price: String,
+ @SerializedName("image_url")
+ val imageUrl: String,
+ @SerializedName("time")
+ val time: String
+)
diff --git a/app/src/main/java/com/alom/androidstudy2/MainActivity.kt b/app/src/main/java/com/alom/androidstudy2/MainActivity.kt
index 54ce3ce..a0d4225 100644
--- a/app/src/main/java/com/alom/androidstudy2/MainActivity.kt
+++ b/app/src/main/java/com/alom/androidstudy2/MainActivity.kt
@@ -1,20 +1,53 @@
package com.alom.androidstudy2
+import android.content.Intent
import android.os.Bundle
-import androidx.activity.enableEdgeToEdge
+import android.util.Log
+import android.widget.Toast
+import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
-import androidx.core.view.ViewCompat
-import androidx.core.view.WindowInsetsCompat
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.lifecycleScope
+import androidx.recyclerview.widget.LinearLayoutManager
+import com.alom.androidstudy2.databinding.ActivityMainBinding
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.launch
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
class MainActivity : AppCompatActivity() {
+ private lateinit var binding: ActivityMainBinding
+ private lateinit var mainViewModel: MainViewModel
+ private val itemAdapter by lazy { ItemListAdapter() }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- enableEdgeToEdge()
- setContentView(R.layout.activity_main)
- ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
- val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
- v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
- insets
+ binding = ActivityMainBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ val repository = ItemRepositoryImpl()
+ val factory = ViewModelFactory(repository)
+
+ mainViewModel = ViewModelProvider(this, factory)[MainViewModel::class.java]
+
+ binding.rvItems.apply {
+ layoutManager = LinearLayoutManager(this@MainActivity)
+ adapter = itemAdapter
}
+
+ binding.tvAdd.setOnClickListener{
+ val intent = Intent(this, AddGoodsActivity::class.java)
+ startActivity(intent)
+ }
+
+ lifecycleScope.launch {
+ mainViewModel.currentData.collect { dataList ->
+ itemAdapter.submitList(dataList)
+ }
+ }
+
+ mainViewModel.updateValue()
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/MainViewModel.kt b/app/src/main/java/com/alom/androidstudy2/MainViewModel.kt
new file mode 100644
index 0000000..3555168
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/MainViewModel.kt
@@ -0,0 +1,34 @@
+package com.alom.androidstudy2
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+
+class MainViewModel(private val repository: ItemRepository) : ViewModel() {
+ private var _currentItem = MutableStateFlow>(emptyList())
+
+ val currentData: StateFlow>
+ get() = _currentItem.asStateFlow()
+
+ init { // 뷰모델이 실행될때 싫행
+ updateValue()
+ }
+
+ fun updateValue() {
+ viewModelScope.launch {
+ val item = repository.getItem()
+ _currentItem.emit(item) // 불러온 데이터 emit
+ }
+ }
+
+ fun addValue(item: itemRequest){
+ viewModelScope.launch {
+ repository.addItem(item)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt b/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
index 62eb515..2b05225 100644
--- a/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
+++ b/app/src/main/java/com/alom/androidstudy2/RetrofitClient.kt
@@ -4,31 +4,36 @@ import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
+import java.util.concurrent.TimeUnit
object RetrofitClient {
private const val BASE_URL = "https://goaplrynweyxovekoezl.supabase.co/rest/v1/"
private fun createOkHttpClient(): OkHttpClient {
val interceptor = HttpLoggingInterceptor()
- interceptor.level = HttpLoggingInterceptor.Level.BODY //okhttp에서 어떤부분을 로깅할지 지정
+ interceptor.level = HttpLoggingInterceptor.Level.BODY
return OkHttpClient.Builder()
.addInterceptor { chain ->
val original = chain.request()
- val requestBuilder = original.newBuilder() // 리퀘스트 빌더 만들고
- .header("apikey", BuildConfig.API_KEY) // 거기에 헤더 추가
+ val requestBuilder = original.newBuilder()
+ .header("apikey", BuildConfig.API_KEY)
val request = requestBuilder.build()
chain.proceed(request)
}
+ .connectTimeout(20, TimeUnit.SECONDS)
+ .readTimeout(20, TimeUnit.SECONDS)
+ .writeTimeout(20, TimeUnit.SECONDS)
+ .addNetworkInterceptor(interceptor)
.build()
}
private val retrofit: Retrofit = Retrofit.Builder()
- .baseUrl(BASE_URL) // baseurl 달고
- .addConverterFactory(GsonConverterFactory.create()) // json을 data class로 편하게 바꿔주는 gson
- .client(createOkHttpClient()) // okhttp 클라이언트 달고
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create())
+ .client(createOkHttpClient())
.build()
- val goodsApi: GoodsApi = retrofit.create(GoodsApi::class.java)
+ val itemApi: ItemAPI = retrofit.create(ItemAPI::class.java)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/ViewModelFactory.kt b/app/src/main/java/com/alom/androidstudy2/ViewModelFactory.kt
new file mode 100644
index 0000000..d7a1719
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/ViewModelFactory.kt
@@ -0,0 +1,13 @@
+package com.alom.androidstudy2
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+
+class ViewModelFactory (private val repository: ItemRepository): ViewModelProvider.Factory {
+ override fun create(modelClass: Class): T {
+ if (modelClass.isAssignableFrom(MainViewModel::class.java)) {
+ return MainViewModel(repository) as T
+ }
+ throw IllegalArgumentException("ViewModel class not found")
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/alom/androidstudy2/itemRequest.kt b/app/src/main/java/com/alom/androidstudy2/itemRequest.kt
new file mode 100644
index 0000000..3c51175
--- /dev/null
+++ b/app/src/main/java/com/alom/androidstudy2/itemRequest.kt
@@ -0,0 +1,12 @@
+package com.alom.androidstudy2
+
+import com.google.gson.annotations.SerializedName
+
+data class itemRequest (
+ @SerializedName("p_title")
+ val title: String,
+ @SerializedName("p_price")
+ val price: String,
+ @SerializedName("p_time")
+ val time: String
+)
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_add_goods.xml b/app/src/main/res/layout/activity_add_goods.xml
index 382ba98..cee06ce 100644
--- a/app/src/main/res/layout/activity_add_goods.xml
+++ b/app/src/main/res/layout/activity_add_goods.xml
@@ -87,4 +87,12 @@
app:layout_constraintTop_toBottomOf="@+id/etGoodsPrice"
app:layout_constraintStart_toEndOf="@+id/tvGoodsTime"/>
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index b70b171..5f1f8ba 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -25,7 +25,7 @@
app:layout_constraintEnd_toEndOf="parent"/>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e89c88f..2d22ffe 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,12 +1,14 @@
[versions]
agp = "8.5.2"
converterGson = "2.9.0"
+glide = "4.16.0"
kotlin = "1.9.0"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
+lifecycleViewmodelKtx = "2.8.7"
loggingInterceptor = "4.9.3"
material = "1.12.0"
activity = "1.9.3"
@@ -14,7 +16,9 @@ constraintlayout = "2.1.4"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
+glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
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" }
@@ -23,8 +27,8 @@ logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", ver
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
-okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "loggingInterceptor" }
-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "converterGson" }
+okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.12.0" }
+retrofit = { module = "com.squareup.retrofit2:retrofit", version = "2.11.0" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
From 42e32e5ecd0c57a17b97cf1e4d7af38227a3d8d8 Mon Sep 17 00:00:00 2001
From: hwan04 <73435826+hwan04@users.noreply.github.com>
Date: Tue, 18 Feb 2025 14:33:33 +0900
Subject: [PATCH 6/7] =?UTF-8?q?feat(MainActivity):=20Main=ED=99=94?=
=?UTF-8?q?=EB=A9=B4=EC=97=90=20=EB=8F=8C=EC=95=84=EC=98=AC=20=EB=95=8C=20?=
=?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80=20=EA=B0=80?=
=?UTF-8?q?=EB=8A=A5=ED=95=98=EA=B2=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/alom/androidstudy2/MainActivity.kt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/src/main/java/com/alom/androidstudy2/MainActivity.kt b/app/src/main/java/com/alom/androidstudy2/MainActivity.kt
index a0d4225..65d0e27 100644
--- a/app/src/main/java/com/alom/androidstudy2/MainActivity.kt
+++ b/app/src/main/java/com/alom/androidstudy2/MainActivity.kt
@@ -50,4 +50,10 @@ class MainActivity : AppCompatActivity() {
mainViewModel.updateValue()
}
+
+ override fun onResume() {
+ super.onResume()
+
+ mainViewModel.updateValue()
+ }
}
\ No newline at end of file
From 1e88da3ec9eaf5317a4c8753da44a7ddef1107b0 Mon Sep 17 00:00:00 2001
From: hwan04 <73435826+hwan04@users.noreply.github.com>
Date: Tue, 18 Feb 2025 14:34:53 +0900
Subject: [PATCH 7/7] =?UTF-8?q?feat(AddGoodsActivity):=20=EC=95=84?=
=?UTF-8?q?=EC=9D=B4=ED=85=9C=20=EC=B6=94=EA=B0=80=20=EC=8B=9C=20=EC=9D=B4?=
=?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt b/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
index 01059f8..1b6ec76 100644
--- a/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
+++ b/app/src/main/java/com/alom/androidstudy2/AddGoodsActivity.kt
@@ -32,6 +32,9 @@ class AddGoodsActivity : AppCompatActivity() {
val item = itemRequest(title, price, time)
mainViewModel.addValue(item)
+
+ Toast.makeText(this, "item 추가됨", Toast.LENGTH_SHORT).show()
+ finish()
}
binding.tvBack.setOnClickListener {