diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 8897a387..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index 24cfa792..cfc1364a 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ captures/ # IntelliJ *.iml .idea/ +.idea/* .idea/compiler.xml .idea/misc.xml .idea/workspace.xml @@ -90,3 +91,8 @@ lint/generated/ lint/outputs/ lint/tmp/ # lint/reports/ + +.DS_Store +._.DS_Store +**/.DS_Store +**/._.DS_Store \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b589d56e..00000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 8978d23d..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/.DS_Store b/app/.DS_Store deleted file mode 100644 index 6bccae5c..00000000 Binary files a/app/.DS_Store and /dev/null differ diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index d4c7fffd..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,133 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlin-parcelize' - id 'com.google.gms.google-services' - id 'com.google.firebase.crashlytics' - id 'kotlin-android' - id 'kotlin-kapt' - id 'dagger.hilt.android.plugin' -} - - Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - - -android { - namespace 'com.eatssu.android' - compileSdk 34 - - defaultConfig { - applicationId "com.eatssu.android" - minSdk 23 - targetSdk 34 - versionCode 17 - versionName "1.1.15" - - - buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"${properties.get('KAKAO_NATIVE_APP_KEY')}\"") - manifestPlaceholders = [KAKAO_NATIVE_APP_KEY: properties.get('KAKAO_NATIVE_APP_KEY')] - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildFeatures { - buildConfig = true - viewBinding = true - dataBinding = true - } - - buildTypes { - debug { - buildConfigField("String", "BASE_URL", properties["DEV_BASE_URL"]) - } - release { - buildConfigField("String", "BASE_URL", properties["PROD_BASE_URL"]) - - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } - splits { - abi { - enable true - reset() - universalApk true - } - } - lint{ - abortOnError = false - } -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.8.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'com.jakewharton.threetenabp:threetenabp:1.4.4' - implementation 'com.prolificinteractive:material-calendarview:1.4.3' - implementation 'androidx.recyclerview:recyclerview:1.3.2' - implementation 'com.google.android.datatransport:transport-runtime:3.1.2' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'androidx.activity:activity-ktx:1.8.2' - implementation 'androidx.fragment:fragment-ktx:1.6.2' - annotationProcessor 'com.android.databinding:compiler:3.1.4' - - //retrofit2 - 서버통신 - implementation 'com.squareup.retrofit2:retrofit:2.9.0' - implementation 'com.squareup.retrofit2:converter-gson:2.9.0' - implementation 'com.google.code.gson:gson:2.10.1' // Gson - - //OkHttp: 통신 로그 확인하기 위함 - implementation 'com.squareup.okhttp3:okhttp:4.12.0' //포스팅 당시 4.9.0 버전 기준 - implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' - - //glide - 사진 업로드 - implementation 'com.github.bumptech.glide:glide:4.15.1' - annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' - - //이미지 압축 - implementation 'id.zelory:compressor:3.0.1' - - //coroutines - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' - - // 카카오 로그인 모듈 - implementation "com.kakao.sdk:v2-user:2.8.6" // 카카오 로그인 - - //hilt - implementation 'com.google.dagger:hilt-android:2.50' - kapt "com.google.dagger:hilt-android-compiler:2.50" - annotationProcessor 'com.google.dagger:hilt-compiler:2.50' - - // viewmodel과 livedata - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.7.0" - - //firebase - implementation 'com.google.android.gms:play-services-base:18.0.1' - implementation 'com.google.firebase:firebase-config-ktx:21.4.1' - implementation platform('com.google.firebase:firebase-bom:32.2.2') - implementation 'com.google.firebase:firebase-analytics-ktx' - implementation 'com.google.firebase:firebase-crashlytics' - - //Timer - implementation "com.jakewharton.timber:timber:5.0.1" -} - -kapt { - correctErrorTypes true -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..df9fbda4 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,153 @@ +import java.util.Properties + +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("kotlin-parcelize") + id("com.google.gms.google-services") + id("com.google.firebase.crashlytics") + id("kotlin-android") + id("kotlin-kapt") + id("dagger.hilt.android.plugin") +} + +android { + namespace = "com.eatssu.android" + compileSdk = 34 + + defaultConfig { + applicationId = "com.eatssu.android" + minSdk = 23 + targetSdk = 34 + versionCode = 19 + versionName = "2.0.0" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildFeatures { + buildConfig = true + viewBinding = true + dataBinding = true + } + + buildTypes { + release { + val p = Properties() + p.load(project.rootProject.file("local.properties").reader()) + + val baseUrl: String = p.getProperty("PROD_BASE_URL") + buildConfigField("String", "BASE_URL", baseUrl) + + val kakaoKey: String = p.getProperty("KAKAO_NATIVE_APP_KEY") + buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"$kakaoKey\"") + manifestPlaceholders["KAKAO_NATIVE_APP_KEY"] = kakaoKey + + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + var shrinkResources = false + var minifyEnabled = false + } + + debug { +// applicationIdSuffix = ".debug" + val p = Properties() + p.load(project.rootProject.file("local.properties").reader()) + + val baseUrl: String = p.getProperty("DEV_BASE_URL") + buildConfigField("String", "BASE_URL", baseUrl) + + val kakaoKey: String = p.getProperty("KAKAO_NATIVE_APP_KEY") + buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"$kakaoKey\"") + manifestPlaceholders["KAKAO_NATIVE_APP_KEY"] = kakaoKey + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + splits { + abi { + isEnable = true + reset() + isUniversalApk = true + } + } + + lint { + abortOnError = false + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + implementation(libs.constraintlayout) + implementation(libs.threetenabp) + implementation(libs.material.calendarview) + implementation(libs.recyclerview) + implementation(libs.transport.runtime) + implementation(libs.activity) + implementation(libs.fragment) + implementation(libs.androidx.activity) + + // Testing libraries + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.espresso.core) + + //retrofit2: 서버통신 + implementation(libs.retrofit) + implementation(libs.converter.gson) + + // Gson for JSON parsing + implementation(libs.gson) + + //OkHttp: 통신 로그 확인하기 위함 + implementation(libs.okhttp) + implementation(libs.okhttp.logging.interceptor) + + //glide: 사진 업로드 + implementation(libs.glide) + kapt(libs.glide.compiler) + + //compressor: 이미지 압축 + implementation(libs.compressor) + + // Coroutines for concurrency + implementation(libs.coroutines) + implementation(libs.coroutines.core) + implementation(libs.lifecycle.runtime) + + // Kakao login SDK + implementation(libs.kakao.login) + + // Hilt for Dependency Injection + implementation(libs.hilt) + kapt(libs.hilt.compiler) + + // ViewModel and LiveData + implementation(libs.lifecycle.viewmodel) + implementation(libs.lifecycle.livedata) + + // Firebase + implementation(libs.play.services.base) + implementation(libs.firebase.config) + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.analytics) + implementation(libs.firebase.crashlytics) + + + // Timber for logging + implementation(libs.timber) +} + +kapt { + correctErrorTypes = true +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index b1da94d2..e9a2e346 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/app/release/.DS_Store b/app/release/.DS_Store deleted file mode 100644 index 5008ddfc..00000000 Binary files a/app/release/.DS_Store and /dev/null differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2a5adf18..4e1d08b2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,7 +6,7 @@ - + - + + @@ -48,11 +54,7 @@ - - diff --git a/app/src/main/java/com/eatssu/android/base/BaseActivity.kt b/app/src/main/java/com/eatssu/android/base/BaseActivity.kt index 4d7284e3..687db424 100644 --- a/app/src/main/java/com/eatssu/android/base/BaseActivity.kt +++ b/app/src/main/java/com/eatssu/android/base/BaseActivity.kt @@ -69,9 +69,9 @@ abstract class BaseActivity( showForceUpdateDialog() } - if(versionViewModel.checkAndroidMessage().dialog) { - showAndroidMessageDialog(versionViewModel.checkAndroidMessage().message) - } +// if(versionViewModel.checkAndroidMessage().dialog) { +// showAndroidMessageDialog(versionViewModel.checkAndroidMessage().message) +// } _binding = bindingFactory(layoutInflater, findViewById(R.id.fl_content), true) } diff --git a/app/src/main/java/com/eatssu/android/data/dto/request/InquiriesRequest.kt b/app/src/main/java/com/eatssu/android/data/dto/request/InquiriesRequest.kt deleted file mode 100644 index 23288a0e..00000000 --- a/app/src/main/java/com/eatssu/android/data/dto/request/InquiriesRequest.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.eatssu.android.data.dto.request - -data class InquiriesRequest( - val content: String, -) diff --git a/app/src/main/java/com/eatssu/android/data/model/RestaurantInfo.kt b/app/src/main/java/com/eatssu/android/data/model/RestaurantInfo.kt index bf2cbff8..f33d2bdb 100644 --- a/app/src/main/java/com/eatssu/android/data/model/RestaurantInfo.kt +++ b/app/src/main/java/com/eatssu/android/data/model/RestaurantInfo.kt @@ -1,8 +1,12 @@ package com.eatssu.android.data.model +import com.eatssu.android.data.enums.Restaurant + data class RestaurantInfo( + val enum: Restaurant, val name: String, val location: String, + val photoUrl: String, val time: String, val etc: String, ) \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/data/model/Section.kt b/app/src/main/java/com/eatssu/android/data/model/Section.kt index 34c0443b..9234439d 100644 --- a/app/src/main/java/com/eatssu/android/data/model/Section.kt +++ b/app/src/main/java/com/eatssu/android/data/model/Section.kt @@ -7,5 +7,6 @@ data class Section( val menuType: MenuType, val cafeteria: Restaurant, val menuList: List?, + val cafeteriaLocation: String // val sortOrder: Int ) diff --git a/app/src/main/java/com/eatssu/android/data/repository/FirebaseRemoteConfigRepository.kt b/app/src/main/java/com/eatssu/android/data/repository/FirebaseRemoteConfigRepository.kt index f1b6a054..e18d3373 100644 --- a/app/src/main/java/com/eatssu/android/data/repository/FirebaseRemoteConfigRepository.kt +++ b/app/src/main/java/com/eatssu/android/data/repository/FirebaseRemoteConfigRepository.kt @@ -1,6 +1,7 @@ package com.eatssu.android.data.repository import com.eatssu.android.R +import com.eatssu.android.data.enums.Restaurant import com.eatssu.android.data.model.AndroidMessage import com.eatssu.android.data.model.RestaurantInfo import com.google.firebase.remoteconfig.FirebaseRemoteConfig @@ -65,7 +66,7 @@ class FirebaseRemoteConfigRepository { } fun getCafeteriaInfo(): ArrayList { - return parsingJson(instance.getString("cafeteria_info")) + return parsingJson(instance.getString("cafeteria_information")) } private fun parsingJson(json: String): ArrayList { @@ -75,12 +76,15 @@ class FirebaseRemoteConfigRepository { for (index in 0 until jsonArray.length()) { val jsonObject = jsonArray.getJSONObject(index) + val enumString = jsonObject.optString("enum", "") + val enumValue = enumValues().find { it.name == enumString } ?: Restaurant.HAKSIK val name = jsonObject.optString("name", "") val location = jsonObject.optString("location", "") + val photoUrl = jsonObject.optString("image", "") val time = jsonObject.optString("time", "") val etc = jsonObject.optString("etc", "") - val restaurantInfo = RestaurantInfo(name, location, time, etc) + val restaurantInfo = RestaurantInfo(enumValue, name, location, photoUrl, time, etc) Timber.d(restaurantInfo.toString()) list.add(restaurantInfo) } diff --git a/app/src/main/java/com/eatssu/android/data/repository/ReportRepository.kt b/app/src/main/java/com/eatssu/android/data/repository/ReportRepository.kt new file mode 100644 index 00000000..d41c1e37 --- /dev/null +++ b/app/src/main/java/com/eatssu/android/data/repository/ReportRepository.kt @@ -0,0 +1,13 @@ +package com.eatssu.android.data.repository + +import com.eatssu.android.base.BaseResponse +import com.eatssu.android.data.dto.request.ReportRequest +import kotlinx.coroutines.flow.Flow + +interface ReportRepository { + suspend fun reportReview( + body: ReportRequest, + ): Flow> + +} + diff --git a/app/src/main/java/com/eatssu/android/data/repository/ReportRepositoryImpl.kt b/app/src/main/java/com/eatssu/android/data/repository/ReportRepositoryImpl.kt new file mode 100644 index 00000000..4574b1f5 --- /dev/null +++ b/app/src/main/java/com/eatssu/android/data/repository/ReportRepositoryImpl.kt @@ -0,0 +1,18 @@ +package com.eatssu.android.data.repository + +import com.eatssu.android.base.BaseResponse +import com.eatssu.android.data.dto.request.ReportRequest +import com.eatssu.android.data.service.ReportService +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow +import javax.inject.Inject + +class ReportRepositoryImpl @Inject constructor(private val reportService: ReportService) : + ReportRepository { + + override suspend fun reportReview(body: ReportRequest): Flow> = + flow { + emit(reportService.reportReview(body)) + } + +} diff --git a/app/src/main/java/com/eatssu/android/data/service/InquiresService.kt b/app/src/main/java/com/eatssu/android/data/service/InquiresService.kt deleted file mode 100644 index 8eb6f6e6..00000000 --- a/app/src/main/java/com/eatssu/android/data/service/InquiresService.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.eatssu.android.data.service - -import com.eatssu.android.base.BaseResponse -import com.eatssu.android.data.dto.request.InquiriesRequest -import retrofit2.Call -import retrofit2.http.Body -import retrofit2.http.POST - -interface InquiresService { - @POST("inquiries/") // 문의 작성 - fun inquireContent( - @Body request: InquiriesRequest, - ): Call> - -} \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/data/service/ReportService.kt b/app/src/main/java/com/eatssu/android/data/service/ReportService.kt index 1552186c..0fd0177b 100644 --- a/app/src/main/java/com/eatssu/android/data/service/ReportService.kt +++ b/app/src/main/java/com/eatssu/android/data/service/ReportService.kt @@ -2,13 +2,12 @@ package com.eatssu.android.data.service import com.eatssu.android.base.BaseResponse import com.eatssu.android.data.dto.request.ReportRequest -import retrofit2.Call import retrofit2.http.Body import retrofit2.http.POST interface ReportService { @POST("reports") //리뷰 신고하기 - fun reportReview( + suspend fun reportReview( @Body request: ReportRequest, - ): Call> + ): BaseResponse } \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/data/service/ReviewService.kt b/app/src/main/java/com/eatssu/android/data/service/ReviewService.kt index 202efa41..dbdd33cd 100644 --- a/app/src/main/java/com/eatssu/android/data/service/ReviewService.kt +++ b/app/src/main/java/com/eatssu/android/data/service/ReviewService.kt @@ -23,7 +23,7 @@ interface ReviewService { @Path("reviewId") reviewId: Long, ): Call> - @PATCH("/review/{reviewId}") //리뷰 수정(글 수정) + @PATCH("/reviews/{reviewId}") //리뷰 수정(글 수정) fun modifyReview( @Path("reviewId") reviewId: Long, @Body request: ModifyReviewRequest, diff --git a/app/src/main/java/com/eatssu/android/data/usecase/PostReportUseCase.kt b/app/src/main/java/com/eatssu/android/data/usecase/PostReportUseCase.kt new file mode 100644 index 00000000..5406b461 --- /dev/null +++ b/app/src/main/java/com/eatssu/android/data/usecase/PostReportUseCase.kt @@ -0,0 +1,14 @@ +package com.eatssu.android.data.usecase + +import com.eatssu.android.base.BaseResponse +import com.eatssu.android.data.dto.request.ReportRequest +import com.eatssu.android.data.repository.ReportRepository +import kotlinx.coroutines.flow.Flow +import javax.inject.Inject + +class PostReportUseCase @Inject constructor( + private val reportRepository: ReportRepository, +) { + suspend operator fun invoke(body: ReportRequest): Flow> = + reportRepository.reportReview(body) +} \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/di/DataModule.kt b/app/src/main/java/com/eatssu/android/di/DataModule.kt index 0d663c37..ee24d5f7 100644 --- a/app/src/main/java/com/eatssu/android/di/DataModule.kt +++ b/app/src/main/java/com/eatssu/android/di/DataModule.kt @@ -3,6 +3,8 @@ package com.eatssu.android.di import com.eatssu.android.data.repository.OauthRepository import com.eatssu.android.data.repository.OauthRepositoryImpl +import com.eatssu.android.data.repository.ReportRepository +import com.eatssu.android.data.repository.ReportRepositoryImpl import com.eatssu.android.data.repository.UserRepository import com.eatssu.android.data.repository.UserRepositoryImpl import dagger.Binds @@ -24,4 +26,9 @@ abstract class DataModule { userRepositoryImpl: UserRepositoryImpl, ): UserRepository + @Binds + internal abstract fun bindsReportRepository( + reportRepositoryImpl: ReportRepositoryImpl, + ): ReportRepository + } \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/di/NetworkModule.kt b/app/src/main/java/com/eatssu/android/di/NetworkModule.kt index 02d925e1..79e283b7 100644 --- a/app/src/main/java/com/eatssu/android/di/NetworkModule.kt +++ b/app/src/main/java/com/eatssu/android/di/NetworkModule.kt @@ -2,7 +2,9 @@ package com.eatssu.android.di import com.eatssu.android.BuildConfig +import com.eatssu.android.BuildConfig.BASE_URL import com.eatssu.android.data.service.OauthService +import com.eatssu.android.data.service.ReportService import com.eatssu.android.data.service.UserService import com.eatssu.android.di.network.TokenInterceptor import dagger.Module @@ -34,8 +36,6 @@ class NullOnEmptyConverterFactory : Converter.Factory() { @InstallIn(SingletonComponent::class) object NetworkModule { - private const val BASE_URL = BuildConfig.BASE_URL - @Singleton @Provides fun provideOkHttpClient( @@ -75,4 +75,10 @@ object NetworkModule { fun provideUserService(retrofit: Retrofit): UserService { return retrofit.create(UserService::class.java) } + + @Provides + @Singleton + fun provideReportService(retrofit: Retrofit): ReportService { + return retrofit.create(ReportService::class.java) + } } \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/common/VersionViewModel.kt b/app/src/main/java/com/eatssu/android/ui/common/VersionViewModel.kt index 33dc9e1f..70cc73ef 100644 --- a/app/src/main/java/com/eatssu/android/ui/common/VersionViewModel.kt +++ b/app/src/main/java/com/eatssu/android/ui/common/VersionViewModel.kt @@ -2,7 +2,6 @@ package com.eatssu.android.ui.common import androidx.lifecycle.ViewModel import com.eatssu.android.BuildConfig.VERSION_CODE -import com.eatssu.android.data.model.AndroidMessage import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository import timber.log.Timber @@ -35,7 +34,7 @@ class VersionViewModel(private val repository: FirebaseRemoteConfigRepository) : return repository.getVersionCode() } - fun checkAndroidMessage(): AndroidMessage { - return repository.getAndroidMessage() - } +// fun checkAndroidMessage(): AndroidMessage { +// return repository.getAndroidMessage() +// } } \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/info/InfoBottomSheetFragment.kt b/app/src/main/java/com/eatssu/android/ui/info/InfoBottomSheetFragment.kt new file mode 100644 index 00000000..bf583f48 --- /dev/null +++ b/app/src/main/java/com/eatssu/android/ui/info/InfoBottomSheetFragment.kt @@ -0,0 +1,119 @@ +package com.eatssu.android.ui.info + +import android.os.Bundle +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.lifecycle.ViewModelProvider +import com.bumptech.glide.Glide +import com.eatssu.android.data.enums.Restaurant +import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository +import com.eatssu.android.databinding.FragmentBottomsheetInfoBinding +import com.google.android.material.bottomsheet.BottomSheetDialogFragment + +class InfoBottomSheetFragment : BottomSheetDialogFragment() { + private var _binding: FragmentBottomsheetInfoBinding? = null + private val binding get() = _binding!! + + private lateinit var infoViewModel: InfoViewModel + private lateinit var firebaseRemoteConfigRepository: FirebaseRemoteConfigRepository + + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + _binding = FragmentBottomsheetInfoBinding.inflate(inflater, container, false) + + firebaseRemoteConfigRepository = FirebaseRemoteConfigRepository() + infoViewModel = ViewModelProvider( + this, + InfoViewModelFactory(firebaseRemoteConfigRepository) + )[InfoViewModel::class.java] + + return binding.root + } + + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + // 전달된 데이터 받기 + val name = arguments?.getString("name") + val restaurantType = enumValues().find { it.name == name } ?: Restaurant.HAKSIK + Log.d("InfoBottomSheetFragment", "onViewCreated: $name $restaurantType") + + binding.tvName.text = restaurantType.displayName + + //TODO 방법 개선 + infoViewModel.infoList.observe(this) { + + when (restaurantType) { + Restaurant.DODAM -> { + binding.tvLocation.text = infoViewModel.dodamLocation.value + binding.tvTime.text = infoViewModel.dodamTime.value + binding.tvEtc.text = infoViewModel.dodamEtc.value + + Glide.with(this) + .load(infoViewModel.dodamPhotoUrl.value) + .into(binding.ivCafeteriaPhoto) + } + + Restaurant.HAKSIK -> { + binding.tvLocation.text = infoViewModel.haksikLocation.value + binding.tvTime.text = infoViewModel.haksikTime.value + binding.tvEtc.text = infoViewModel.haksikEtc.value + + Glide.with(this) + .load(infoViewModel.haksikPhotoUrl.value) + .into(binding.ivCafeteriaPhoto) + } + + Restaurant.FOOD_COURT -> { + binding.tvLocation.text = infoViewModel.foodLocation.value + binding.tvTime.text = infoViewModel.foodTime.value + binding.tvEtc.text = infoViewModel.foodEtc.value + + Glide.with(this) + .load(infoViewModel.foodPhotoUrl.value) + .into(binding.ivCafeteriaPhoto) + } + + Restaurant.SNACK_CORNER -> { + binding.tvLocation.text = infoViewModel.snackLocation.value + binding.tvTime.text = infoViewModel.snackTime.value + binding.tvEtc.text = infoViewModel.snackEtc.value + + Glide.with(this) + .load(infoViewModel.snackPhotoUrl.value) + .into(binding.ivCafeteriaPhoto) + } + + Restaurant.DORMITORY -> { + binding.tvLocation.text = infoViewModel.dormitoryLocation.value + binding.tvTime.text = infoViewModel.dormitoryTime.value + binding.tvEtc.text = infoViewModel.dormitoryEtc.value + + Glide.with(this) + .load(infoViewModel.dormitoryPhotoUrl.value) + .into(binding.ivCafeteriaPhoto) + } + + else -> {} + } + } + } + + companion object { + // newInstance 메서드를 통해 데이터를 전달하는 방법 + fun newInstance(data: String): InfoBottomSheetFragment { + val fragment = InfoBottomSheetFragment() + val args = Bundle() + args.putString("name", data) + fragment.arguments = args + return fragment + } + } +} diff --git a/app/src/main/java/com/eatssu/android/ui/info/InfoViewModel.kt b/app/src/main/java/com/eatssu/android/ui/info/InfoViewModel.kt index e80b52ab..84598b55 100644 --- a/app/src/main/java/com/eatssu/android/ui/info/InfoViewModel.kt +++ b/app/src/main/java/com/eatssu/android/ui/info/InfoViewModel.kt @@ -3,6 +3,7 @@ package com.eatssu.android.ui.info import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel +import com.eatssu.android.data.enums.Restaurant import com.eatssu.android.data.model.RestaurantInfo import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository @@ -11,22 +12,27 @@ class InfoViewModel(firebaseRemoteConfigRepository: FirebaseRemoteConfigReposito val infoList: MutableLiveData> = MutableLiveData() val dodamLocation = MutableLiveData() + val dodamPhotoUrl = MutableLiveData() val dodamTime = MutableLiveData() val dodamEtc = MutableLiveData() val foodLocation = MutableLiveData() + val foodPhotoUrl = MutableLiveData() val foodTime = MutableLiveData() val foodEtc = MutableLiveData() val dormitoryLocation = MutableLiveData() + val dormitoryPhotoUrl = MutableLiveData() val dormitoryTime = MutableLiveData() val dormitoryEtc = MutableLiveData() val snackLocation = MutableLiveData() + val snackPhotoUrl = MutableLiveData() val snackTime = MutableLiveData() val snackEtc = MutableLiveData() val haksikLocation = MutableLiveData() + val haksikPhotoUrl = MutableLiveData() val haksikTime = MutableLiveData() val haksikEtc = MutableLiveData() @@ -34,28 +40,33 @@ class InfoViewModel(firebaseRemoteConfigRepository: FirebaseRemoteConfigReposito infoList.value = firebaseRemoteConfigRepository.getCafeteriaInfo() Log.d("InfoViewModel",infoList.value.toString()) - val dodam = infoList.value!!.find { it.name == "숭실도담" } + val dodam = infoList.value!!.find { it.enum == Restaurant.DODAM } + dodamPhotoUrl.value = dodam?.photoUrl ?: "" dodamTime.value = dodam?.time ?: "" dodamLocation.value = dodam?.location ?: "" dodamEtc.value = dodam?.etc ?: "" - val food = infoList.value!!.find { it.name == "FOOD COURT" } + val food = infoList.value!!.find { it.enum == Restaurant.FOOD_COURT } + foodPhotoUrl.value = food?.photoUrl ?: "" foodTime.value = food?.time ?: "" foodLocation.value = food?.location ?: "" foodEtc.value = food?.etc ?: "" - val dormitory = infoList.value!!.find { it.name == "기숙사 식당" } + val dormitory = infoList.value!!.find { it.enum == Restaurant.DORMITORY } + dormitoryPhotoUrl.value = dormitory?.photoUrl ?: "" dormitoryTime.value = dormitory?.time ?: "" dormitoryLocation.value = dormitory?.location ?: "" dormitoryEtc.value = dormitory?.etc ?: "" - val snack = infoList.value!!.find { it.name == "스낵코너" } + val snack = infoList.value!!.find { it.enum == Restaurant.SNACK_CORNER } + snackPhotoUrl.value = snack?.photoUrl ?: "" snackTime.value = snack?.time ?: "" snackLocation.value = snack?.location ?: "" snackEtc.value = snack?.etc ?: "" - val haksik = infoList.value!!.find { it.name == "학생식당" } - haksikTime.value = haksik?.time ?: "tlqof" + val haksik = infoList.value!!.find { it.enum == Restaurant.HAKSIK } + haksikPhotoUrl.value = haksik?.photoUrl ?: "" + haksikTime.value = haksik?.time ?: "" haksikLocation.value = haksik?.location ?: "" haksikEtc.value = haksik?.etc ?: "" } diff --git a/app/src/main/java/com/eatssu/android/ui/main/ViewPager2Adapter.kt b/app/src/main/java/com/eatssu/android/ui/main/ViewPager2Adapter.kt index d7eebc2e..32b390b6 100644 --- a/app/src/main/java/com/eatssu/android/ui/main/ViewPager2Adapter.kt +++ b/app/src/main/java/com/eatssu/android/ui/main/ViewPager2Adapter.kt @@ -1,11 +1,13 @@ package com.eatssu.android.ui.main -import android.util.Log +import android.os.Build +import androidx.annotation.RequiresApi import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity import androidx.viewpager2.adapter.FragmentStateAdapter import com.eatssu.android.data.enums.Time import com.eatssu.android.ui.main.menu.MenuFragment +import java.time.LocalTime class ViewPager2Adapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) { @@ -33,9 +35,19 @@ class ViewPager2Adapter(fragmentActivity: FragmentActivity) : } // 4. 디폴트로 노출할 Fragment의 위치를 설정 + @RequiresApi(Build.VERSION_CODES.O) fun getDefaultFragmentPosition(): Int { // 여기에서 디폴트로 노출할 Fragment의 위치를 반환해줍니다. // 예를 들어, 첫 번째 Fragment를 디폴트로 설정하려면 0을 반환합니다. - return 1 + + val time = LocalTime.now() + + val selectedIndex: Int = when (time.hour) { + in 0..9 -> 0 //아침 + in 10..15 -> 1 //점심 + in 16..24 -> 2 //저녁 + else -> 1 + } + return selectedIndex } } diff --git a/app/src/main/java/com/eatssu/android/ui/main/calendar/CalendarAdapter.kt b/app/src/main/java/com/eatssu/android/ui/main/calendar/CalendarAdapter.kt index 5ef2e128..421ee62d 100644 --- a/app/src/main/java/com/eatssu/android/ui/main/calendar/CalendarAdapter.kt +++ b/app/src/main/java/com/eatssu/android/ui/main/calendar/CalendarAdapter.kt @@ -1,9 +1,7 @@ package com.eatssu.android.ui.main.calendar -import android.os.Build import android.view.LayoutInflater import android.view.ViewGroup -import androidx.annotation.RequiresApi import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.eatssu.android.R @@ -11,7 +9,7 @@ import com.eatssu.android.databinding.ItemCalendarListBinding import com.eatssu.android.util.CalendarUtils import java.time.LocalDate import java.time.format.TextStyle -import java.util.* +import java.util.Locale internal class CalendarAdapter( @@ -34,7 +32,6 @@ internal class CalendarAdapter( } - @RequiresApi(Build.VERSION_CODES.O) override fun onBindViewHolder(holder: CalendarViewHolder, position: Int) { val date = days[position] holder.dayOfMonth.text = date.dayOfMonth.toString() @@ -42,9 +39,9 @@ internal class CalendarAdapter( date.dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN).toString() if (date == CalendarUtils.selectedDate) { - holder.parentView.setBackgroundResource(R.drawable.selector_background_blue) + //날짜 + holder.dayOfMonth.setBackgroundResource(R.drawable.selector_background_blue) holder.dayOfMonth.setTextColor(ContextCompat.getColor(holder.itemView.context, R.color.selector_calendar_colortext)) - holder.dayText.setTextColor(ContextCompat.getColor(holder.itemView.context, R.color.selector_calendar_colortext)) } else { holder.parentView.setBackgroundResource(R.drawable.ic_selector_background_white) diff --git a/app/src/main/java/com/eatssu/android/ui/main/menu/MenuAdapter.kt b/app/src/main/java/com/eatssu/android/ui/main/menu/MenuAdapter.kt index d9347da2..da7f67e6 100644 --- a/app/src/main/java/com/eatssu/android/ui/main/menu/MenuAdapter.kt +++ b/app/src/main/java/com/eatssu/android/ui/main/menu/MenuAdapter.kt @@ -1,33 +1,48 @@ package com.eatssu.android.ui.main.menu -import android.content.Intent +import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup -import androidx.core.content.ContextCompat +import androidx.fragment.app.DialogFragment +import androidx.fragment.app.FragmentManager import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.eatssu.android.R import com.eatssu.android.data.model.Section -import com.eatssu.android.databinding.ItemSectionBinding -import com.eatssu.android.ui.info.InfoActivity +import com.eatssu.android.databinding.ItemCafeteriaSectionBinding +import com.eatssu.android.ui.info.InfoBottomSheetFragment class MenuAdapter( + private val fragmentManager: FragmentManager, private val totalMenuList: ArrayList
) : RecyclerView.Adapter() { class MyViewHolder( - private val binding: ItemSectionBinding + private val binding: ItemCafeteriaSectionBinding ) : RecyclerView.ViewHolder(binding.root) { - fun bind(sectionModel: Section) { + fun bind( + fragmentManager: FragmentManager, + sectionModel: Section + ) { + binding.btnInfo.setOnClickListener { - val intent = Intent(itemView.context, InfoActivity::class.java) - intent.putExtra("restaurantType", sectionModel.cafeteria) - ContextCompat.startActivity(itemView.context, intent, null) + + val modalBottomSheet = + InfoBottomSheetFragment.newInstance(sectionModel.cafeteria.name) + modalBottomSheet.setStyle( + DialogFragment.STYLE_NORMAL, + R.style.RoundCornerBottomSheetDialogTheme + ) + modalBottomSheet.show(fragmentManager, "Open Bottom Sheet") + Log.d("MenuAdapter", "bind: ${sectionModel.cafeteria}") } binding.tvCafeteria.text = sectionModel.cafeteria.displayName + binding.tvCafeteriaLocation.text = sectionModel.cafeteriaLocation + binding.rvMenu.apply { setHasFixedSize(true) layoutManager = LinearLayoutManager(binding.root.context) @@ -39,14 +54,15 @@ class MenuAdapter( } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { - return MyViewHolder(ItemSectionBinding.inflate( + return MyViewHolder( + ItemCafeteriaSectionBinding.inflate( LayoutInflater.from(parent.context), parent, false)) } override fun onBindViewHolder(holder: MyViewHolder, position: Int) { totalMenuList[position].let { sectionModel -> - holder.bind(sectionModel) + holder.bind(fragmentManager, sectionModel) } } diff --git a/app/src/main/java/com/eatssu/android/ui/main/menu/MenuFragment.kt b/app/src/main/java/com/eatssu/android/ui/main/menu/MenuFragment.kt index b9d89a4d..9a96b5df 100644 --- a/app/src/main/java/com/eatssu/android/ui/main/menu/MenuFragment.kt +++ b/app/src/main/java/com/eatssu/android/ui/main/menu/MenuFragment.kt @@ -17,9 +17,12 @@ import com.eatssu.android.data.enums.MenuType import com.eatssu.android.data.enums.Restaurant import com.eatssu.android.data.enums.Time import com.eatssu.android.data.model.Section +import com.eatssu.android.data.repository.FirebaseRemoteConfigRepository import com.eatssu.android.data.service.MealService import com.eatssu.android.data.service.MenuService import com.eatssu.android.databinding.FragmentMenuBinding +import com.eatssu.android.ui.info.InfoViewModel +import com.eatssu.android.ui.info.InfoViewModelFactory import com.eatssu.android.ui.main.calendar.CalendarViewModel import com.eatssu.android.util.RetrofitImpl import java.time.DayOfWeek @@ -38,6 +41,7 @@ class MenuFragment : Fragment() { private lateinit var mealService: MealService private lateinit var menuDate: String + private lateinit var cafeteriaLocation: String val foodCourtDataLoaded = MutableLiveData() val snackCornerDataLoaded = MutableLiveData() @@ -47,6 +51,10 @@ class MenuFragment : Fragment() { private val totalMenuList = ArrayList
() + private lateinit var infoViewModel: InfoViewModel + private lateinit var restaurantType: Restaurant + private lateinit var firebaseRemoteConfigRepository: FirebaseRemoteConfigRepository + companion object { fun newInstance(time: Time): MenuFragment { @@ -67,6 +75,13 @@ class MenuFragment : Fragment() { savedInstanceState: Bundle?, ): View { _binding = FragmentMenuBinding.inflate(inflater, container, false) + + firebaseRemoteConfigRepository = FirebaseRemoteConfigRepository() + infoViewModel = ViewModelProvider( + this, + InfoViewModelFactory(firebaseRemoteConfigRepository) + )[InfoViewModel::class.java] + return binding.root } @@ -129,7 +144,8 @@ class MenuFragment : Fragment() { Section( MenuType.FIXED, Restaurant.FOOD_COURT, - result.mapFixedMenuResponseToMenu() + result.mapFixedMenuResponseToMenu(), + infoViewModel.foodLocation.value.toString() ) ) } @@ -146,7 +162,8 @@ class MenuFragment : Fragment() { Section( MenuType.FIXED, Restaurant.SNACK_CORNER, - result.mapFixedMenuResponseToMenu() + result.mapFixedMenuResponseToMenu(), + infoViewModel.snackLocation.value.toString() ) ) } @@ -180,7 +197,8 @@ class MenuFragment : Fragment() { Section( MenuType.VARIABLE, Restaurant.HAKSIK, - result.mapTodayMenuResponseToMenu() + result.mapTodayMenuResponseToMenu(), + infoViewModel.haksikLocation.value.toString() ) ) @@ -198,7 +216,8 @@ class MenuFragment : Fragment() { Section( MenuType.VARIABLE, Restaurant.DODAM, - result.mapTodayMenuResponseToMenu() + result.mapTodayMenuResponseToMenu(), + infoViewModel.dodamLocation.value.toString() ) ) } @@ -214,7 +233,8 @@ class MenuFragment : Fragment() { Section( MenuType.VARIABLE, Restaurant.DORMITORY, - result.mapTodayMenuResponseToMenu() + result.mapTodayMenuResponseToMenu(), + infoViewModel.dormitoryLocation.value.toString() ) ) } @@ -228,7 +248,7 @@ class MenuFragment : Fragment() { binding.rv.apply { setHasFixedSize(true) layoutManager = LinearLayoutManager(context) - adapter = MenuAdapter(totalMenuList) + adapter = fragmentManager?.let { MenuAdapter(it, totalMenuList) } } } diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/DeveloperActivity.kt b/app/src/main/java/com/eatssu/android/ui/mypage/DeveloperActivity.kt new file mode 100644 index 00000000..39688525 --- /dev/null +++ b/app/src/main/java/com/eatssu/android/ui/mypage/DeveloperActivity.kt @@ -0,0 +1,17 @@ +package com.eatssu.android.ui.mypage + +import android.os.Bundle +import com.eatssu.android.R +import com.eatssu.android.base.BaseActivity +import com.eatssu.android.databinding.ActivityDeveloperBinding +import dagger.hilt.android.AndroidEntryPoint + +@AndroidEntryPoint +class DeveloperActivity : + BaseActivity(ActivityDeveloperBinding::inflate) { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + toolbarTitle.text = getString(R.string.developer) // 툴바 제목 설정 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/MyPageActivity.kt b/app/src/main/java/com/eatssu/android/ui/mypage/MyPageActivity.kt index fb23892f..eaa816d9 100644 --- a/app/src/main/java/com/eatssu/android/ui/mypage/MyPageActivity.kt +++ b/app/src/main/java/com/eatssu/android/ui/mypage/MyPageActivity.kt @@ -15,7 +15,6 @@ import com.eatssu.android.databinding.ActivityMyPageBinding import com.eatssu.android.ui.common.VersionViewModel import com.eatssu.android.ui.common.VersionViewModelFactory import com.eatssu.android.ui.login.LoginActivity -import com.eatssu.android.ui.mypage.inquire.InquireActivity import com.eatssu.android.ui.mypage.myreview.MyReviewListActivity import com.eatssu.android.ui.mypage.terms.WebViewActivity import com.eatssu.android.ui.mypage.usernamechange.UserNameChangeActivity @@ -64,7 +63,10 @@ class MyPageActivity : BaseActivity(ActivityMyPageBinding } binding.llInquire.setOnClickListener { - startActivity() + val intent = Intent(this, WebViewActivity::class.java) + intent.putExtra("URL", getString(R.string.kakao_talk_channel_url)) + intent.putExtra("TITLE", getString(R.string.contact)) + startActivity(intent) } binding.llMyReview.setOnClickListener { @@ -76,7 +78,14 @@ class MyPageActivity : BaseActivity(ActivityMyPageBinding } binding.tvSignout.setOnClickListener { - showSignoutDialog() + val intent = Intent(this, SignOutActivity::class.java) + intent.putExtra("nickname", myPageViewModel.uiState.value.nickname) + startActivity(intent) +// showSignoutDialog() + } + + binding.llDeveloper.setOnClickListener { + startActivity() } binding.llStoreAppVersion.setOnClickListener { diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/SignOutActivity.kt b/app/src/main/java/com/eatssu/android/ui/mypage/SignOutActivity.kt new file mode 100644 index 00000000..883d54cd --- /dev/null +++ b/app/src/main/java/com/eatssu/android/ui/mypage/SignOutActivity.kt @@ -0,0 +1,76 @@ +package com.eatssu.android.ui.mypage + +import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher +import androidx.activity.viewModels +import androidx.lifecycle.lifecycleScope +import com.eatssu.android.base.BaseActivity +import com.eatssu.android.databinding.ActivitySignOutBinding +import com.eatssu.android.util.extension.showToast +import dagger.hilt.android.AndroidEntryPoint +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +@AndroidEntryPoint +class SignOutActivity : + BaseActivity(ActivitySignOutBinding::inflate) { + //TODO 현재 dev서버 탈퇴하기 500 + + private val signOutViewModel: SignOutViewModel by viewModels() + + private var inputNickname: String = "" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + toolbarTitle.text = "탈퇴하기" // 툴바 제목 설정 + + val nickname = intent.getStringExtra("nickname") + + binding.btnSignOut.isEnabled = false + +// binding.etEnterNickname.hint = + binding.etEnterNickname.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} + + //값 변경 시 실행되는 함수 + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { + if (nickname != null) { + checkNickname(nickname) + } + } + + override fun afterTextChanged(p0: Editable?) {} + }) + + setOnClickListener() + } + + + private fun setOnClickListener() { + binding.btnSignOut.setOnClickListener { + signOutViewModel.signOut() + + lifecycleScope.launch { + signOutViewModel.uiState.collectLatest { + if (it.isSignOuted) { + showToast(it.toastMessage) //Todo 사용가능 토스트가 무슨 3번이나 나옴 + } else { + showToast(it.toastMessage) //Todo 사용가능 토스트가 무슨 3번이나 나옴 + } + } + } + } + } + + fun checkNickname(nickname: String) { + //입력값 담기 + inputNickname = binding.etEnterNickname.text.trim().toString() + // 값 유무에 따른 활성화 여부 + if (inputNickname == nickname) { + binding.btnSignOut.isEnabled = true + } else { + binding.btnSignOut.isEnabled = false + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/SignOutViewModel.kt b/app/src/main/java/com/eatssu/android/ui/mypage/SignOutViewModel.kt new file mode 100644 index 00000000..91c76fbe --- /dev/null +++ b/app/src/main/java/com/eatssu/android/ui/mypage/SignOutViewModel.kt @@ -0,0 +1,78 @@ +package com.eatssu.android.ui.mypage + +import android.util.Log +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.eatssu.android.data.usecase.GetUserInfoUseCase +import com.eatssu.android.data.usecase.LogoutUseCase +import com.eatssu.android.data.usecase.SetAccessTokenUseCase +import com.eatssu.android.data.usecase.SetRefreshTokenUseCase +import com.eatssu.android.data.usecase.SignOutUseCase +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.catch +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.onCompletion +import kotlinx.coroutines.flow.onStart +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import javax.inject.Inject + +@HiltViewModel +class SignOutViewModel @Inject constructor( + private val logoutUseCase: LogoutUseCase, + private val signOutUseCase: SignOutUseCase, + private val getUserInfoUseCase: GetUserInfoUseCase, + private val setAccessTokenUseCase: SetAccessTokenUseCase, + private val setRefreshTokenUseCase: SetRefreshTokenUseCase, +) : ViewModel() { + + private val _uiState: MutableStateFlow = MutableStateFlow(SignOutState()) + val uiState: StateFlow = _uiState.asStateFlow() + + fun signOut() { + viewModelScope.launch { + signOutUseCase().onStart { + _uiState.update { it.copy(loading = true) } + }.onCompletion { + _uiState.update { it.copy(loading = false, error = true) } + }.catch { e -> + _uiState.update { it.copy(error = true, toastMessage = "정보를 불러올 수 없습니다.") } + Log.d(TAG, e.toString()) + + }.collectLatest { result -> + Log.d(TAG, result.toString()) + if (result.result == true) { + logoutUseCase() + _uiState.update { + it.copy( + isSignOuted = true, + toastMessage = "탈퇴가 완료되었습니다." + ) + } + } + } + } + } + + companion object { + val TAG = "SignOutViewModel" + } +} + + +data class SignOutState( + var loading: Boolean = true, + var error: Boolean = false, + + var toastMessage: String = "", + + var nickname: String = "", + var platform: String = "", + + var isNicknameNull: Boolean = false, + var isLoginOuted: Boolean = false, + var isSignOuted: Boolean = false, +) \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireActivity.kt b/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireActivity.kt deleted file mode 100644 index 549310d2..00000000 --- a/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireActivity.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.eatssu.android.ui.mypage.inquire - -import android.os.Bundle -import androidx.lifecycle.ViewModelProvider -import androidx.lifecycle.lifecycleScope -import com.eatssu.android.base.BaseActivity -import com.eatssu.android.data.service.InquiresService -import com.eatssu.android.databinding.ActivityInquireBinding -import com.eatssu.android.util.MySharedPreferences -import com.eatssu.android.util.RetrofitImpl -import com.eatssu.android.util.extension.showToast -import kotlinx.coroutines.flow.collectLatest -import kotlinx.coroutines.launch - -class InquireActivity : BaseActivity(ActivityInquireBinding::inflate) { - private lateinit var inquiresService: InquiresService - private lateinit var inquireViewModel: InquireViewModel - - private var content = "" - private var email = "" - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - toolbarTitle.text = "문의하기" // 툴바 제목 설정 - - initViewModel() - bindData() - setOnClickListener() - } - - override fun onResume() { - super.onResume() - } - - private fun initViewModel() { - inquiresService = RetrofitImpl.retrofit.create(InquiresService::class.java); - inquireViewModel = ViewModelProvider( - this, - InquireViewModelFactory(inquiresService) - )[InquireViewModel::class.java] - } - - private fun bindData() { - - content = binding.etReportComment.text.toString() - - // 카카오 로그인으로 받아온 이메일 정보 가져오기 - val userEmail = MySharedPreferences.getUserEmail(this) - - // EditText에 이메일 정보 설정 - binding.etEmail.setText(userEmail) - // EditText를 편집 가능하게 만들기 - binding.etEmail.isEnabled = true - - - } - - private fun setOnClickListener() { - binding.btnSendReport.setOnClickListener { - inquireViewModel.inquireContent(content) - - lifecycleScope.launch { - inquireViewModel.uiState.collectLatest { - if (!it.error && !it.loading) { - showToast(it.toastMessage) - finish() - } - if (it.error) { - showToast(it.toastMessage) - } - } - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireViewModel.kt b/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireViewModel.kt deleted file mode 100644 index b166e158..00000000 --- a/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireViewModel.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.eatssu.android.ui.mypage.inquire - -import android.util.Log -import androidx.lifecycle.ViewModel -import com.eatssu.android.base.BaseResponse -import com.eatssu.android.data.dto.request.InquiriesRequest -import com.eatssu.android.data.service.InquiresService -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.update -import retrofit2.Call -import retrofit2.Callback -import retrofit2.Response - - -class InquireViewModel(private val inquiresService: InquiresService) : ViewModel() { - - private val _uiState: MutableStateFlow = MutableStateFlow(InquireState()) - val uiState: StateFlow = _uiState.asStateFlow() - - fun inquireContent(content: String) { - inquiresService.inquireContent(InquiriesRequest(content)) - .enqueue(object : Callback> { - override fun onResponse( - call: Call>, - response: Response>, - ) { - if (response.isSuccessful) { - if (response.code() == 200) { - Log.d( - "InquireActivity", - "onResponse 성공: 문의하기" + response.body().toString() - ) - - _uiState.update { - it.copy( - loading = false, - error = false, - toastMessage = "문의가 완료되었습니다." - ) - } - - } else { - Log.d( - "InquireActivity", - "onResponse 오류: 문의하기" + response.body().toString() - ) - _uiState.update { - it.copy( - loading = false, - error = true, - toastMessage = "문의 진행 중 오류가 발생하였습니다." - ) - } - } - } - } - - override fun onFailure(call: Call>, t: Throwable) { - Log.d("InquireActivity", "onFailure 에러: 문의하기" + t.message.toString()) - _uiState.update { - it.copy( - loading = false, - error = true, - toastMessage = "문의 진행 중 오류가 발생하였습니다." - ) - } - } - }) - } -} - -data class InquireState( - var loading: Boolean = true, - var error: Boolean = false, - var toastMessage: String = "", -) \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireViewModelFactory.kt b/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireViewModelFactory.kt deleted file mode 100644 index ba61c11d..00000000 --- a/app/src/main/java/com/eatssu/android/ui/mypage/inquire/InquireViewModelFactory.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.eatssu.android.ui.mypage.inquire - -import androidx.lifecycle.ViewModel -import androidx.lifecycle.ViewModelProvider -import com.eatssu.android.data.service.InquiresService - -class InquireViewModelFactory(private val inquiresService: InquiresService) : - ViewModelProvider.Factory { - - override fun create(modelClass: Class): T { - if (modelClass.isAssignableFrom(InquireViewModel::class.java)) { - @Suppress("UNCHECKED_CAST") - return InquireViewModel(inquiresService) as T - } - throw IllegalArgumentException("Unknown ViewModel class") - } -} - diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/myreview/MyReviewAdapter.kt b/app/src/main/java/com/eatssu/android/ui/mypage/myreview/MyReviewAdapter.kt index af6efcad..1c1a87d1 100644 --- a/app/src/main/java/com/eatssu/android/ui/mypage/myreview/MyReviewAdapter.kt +++ b/app/src/main/java/com/eatssu/android/ui/mypage/myreview/MyReviewAdapter.kt @@ -25,9 +25,7 @@ class MyReviewAdapter(private val dataList: List) : binding.tvReviewItemComment.text = dataList[position].content binding.tvReviewItemDate.text = dataList[position].writeDate binding.tvMenuName.text = dataList[position].menu - binding.tvTotalRating.text = dataList[position].mainGrade.toString() - binding.tvTasteRating.text = dataList[position].tasteGrade.toString() - binding.tvAmountRating.text = dataList[position].amountGrade.toString() + binding.rbRate.rating = dataList[position].mainGrade.toFloat() binding.tvWriterNickname.text = MySharedPreferences.getUserName(binding.root.context) val imageView: ImageView = binding.ivReviewPhoto @@ -50,10 +48,17 @@ class MyReviewAdapter(private val dataList: List) : val intent = Intent(binding.btnDetail.context, MyReviewDialogActivity::class.java) intent.putExtra("reviewId", dataList[position].reviewId) intent.putExtra("menu", dataList[position].menu) - intent.putExtra("comment", dataList[position].content) - intent.putExtra("amountRating", dataList[position].amountGrade) - intent.putExtra("tasteRating", dataList[position].tasteGrade) - intent.putExtra("mainRating", dataList[position].mainGrade) + + intent.putExtra("content", dataList[position].content) + + intent.putExtra("mainGrade", dataList[position].mainGrade) + intent.putExtra("amountGrade", dataList[position].amountGrade) + intent.putExtra("tasteGrade", dataList[position].tasteGrade) + + Log.d("ReviewFixedActivity", "전전:" + dataList[position].reviewId) + Log.d("ReviewFixedActivity", "전전:" + dataList[position].menu) + Log.d("ReviewFixedActivity", "전전:" + dataList[position].content) +//// ContextCompat.startActivity(binding.btnDetail.context, intent, null) } } diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeActivity.kt b/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeActivity.kt index 282aec6b..2412f989 100644 --- a/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeActivity.kt +++ b/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeActivity.kt @@ -5,6 +5,7 @@ import android.text.Editable import android.text.TextWatcher import androidx.activity.viewModels import androidx.lifecycle.lifecycleScope +import com.eatssu.android.R import com.eatssu.android.base.BaseActivity import com.eatssu.android.databinding.ActivityUserNameChangeBinding import com.eatssu.android.util.extension.showToast @@ -13,7 +14,8 @@ import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch @AndroidEntryPoint -class UserNameChangeActivity : BaseActivity(ActivityUserNameChangeBinding::inflate) { +class UserNameChangeActivity : + BaseActivity(ActivityUserNameChangeBinding::inflate) { private val userNameChangeViewModel: UserNameChangeViewModel by viewModels() @@ -21,6 +23,7 @@ class UserNameChangeActivity : BaseActivity(Activ private var force: Boolean = false + private var nicknameDuplicate: Boolean = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,7 +33,6 @@ class UserNameChangeActivity : BaseActivity(Activ force = intent.getBooleanExtra("force", false) //Todo null 일때 한정으로 화면에서 못 벗어나게 기능 추가 - binding.btnCheckNickname.isEnabled = false binding.btnComplete.isEnabled = false @@ -45,7 +47,24 @@ class UserNameChangeActivity : BaseActivity(Activ if (binding.etChNickname.text != null) { val nicknameLength = inputNickname.length binding.btnCheckNickname.isEnabled = nicknameLength in 2..8 + + if (nicknameLength !in 2..8) { + binding.btnComplete.isEnabled = false + binding.btnCheckNickname.isEnabled = false + binding.tvNickname28.setTextColor(getColor(R.color.error)) + binding.tvNickname28.text = getString(R.string.set_nickname_2_8) + binding.etChNickname.setBackgroundResource(R.drawable.shape_text_field_small_red) + } else { + binding.tvNickname28.setTextColor(getColor(R.color.gray600)) + + } } + /* + 2~8 안되면 중복확인, 완료 둘다 X -> 빨간 보더 + 2~8 되면 중복확인 O, 완료 X + 2~8 되고 중복 통과 안되면 -> 발간 보더, 완료 X + */ + } override fun afterTextChanged(p0: Editable?) {} @@ -73,11 +92,20 @@ class UserNameChangeActivity : BaseActivity(Activ userNameChangeViewModel.uiState.collectLatest { if (it.isEnableName) { binding.btnComplete.isEnabled = true - showToast(it.toastMessage) //Todo 사용가능 토스트가 무슨 3번이나 나옴 + binding.tvNickname28.text = getString(R.string.set_nickname_able) + binding.etChNickname.setBackgroundResource(R.drawable.shape_text_field_small) + binding.tvNickname28.setTextColor(getColor(R.color.gray600)) + + + } else { + binding.btnComplete.isEnabled = false + binding.etChNickname.setBackgroundResource(R.drawable.shape_text_field_small_red) + binding.tvNickname28.text = getString(R.string.set_nickname_unable) + binding.tvNickname28.setTextColor(getColor(R.color.error)) +// showToast(it.toastMessage) //Todo 사용가능 토스트가 무슨 3번이나 나옴 } } } - } binding.btnComplete.setOnClickListener { diff --git a/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeViewModel.kt b/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeViewModel.kt index 055912a7..9ea99a02 100644 --- a/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeViewModel.kt +++ b/app/src/main/java/com/eatssu/android/ui/mypage/usernamechange/UserNameChangeViewModel.kt @@ -47,7 +47,12 @@ class UserNameChangeViewModel @Inject constructor( ) } } else { - _uiState.update { it.copy(toastMessage = "이미 사용 중인 닉네임 입니다.") } + _uiState.update { + it.copy( + isEnableName = false, + toastMessage = "이미 사용 중인 닉네임 입니다." + ) + } } } } diff --git a/app/src/main/java/com/eatssu/android/ui/review/delete/MyReviewDialogActivity.kt b/app/src/main/java/com/eatssu/android/ui/review/delete/MyReviewDialogActivity.kt index 8eabca5b..514450da 100644 --- a/app/src/main/java/com/eatssu/android/ui/review/delete/MyReviewDialogActivity.kt +++ b/app/src/main/java/com/eatssu/android/ui/review/delete/MyReviewDialogActivity.kt @@ -14,27 +14,42 @@ import com.eatssu.android.ui.review.modify.ModifyReviewActivity class MyReviewDialogActivity : AppCompatActivity() { private lateinit var binding: ActivityMyReviewDialogBinding private lateinit var viewModel: DeleteViewModel + var reviewId = -1L var menu = "" + var content = "" + var mainGrade = -1 + var amountGrade = -1 + var tasteGrade = -1 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMyReviewDialogBinding.inflate(layoutInflater) - setContentView(binding.root) viewModel = ViewModelProvider(this).get(DeleteViewModel::class.java) reviewId = intent.getLongExtra("reviewId", -1L) menu = intent.getStringExtra("menu").toString() + content = intent.getStringExtra("content").toString() + mainGrade = intent.getIntExtra("mainGrade", -1) + amountGrade = intent.getIntExtra("amountGrade", -1) + tasteGrade = intent.getIntExtra("tasteGrade", -1) - Log.d("reviewId", reviewId.toString()) + Log.d("ReviewFixedActivity", "전:" + reviewId.toString()) + Log.d("ReviewFixedActivity", "전:" + menu.toString()) + Log.d("ReviewFixedActivity", "전:" + content.toString()) binding.btnReviewFix.setOnClickListener { val intent = Intent(this, ModifyReviewActivity::class.java) intent.putExtra("reviewId", reviewId) intent.putExtra("menu", menu) + intent.putExtra("content", content) + intent.putExtra("mainGrade", mainGrade) + intent.putExtra("amountGrade", amountGrade) + intent.putExtra("tasteGrade", tasteGrade) + startActivity(intent) finish() } diff --git a/app/src/main/java/com/eatssu/android/ui/review/list/ReviewActivity.kt b/app/src/main/java/com/eatssu/android/ui/review/list/ReviewActivity.kt index eee79367..06b0f04e 100644 --- a/app/src/main/java/com/eatssu/android/ui/review/list/ReviewActivity.kt +++ b/app/src/main/java/com/eatssu/android/ui/review/list/ReviewActivity.kt @@ -1,9 +1,11 @@ package com.eatssu.android.ui.review.list +import android.app.AlertDialog import android.content.Intent import android.os.Bundle import android.util.Log import android.view.View +import android.widget.Toast import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager @@ -12,6 +14,7 @@ import com.eatssu.android.data.enums.MenuType import com.eatssu.android.data.repository.ReviewRepository import com.eatssu.android.data.service.ReviewService import com.eatssu.android.databinding.ActivityReviewBinding +import com.eatssu.android.ui.review.delete.DeleteViewModel import com.eatssu.android.ui.review.write.ReviewWriteRateActivity import com.eatssu.android.ui.review.write.menu.ReviewWriteMenuActivity import com.eatssu.android.util.RetrofitImpl.retrofit @@ -27,6 +30,7 @@ class ReviewActivity : // private val viewModel: ReviewViewModel by viewModels() private lateinit var reviewViewModel: ReviewViewModel + private lateinit var deleteViewModel: DeleteViewModel private lateinit var reviewService: ReviewService private lateinit var reviewRepository: ReviewRepository @@ -65,6 +69,9 @@ class ReviewActivity : )[ReviewViewModel::class.java] binding.viewModel = reviewViewModel + + deleteViewModel = ViewModelProvider(this).get(DeleteViewModel::class.java) + } private fun lodeData() { @@ -143,7 +150,9 @@ class ReviewActivity : Log.d("ReviewActivity", "리뷰가 있음") binding.llNonReview.visibility = View.INVISIBLE binding.rvReview.visibility = View.VISIBLE - reviewAdapter = it.reviewList?.let { review -> ReviewAdapter(review) } + reviewAdapter = it.reviewList?.let { review -> + ReviewAdapter(review) { reviewId -> delete(reviewId) } + } binding.rvReview.apply { adapter = reviewAdapter @@ -160,8 +169,7 @@ class ReviewActivity : binding.tvReviewNumCount.text = reviewCnt.toString() binding.tvRate.text = String.format("%.1f", mainRating) - binding.tvGradeTaste.text = String.format("%.1f", tasteRating) - binding.tvGradeAmount.text = String.format("%.1f", amountRating) + val totalReviewCount = reviewCnt binding.progressBar1.max = totalReviewCount @@ -182,9 +190,32 @@ class ReviewActivity : } } + fun delete(reviewId: Long) { + + AlertDialog.Builder(this).apply { + setTitle("리뷰 삭제") + setMessage("작성한 리뷰를 삭제하시겠습니까?") + setNegativeButton("취소") { _, _ -> + deleteViewModel.handleErrorResponse("삭제를 취소하였습니다.") + } + setPositiveButton("삭제") { _, _ -> + deleteViewModel.postData(reviewId) + } + }.create().show() + + observeViewModel() + //TODO 삭제하고 리뷰리스트 다시 불러오기 + + } + + private fun observeViewModel() { + deleteViewModel.toastMessage.observe(this) { result -> + Toast.makeText(this, result, Toast.LENGTH_SHORT).show() + } + } + override fun onRestart() { super.onRestart() - Log.d("post", "onRestart") lodeData() bindData() @@ -192,10 +223,8 @@ class ReviewActivity : override fun onResume() { super.onResume() - Log.d("post", "onResume") lodeData() bindData() } - } diff --git a/app/src/main/java/com/eatssu/android/ui/review/list/ReviewAdapter.kt b/app/src/main/java/com/eatssu/android/ui/review/list/ReviewAdapter.kt index ac8d08f4..331eefd8 100644 --- a/app/src/main/java/com/eatssu/android/ui/review/list/ReviewAdapter.kt +++ b/app/src/main/java/com/eatssu/android/ui/review/list/ReviewAdapter.kt @@ -1,21 +1,28 @@ package com.eatssu.android.ui.review.list +import android.content.Context import android.content.Intent import android.util.Log import android.view.LayoutInflater +import android.view.MenuItem import android.view.View import android.view.ViewGroup +import androidx.annotation.MenuRes +import androidx.appcompat.widget.PopupMenu import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide +import com.eatssu.android.R import com.eatssu.android.data.model.Review -import com.eatssu.android.databinding.ItemOthersReviewBinding import com.eatssu.android.databinding.ItemReviewBinding -import com.eatssu.android.ui.review.delete.MyReviewDialogActivity +import com.eatssu.android.ui.review.modify.ModifyReviewActivity import com.eatssu.android.ui.review.report.ReportActivity -class ReviewAdapter(private val dataList: List) : +class ReviewAdapter( + private val dataList: List, + private val callBackReviewId: (Long) -> Unit +) : RecyclerView.Adapter() { inner class ViewHolder(private val binding: ItemReviewBinding) : @@ -26,138 +33,109 @@ class ReviewAdapter(private val dataList: List) : binding.tvWriterNickname.text = writerNickname binding.tvReviewItemComment.text = content binding.tvReviewItemDate.text = writeDate - binding.tvMenuName.text = menu + binding.tvMenuName.text = menu //TODO 리사이클러뷰로 변경 - binding.tvTotalRating.text = mainGrade.toString() - binding.tvTasteRating.text = tasteGrade.toString() - binding.tvAmountRating.text = amountGrade.toString() + binding.rbRate.rating = mainGrade.toFloat() } - - - if (data.imgUrl?.size != 0) { + if (!data.imgUrl.isNullOrEmpty()) { Log.d("ReviewAdapter", data.content + data.imgUrl?.size.toString()) + data.imgUrl?.toString()?.let { Log.d("ReviewAdapter", it) } + Glide.with(itemView) - .load(data.imgUrl?.get(0)) + .load(data.imgUrl[0]) .into(binding.ivReviewPhoto) binding.ivReviewPhoto.visibility = View.VISIBLE + binding.cvPhotoReview.visibility = View.VISIBLE - if (data.imgUrl?.get(0) == "") { - binding.ivReviewPhoto.visibility = View.GONE - } - if (data.imgUrl?.get(0) == null) { + if (data.imgUrl[0] == "") { binding.ivReviewPhoto.visibility = View.GONE + binding.cvPhotoReview.visibility = View.GONE + } } else { binding.ivReviewPhoto.visibility = View.GONE + binding.cvPhotoReview.visibility = View.GONE } - - binding.btnDetail.setOnClickListener { + binding.btnDetail.setOnClickListener { v: View -> if (data.isWriter) { - val intent = - Intent(binding.btnDetail.context, MyReviewDialogActivity::class.java) - intent.putExtra("reviewId", data.reviewId) - intent.putExtra("menu", data.menu) - intent.putExtra("comment", data.content) - intent.putExtra("mainRating", data.mainGrade) - intent.putExtra("amountRating", data.amountGrade) - intent.putExtra("tasteRating", data.tasteGrade) - Log.d("ReviewAdapter", data.toString()) - ContextCompat.startActivity(binding.btnDetail.context, intent, null) + showMenu(binding.root.context, v, R.menu.menu_my_review, data) + } else { + showMenu(binding.root.context, v, R.menu.menu_other_review, data) } } } } - inner class OthersViewHolder(private val binding: ItemOthersReviewBinding) : - RecyclerView.ViewHolder(binding.root) { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + val binding = + ItemReviewBinding.inflate(LayoutInflater.from(parent.context), parent, false) - fun bind(position: Int) { + return ViewHolder(binding) - val data = dataList[position].apply { - binding.tvWriterNickname.text = writerNickname - binding.tvReviewItemComment.text = content - binding.tvReviewItemDate.text = writeDate - binding.tvMenuName.text = menu + } - binding.tvTotalRating.text = mainGrade.toString() - binding.tvTasteRating.text = tasteGrade.toString() - binding.tvAmountRating.text = amountGrade.toString() - } + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + when (holder) { + is ViewHolder -> holder.bind(position) + } + } - if (data.imgUrl?.size != 0) { - Glide.with(itemView) - .load(data.imgUrl?.get(0)) - .into(binding.ivReviewPhoto) - binding.ivReviewPhoto.visibility = View.VISIBLE + private fun showMenu(holdercontext: Context, v: View, @MenuRes menuRes: Int, data: Review) { + val popup = PopupMenu(holdercontext, v) + popup.menuInflater.inflate(menuRes, popup.menu) - if (data.imgUrl?.get(0) == "") { - binding.ivReviewPhoto.visibility = View.GONE + popup.setOnMenuItemClickListener { menuItem: MenuItem -> + // Respond to menu item click. + when (menuItem.itemId) { + R.id.report -> { + val intent = + Intent(holdercontext, ReportActivity::class.java) + intent.putExtra("reviewId", data.reviewId) + intent.putExtra("menu", data.menu) + ContextCompat.startActivity(holdercontext, intent, null) + true } - if (data.imgUrl?.get(0) == null) { - binding.ivReviewPhoto.visibility = View.GONE - } - } else { - binding.ivReviewPhoto.visibility = View.GONE - } - - binding.tvReviewItemReport.setOnClickListener { - if (!data.isWriter) { + R.id.fix -> { val intent = - Intent(binding.tvReviewItemReport.context, ReportActivity::class.java) + Intent(holdercontext, ModifyReviewActivity::class.java) intent.putExtra("reviewId", data.reviewId) intent.putExtra("menu", data.menu) - ContextCompat.startActivity(binding.tvReviewItemReport.context, intent, null) + intent.putExtra("content", data.content) + intent.putExtra("mainGrade", data.mainGrade) + intent.putExtra("amountGrade", data.amountGrade) + intent.putExtra("tasteGrade", data.tasteGrade) + + Log.d("ReviewFixedActivity", "전전:" + data.reviewId) + Log.d("ReviewFixedActivity", "전전:" + data.menu) + Log.d("ReviewFixedActivity", "전전:" + data.content) +//// Timber.d("내용: "+data.content) + ContextCompat.startActivity(holdercontext, intent, null) + true } - } - } - } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return when (viewType) { - VIEW_TYPE_MY_REVIEW -> { - val binding = - ItemReviewBinding.inflate(LayoutInflater.from(parent.context), parent, false) - ViewHolder(binding) - } + R.id.delete -> { + callBackReviewId(data.reviewId) + true + } - VIEW_TYPE_OTHERS_REVIEW -> { - val othersBinding = ItemOthersReviewBinding.inflate( - LayoutInflater.from(parent.context), - parent, - false - ) - OthersViewHolder(othersBinding) + else -> { + true + } } - - else -> throw IllegalArgumentException("Invalid view type") } - } - - override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { - when (holder) { - is ViewHolder -> holder.bind(position) - is OthersViewHolder -> holder.bind(position) - } - } - - override fun getItemViewType(position: Int): Int { - return if (dataList[position].isWriter) { - VIEW_TYPE_MY_REVIEW - } else { - VIEW_TYPE_OTHERS_REVIEW + popup.setOnDismissListener { + // Respond to popup being dismissed. } +// Show the popup menu. + popup.show() } override fun getItemCount(): Int = dataList.size - companion object { - private const val VIEW_TYPE_MY_REVIEW = 1 - private const val VIEW_TYPE_OTHERS_REVIEW = 2 - } } diff --git a/app/src/main/java/com/eatssu/android/ui/review/modify/ModifyReviewActivity.kt b/app/src/main/java/com/eatssu/android/ui/review/modify/ModifyReviewActivity.kt index 6b898a13..104edc80 100644 --- a/app/src/main/java/com/eatssu/android/ui/review/modify/ModifyReviewActivity.kt +++ b/app/src/main/java/com/eatssu/android/ui/review/modify/ModifyReviewActivity.kt @@ -13,12 +13,15 @@ import kotlinx.coroutines.launch class ModifyReviewActivity : BaseActivity(ActivityFixMenuBinding::inflate) { private lateinit var viewModel: ModifyViewModel + private var reviewId = -1L private var menu = "" + + private var content = "" + + private var main = 0 private var amount = 0 private var taste = 0 - private var main = 0 - private var content = "" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) toolbarTitle.text = "리뷰 수정하기" // 툴바 제목 설정 @@ -42,24 +45,25 @@ class ModifyReviewActivity : BaseActivity(ActivityFixMen } private fun getIndex() { + reviewId = intent.getLongExtra("reviewId", -1L) menu = intent.getStringExtra("menu").toString() - content = intent.getStringExtra("comment").toString() + content = intent.getStringExtra("content").toString() - main = intent.getIntExtra("mainRating", 0) - amount = intent.getIntExtra("amountRating", 0) - taste = intent.getIntExtra("tasteRating", 0) + main = intent.getIntExtra("mainGrade", 0) + amount = intent.getIntExtra("amountGrade", 0) + taste = intent.getIntExtra("tasteGrade", 0) Log.d("ReviewFixedActivity", reviewId.toString() + menu) Log.d("ReviewFixedActivity", content) } private fun setData() { - binding.menu.text = intent.getStringExtra("menu").toString() - binding.etReview2Comment.setText(intent.getStringExtra("content")) - binding.rbMain.rating = intent.getIntExtra("mainRating", 0).toFloat() - binding.rbAmount.rating = intent.getIntExtra("amountRating", 0).toFloat() - binding.rbTaste.rating = intent.getIntExtra("tasteRating", 0).toFloat() + binding.menu.text = menu + binding.etReview2Comment.setText(content) + binding.rbMain.rating = main.toFloat() + binding.rbAmount.rating = intent.getIntExtra("amountGrade", 0).toFloat() + binding.rbTaste.rating = intent.getIntExtra("tasteGrade", 0).toFloat() } private fun postData(reviewId: Long) { diff --git a/app/src/main/java/com/eatssu/android/ui/review/report/ReportActivity.kt b/app/src/main/java/com/eatssu/android/ui/review/report/ReportActivity.kt index 9ed7f693..94b278cd 100644 --- a/app/src/main/java/com/eatssu/android/ui/review/report/ReportActivity.kt +++ b/app/src/main/java/com/eatssu/android/ui/review/report/ReportActivity.kt @@ -1,19 +1,30 @@ package com.eatssu.android.ui.review.report import android.os.Bundle -import android.util.Log -import android.widget.Toast -import androidx.lifecycle.ViewModelProvider +import android.text.Editable +import android.text.TextWatcher +import androidx.activity.viewModels +import androidx.lifecycle.lifecycleScope import com.eatssu.android.base.BaseActivity import com.eatssu.android.data.enums.ReportType import com.eatssu.android.databinding.ActivityReportBinding +import com.eatssu.android.util.extension.showToast +import dagger.hilt.android.AndroidEntryPoint +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch + +@AndroidEntryPoint class ReportActivity : BaseActivity(ActivityReportBinding::inflate) { + private val reportViewModel: ReportViewModel by viewModels() + private var reviewId = -1L - private lateinit var viewModel: ReportViewModel private var reportType = "" private var content = "" + private var inputText: String = "" + + //Todo 코드 수정 해야함 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -21,11 +32,19 @@ class ReportActivity : BaseActivity(ActivityReportBinding reviewId = intent.getLongExtra("reviewId", -1L) - viewModel = ViewModelProvider(this).get(ReportViewModel::class.java) + binding.etReportComment.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {} - reportInfo() + //값 변경 시 실행되는 함수 + override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { + //입력값 담기 + inputText = binding.etReportComment.text.trim().toString() + } + + override fun afterTextChanged(p0: Editable?) {} + }) - observeViewModel() + reportInfo() } private fun reportInfo() { @@ -34,13 +53,23 @@ class ReportActivity : BaseActivity(ActivityReportBinding val selectedReportType = getSelectedReportType(binding.radioGp.checkedRadioButtonId) reportType = selectedReportType.toString() - content = - getString(selectedReportType.description) ?: binding.etReportComment.text.toString() - Log.d("ReportActivity", reportType) - Log.d("ReportActivity", reviewId.toString()) + content = if (selectedReportType == ReportType.EXTRA) { + inputText + } else { + getString(selectedReportType.description) + } - viewModel.postData(reviewId, reportType, content) + reportViewModel.postData(reviewId, reportType, content) + + lifecycleScope.launch { + reportViewModel.uiState.collectLatest { + showToast(it.toastMessage) + if (it.isDone) { + finish() + } + } + } } } @@ -55,16 +84,4 @@ class ReportActivity : BaseActivity(ActivityReportBinding else -> ReportType.EXTRA // Default to ETC if none selected } } - - private fun observeViewModel() { - viewModel.toastMessage.observe(this) { result -> - Toast.makeText(this@ReportActivity, result, Toast.LENGTH_SHORT).show() - } - - viewModel.isDone.observe(this) { isDone -> - if(isDone) { - finish() - } - } - } } \ No newline at end of file diff --git a/app/src/main/java/com/eatssu/android/ui/review/report/ReportViewModel.kt b/app/src/main/java/com/eatssu/android/ui/review/report/ReportViewModel.kt index dc05d723..870395b1 100644 --- a/app/src/main/java/com/eatssu/android/ui/review/report/ReportViewModel.kt +++ b/app/src/main/java/com/eatssu/android/ui/review/report/ReportViewModel.kt @@ -1,65 +1,54 @@ package com.eatssu.android.ui.review.report -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData +import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.eatssu.android.base.BaseResponse import com.eatssu.android.data.dto.request.ReportRequest -import com.eatssu.android.data.service.ReportService -import com.eatssu.android.util.RetrofitImpl -import kotlinx.coroutines.Dispatchers +import com.eatssu.android.data.usecase.PostReportUseCase +import com.eatssu.android.ui.mypage.usernamechange.UserNameChangeViewModel.Companion.TAG +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.catch +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.onCompletion +import kotlinx.coroutines.flow.onStart +import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import retrofit2.Call -import retrofit2.Callback -import retrofit2.Response +import javax.inject.Inject -class ReportViewModel : ViewModel() { +@HiltViewModel +class ReportViewModel +@Inject constructor( + private val postReportUseCase: PostReportUseCase, +) : ViewModel() { - private val _isDone = MutableLiveData() - val isDone: LiveData get() = _isDone + private val _uiState: MutableStateFlow = + MutableStateFlow(ReportUiState()) + val uiState: StateFlow = _uiState.asStateFlow() - private val _toastMessage = MutableLiveData() - val toastMessage: LiveData get() = _toastMessage fun postData(reviewId: Long, reportType: String, content: String) { - val service = RetrofitImpl.retrofit.create(ReportService::class.java) - - viewModelScope.launch(Dispatchers.IO) { - service.reportReview(ReportRequest(reviewId, reportType, content)) - .enqueue(object : Callback> { - override fun onResponse( - call: Call>, - response: Response>, - ) { - if (response.isSuccessful) { - if (response.code() == 200) { - handleSuccessResponse("신고가 완료되었습니다.") - } else { - handleErrorResponse("신고가 실패하였습니다.") - } - } - } - - override fun onFailure(call: Call>, t: Throwable) { - handleErrorResponse("신고가 실패하였습니다.") - } - }) + viewModelScope.launch { + postReportUseCase(ReportRequest(reviewId, reportType, content)).onStart { + _uiState.update { it.copy(loading = true) } + }.onCompletion { + _uiState.update { it.copy(loading = false, error = true) } + }.catch { e -> + _uiState.update { it.copy(error = true, toastMessage = "신고가 실패하였습니다.") } + Log.e(TAG, e.toString()) + }.collectLatest { result -> + _uiState.update { it.copy(isDone = true, toastMessage = "신고가 완료되었습니다.") } + } } } +} - fun handleSuccessResponse(message: String) { - viewModelScope.launch(Dispatchers.Main) { - _toastMessage.value = message - _isDone.value = true +data class ReportUiState( + var loading: Boolean = true, + var error: Boolean = false, - } - } - - fun handleErrorResponse(message: String) { - viewModelScope.launch(Dispatchers.Main) { - _toastMessage.value = message - _isDone.value = false - } - } -} + var toastMessage: String = "", + var isDone: Boolean = false, +) diff --git a/app/src/main/java/com/eatssu/android/util/RetrofitImpl.kt b/app/src/main/java/com/eatssu/android/util/RetrofitImpl.kt index e93af784..c010dd80 100644 --- a/app/src/main/java/com/eatssu/android/util/RetrofitImpl.kt +++ b/app/src/main/java/com/eatssu/android/util/RetrofitImpl.kt @@ -9,6 +9,7 @@ import android.util.Log import android.widget.Toast import com.eatssu.android.App import com.eatssu.android.BuildConfig +import com.eatssu.android.BuildConfig.BASE_URL import com.eatssu.android.base.BaseResponse import com.eatssu.android.data.dto.response.TokenResponse import com.eatssu.android.di.network.TokenInterceptor @@ -25,7 +26,6 @@ import java.io.IOException import java.lang.reflect.Type object RetrofitImpl { - private const val BASE_URL = BuildConfig.BASE_URL val size = 10 * 1024 * 1024 // 10MB Cache size diff --git a/app/src/main/res/drawable-v24/ic_arrow_left.png b/app/src/main/res/drawable-v24/ic_arrow_left.png deleted file mode 100644 index cc69cc54..00000000 Binary files a/app/src/main/res/drawable-v24/ic_arrow_left.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_arrow_left.png b/app/src/main/res/drawable/ic_arrow_left.png new file mode 100644 index 00000000..654b0d10 Binary files /dev/null and b/app/src/main/res/drawable/ic_arrow_left.png differ diff --git a/app/src/main/res/drawable/ic_arrow_right.png b/app/src/main/res/drawable/ic_arrow_right.png index a226513d..98f0b1cb 100644 Binary files a/app/src/main/res/drawable/ic_arrow_right.png and b/app/src/main/res/drawable/ic_arrow_right.png differ diff --git a/app/src/main/res/drawable/ic_bad_28.png b/app/src/main/res/drawable/ic_bad_28.png new file mode 100644 index 00000000..a661c95b Binary files /dev/null and b/app/src/main/res/drawable/ic_bad_28.png differ diff --git a/app/src/main/res/drawable/ic_check_24.png b/app/src/main/res/drawable/ic_check_24.png index 2acc5f01..15ff8641 100644 Binary files a/app/src/main/res/drawable/ic_check_24.png and b/app/src/main/res/drawable/ic_check_24.png differ diff --git a/app/src/main/res/drawable/ic_good_28.png b/app/src/main/res/drawable/ic_good_28.png new file mode 100644 index 00000000..c685525c Binary files /dev/null and b/app/src/main/res/drawable/ic_good_28.png differ diff --git a/app/src/main/res/drawable/ic_info_12.png b/app/src/main/res/drawable/ic_info_12.png new file mode 100644 index 00000000..fc7153c7 Binary files /dev/null and b/app/src/main/res/drawable/ic_info_12.png differ diff --git a/app/src/main/res/drawable/ic_location.xml b/app/src/main/res/drawable/ic_location.xml index 1c3922dd..988af48b 100644 --- a/app/src/main/res/drawable/ic_location.xml +++ b/app/src/main/res/drawable/ic_location.xml @@ -1,4 +1,4 @@ - diff --git a/app/src/main/res/drawable/ic_menu_24.png b/app/src/main/res/drawable/ic_menu_24.png new file mode 100644 index 00000000..4bae24d7 Binary files /dev/null and b/app/src/main/res/drawable/ic_menu_24.png differ diff --git a/app/src/main/res/drawable/ic_uncheck_24.png b/app/src/main/res/drawable/ic_uncheck_24.png new file mode 100644 index 00000000..5e5c1824 Binary files /dev/null and b/app/src/main/res/drawable/ic_uncheck_24.png differ diff --git a/app/src/main/res/drawable/img_dodam.jpeg b/app/src/main/res/drawable/img_dodam.jpeg new file mode 100644 index 00000000..a61e689e Binary files /dev/null and b/app/src/main/res/drawable/img_dodam.jpeg differ diff --git a/app/src/main/res/drawable/img_logo1_44.png b/app/src/main/res/drawable/img_logo1_44.png new file mode 100644 index 00000000..3461f0e0 Binary files /dev/null and b/app/src/main/res/drawable/img_logo1_44.png differ diff --git a/app/src/main/res/drawable/img_logo2.png b/app/src/main/res/drawable/img_logo2.png new file mode 100644 index 00000000..eda4a6fa Binary files /dev/null and b/app/src/main/res/drawable/img_logo2.png differ diff --git a/app/src/main/res/drawable/img_member.png b/app/src/main/res/drawable/img_member.png new file mode 100644 index 00000000..61bf9a30 Binary files /dev/null and b/app/src/main/res/drawable/img_member.png differ diff --git a/app/src/main/res/drawable/layer_bottom_shadow.xml b/app/src/main/res/drawable/layer_bottom_shadow.xml new file mode 100644 index 00000000..af688ec7 --- /dev/null +++ b/app/src/main/res/drawable/layer_bottom_shadow.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/layer_progress.xml b/app/src/main/res/drawable/layer_progress.xml index be17f305..e68d739d 100644 --- a/app/src/main/res/drawable/layer_progress.xml +++ b/app/src/main/res/drawable/layer_progress.xml @@ -15,7 +15,7 @@ - + diff --git a/app/src/main/res/drawable/layer_round_border.xml b/app/src/main/res/drawable/layer_round_border.xml deleted file mode 100644 index 3613ae8b..00000000 --- a/app/src/main/res/drawable/layer_round_border.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_background_blue.xml b/app/src/main/res/drawable/selector_background_blue.xml index d4543eff..63376d4a 100644 --- a/app/src/main/res/drawable/selector_background_blue.xml +++ b/app/src/main/res/drawable/selector_background_blue.xml @@ -2,10 +2,10 @@ - + + android:color="@color/primary" /> diff --git a/app/src/main/res/drawable/selector_calendar.xml b/app/src/main/res/drawable/selector_calendar.xml deleted file mode 100644 index ad4a83c6..00000000 --- a/app/src/main/res/drawable/selector_calendar.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_check_state.xml b/app/src/main/res/drawable/selector_check_state.xml index d595609d..2a2c87ab 100644 --- a/app/src/main/res/drawable/selector_check_state.xml +++ b/app/src/main/res/drawable/selector_check_state.xml @@ -4,7 +4,7 @@ - + diff --git a/app/src/main/res/drawable/selector_report.xml b/app/src/main/res/drawable/selector_report.xml new file mode 100644 index 00000000..80e8fc15 --- /dev/null +++ b/app/src/main/res/drawable/selector_report.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/shape_btn_mini.xml b/app/src/main/res/drawable/shape_btn_mini.xml deleted file mode 100644 index 0fe9d687..00000000 --- a/app/src/main/res/drawable/shape_btn_mini.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_btn.xml b/app/src/main/res/drawable/shape_button_duplicate.xml similarity index 62% rename from app/src/main/res/drawable/shape_btn.xml rename to app/src/main/res/drawable/shape_button_duplicate.xml index 49c590f5..c95732de 100644 --- a/app/src/main/res/drawable/shape_btn.xml +++ b/app/src/main/res/drawable/shape_button_duplicate.xml @@ -1,9 +1,7 @@ - + - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_cafeteria_section.xml b/app/src/main/res/drawable/shape_cafeteria_section.xml new file mode 100644 index 00000000..8b01b582 --- /dev/null +++ b/app/src/main/res/drawable/shape_cafeteria_section.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/shape_corner_bottom.xml b/app/src/main/res/drawable/shape_corner_bottom.xml new file mode 100644 index 00000000..4b2f5da4 --- /dev/null +++ b/app/src/main/res/drawable/shape_corner_bottom.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/shape_corner_top.xml b/app/src/main/res/drawable/shape_corner_top.xml new file mode 100644 index 00000000..0fb9932d --- /dev/null +++ b/app/src/main/res/drawable/shape_corner_top.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/drawable/shape_edittext_small.xml b/app/src/main/res/drawable/shape_edittext_small.xml deleted file mode 100644 index 1f63afbb..00000000 --- a/app/src/main/res/drawable/shape_edittext_small.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/drawable/shape_menu_name.xml b/app/src/main/res/drawable/shape_menu_name.xml new file mode 100644 index 00000000..ae5ef7b7 --- /dev/null +++ b/app/src/main/res/drawable/shape_menu_name.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/shape_report.xml b/app/src/main/res/drawable/shape_report.xml new file mode 100644 index 00000000..b5d9a172 --- /dev/null +++ b/app/src/main/res/drawable/shape_report.xml @@ -0,0 +1,21 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/shape_report_select.xml b/app/src/main/res/drawable/shape_report_select.xml new file mode 100644 index 00000000..dea114c6 --- /dev/null +++ b/app/src/main/res/drawable/shape_report_select.xml @@ -0,0 +1,21 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/shape_review_box.xml b/app/src/main/res/drawable/shape_review_box.xml deleted file mode 100644 index e4832d24..00000000 --- a/app/src/main/res/drawable/shape_review_box.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/drawable/shape_round_corners.xml b/app/src/main/res/drawable/shape_round_corners.xml deleted file mode 100644 index 013aa277..00000000 --- a/app/src/main/res/drawable/shape_round_corners.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_edittext_big.xml b/app/src/main/res/drawable/shape_text_field_small.xml similarity index 55% rename from app/src/main/res/drawable/shape_edittext_big.xml rename to app/src/main/res/drawable/shape_text_field_small.xml index 0d0dc175..5d29e90f 100644 --- a/app/src/main/res/drawable/shape_edittext_big.xml +++ b/app/src/main/res/drawable/shape_text_field_small.xml @@ -4,13 +4,12 @@ - + android:color="@color/gray200" /> + + android:bottom="16dp" + android:left="11dp" + android:right="11dp" + android:top="16dp" /> diff --git a/app/src/main/res/drawable/shape_text_field_small_red.xml b/app/src/main/res/drawable/shape_text_field_small_red.xml new file mode 100644 index 00000000..463893d4 --- /dev/null +++ b/app/src/main/res/drawable/shape_text_field_small_red.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/transparent_calendar_element.xml b/app/src/main/res/drawable/shape_transparent_calendar_element.xml similarity index 76% rename from app/src/main/res/drawable/transparent_calendar_element.xml rename to app/src/main/res/drawable/shape_transparent_calendar_element.xml index ce5a6565..47c8e55d 100644 --- a/app/src/main/res/drawable/transparent_calendar_element.xml +++ b/app/src/main/res/drawable/shape_transparent_calendar_element.xml @@ -2,5 +2,5 @@ + android:color="@color/primary"/> \ No newline at end of file diff --git a/app/src/main/res/font-v26/font.xml b/app/src/main/res/font-v26/font.xml index f7441df2..699cbc1c 100644 --- a/app/src/main/res/font-v26/font.xml +++ b/app/src/main/res/font-v26/font.xml @@ -3,30 +3,40 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + android:font="@font/pretendard_black" + app:font="@font/pretendard_black" /> + app:font="@font/pretendard_bold" /> + android:font="@font/pretendard_extrabold" + app:font="@font/pretendard_extrabold" /> + android:font="@font/pretendard_extralight" + app:font="@font/pretendard_extralight" /> + android:font="@font/pretendard_light" + app:font="@font/pretendard_light" /> + android:font="@font/pretendard_medium" + app:font="@font/pretendard_medium" /> + + + + diff --git a/app/src/main/res/font/noto_bold.otf b/app/src/main/res/font/noto_bold.otf deleted file mode 100644 index 5599581d..00000000 Binary files a/app/src/main/res/font/noto_bold.otf and /dev/null differ diff --git a/app/src/main/res/font/noto_light.otf b/app/src/main/res/font/noto_light.otf deleted file mode 100644 index 548e667e..00000000 Binary files a/app/src/main/res/font/noto_light.otf and /dev/null differ diff --git a/app/src/main/res/font/noto_medium.otf b/app/src/main/res/font/noto_medium.otf deleted file mode 100644 index 5ddbbc03..00000000 Binary files a/app/src/main/res/font/noto_medium.otf and /dev/null differ diff --git a/app/src/main/res/font/noto_regular.otf b/app/src/main/res/font/noto_regular.otf deleted file mode 100644 index 7c5c2fae..00000000 Binary files a/app/src/main/res/font/noto_regular.otf and /dev/null differ diff --git a/app/src/main/res/font/noto_semibold.otf b/app/src/main/res/font/noto_semibold.otf deleted file mode 100644 index be388bf5..00000000 Binary files a/app/src/main/res/font/noto_semibold.otf and /dev/null differ diff --git a/app/src/main/res/font/noto_thin.otf b/app/src/main/res/font/noto_thin.otf deleted file mode 100644 index 1299fef0..00000000 Binary files a/app/src/main/res/font/noto_thin.otf and /dev/null differ diff --git a/app/src/main/res/font/pretendard_black.ttf b/app/src/main/res/font/pretendard_black.ttf new file mode 100644 index 00000000..d0c1db81 Binary files /dev/null and b/app/src/main/res/font/pretendard_black.ttf differ diff --git a/app/src/main/res/font/pretendard_bold.ttf b/app/src/main/res/font/pretendard_bold.ttf new file mode 100644 index 00000000..fb07fc65 Binary files /dev/null and b/app/src/main/res/font/pretendard_bold.ttf differ diff --git a/app/src/main/res/font/pretendard_extrabold.ttf b/app/src/main/res/font/pretendard_extrabold.ttf new file mode 100644 index 00000000..9d5fe072 Binary files /dev/null and b/app/src/main/res/font/pretendard_extrabold.ttf differ diff --git a/app/src/main/res/font/pretendard_extralight.ttf b/app/src/main/res/font/pretendard_extralight.ttf new file mode 100644 index 00000000..09e65428 Binary files /dev/null and b/app/src/main/res/font/pretendard_extralight.ttf differ diff --git a/app/src/main/res/font/pretendard_light.ttf b/app/src/main/res/font/pretendard_light.ttf new file mode 100644 index 00000000..2e8541d6 Binary files /dev/null and b/app/src/main/res/font/pretendard_light.ttf differ diff --git a/app/src/main/res/font/pretendard_medium.ttf b/app/src/main/res/font/pretendard_medium.ttf new file mode 100644 index 00000000..1db67c68 Binary files /dev/null and b/app/src/main/res/font/pretendard_medium.ttf differ diff --git a/app/src/main/res/font/pretendard_regular.ttf b/app/src/main/res/font/pretendard_regular.ttf new file mode 100644 index 00000000..01147e99 Binary files /dev/null and b/app/src/main/res/font/pretendard_regular.ttf differ diff --git a/app/src/main/res/font/pretendard_semibold.ttf b/app/src/main/res/font/pretendard_semibold.ttf new file mode 100644 index 00000000..9f2690f0 Binary files /dev/null and b/app/src/main/res/font/pretendard_semibold.ttf differ diff --git a/app/src/main/res/font/pretendard_thin.ttf b/app/src/main/res/font/pretendard_thin.ttf new file mode 100644 index 00000000..fe9825f1 Binary files /dev/null and b/app/src/main/res/font/pretendard_thin.ttf differ diff --git a/app/src/main/res/layout/activity_base.xml b/app/src/main/res/layout/activity_base.xml index 3242eae6..11e1ed9d 100644 --- a/app/src/main/res/layout/activity_base.xml +++ b/app/src/main/res/layout/activity_base.xml @@ -41,12 +41,12 @@ + android:textColor="@color/gray700" /> diff --git a/app/src/main/res/layout/activity_developer.xml b/app/src/main/res/layout/activity_developer.xml new file mode 100644 index 00000000..06a7e6eb --- /dev/null +++ b/app/src/main/res/layout/activity_developer.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_fix_menu.xml b/app/src/main/res/layout/activity_fix_menu.xml index 57d5e7cb..c4611cc7 100644 --- a/app/src/main/res/layout/activity_fix_menu.xml +++ b/app/src/main/res/layout/activity_fix_menu.xml @@ -18,7 +18,7 @@ app:layout_constraintTop_toTopOf="parent"> + android:background="@color/primary" /> - - - - - - - - - - - - - - - - - -