From 80757f50f4952445d8dbc738fe3584c08ec7b8a5 Mon Sep 17 00:00:00 2001 From: jooiss Date: Tue, 23 Jul 2024 03:09:06 +0900 Subject: [PATCH] refactor: Reorganize files according to clean architecture --- .../java/campus/tech/kakao/map/MapActivityUITest.kt | 4 ++-- .../java/campus/tech/kakao/map/MapActivityUnitTest.kt | 2 +- .../java/campus/tech/kakao/map/PlaceActivityUITest.kt | 4 ++-- .../java/campus/tech/kakao/map/PlaceActivityUnitTest.kt | 4 ++-- app/src/main/AndroidManifest.xml | 6 +++--- .../java/campus/tech/kakao/map/data/PlaceDatabaseAccess.kt | 1 + .../java/campus/tech/kakao/map/data/PlaceRepository.kt | 3 +-- .../tech/kakao/map/{domain => data}/RetrofitInstance.kt | 2 +- .../map/{domain => data}/RetrofitLocalCategoryService.kt | 2 +- .../map/{domain => data}/RetrofitLocalKeywordService.kt | 2 +- .../tech/kakao/map/{data => domain}/PlaceDataModel.kt | 2 +- .../kakao/map/{presentation => ui}/KakaoMapApplication.kt | 4 ++-- .../tech/kakao/map/{presentation => ui}/MapActivity.kt | 3 +-- .../tech/kakao/map/{presentation => ui}/PlaceActivity.kt | 7 ++----- .../campus/tech/kakao/map/ui/PlaceRecyclerViewAdapter.kt | 2 +- .../campus/tech/kakao/map/ui/SearchRecyclerViewAdapter.kt | 2 +- app/src/main/res/layout/map_layout.xml | 2 +- app/src/main/res/layout/search_layout.xml | 2 +- 18 files changed, 25 insertions(+), 29 deletions(-) rename app/src/main/java/campus/tech/kakao/map/{domain => data}/RetrofitInstance.kt (94%) rename app/src/main/java/campus/tech/kakao/map/{domain => data}/RetrofitLocalCategoryService.kt (91%) rename app/src/main/java/campus/tech/kakao/map/{domain => data}/RetrofitLocalKeywordService.kt (91%) rename app/src/main/java/campus/tech/kakao/map/{data => domain}/PlaceDataModel.kt (79%) rename app/src/main/java/campus/tech/kakao/map/{presentation => ui}/KakaoMapApplication.kt (72%) rename app/src/main/java/campus/tech/kakao/map/{presentation => ui}/MapActivity.kt (98%) rename app/src/main/java/campus/tech/kakao/map/{presentation => ui}/PlaceActivity.kt (96%) diff --git a/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUITest.kt b/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUITest.kt index d8131cff..dd7ac94f 100644 --- a/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUITest.kt +++ b/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUITest.kt @@ -8,8 +8,8 @@ import androidx.test.espresso.intent.matcher.IntentMatchers import androidx.test.espresso.matcher.ViewMatchers import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule -import campus.tech.kakao.map.presentation.MapActivity -import campus.tech.kakao.map.presentation.PlaceActivity +import campus.tech.kakao.map.ui.MapActivity +import campus.tech.kakao.map.ui.PlaceActivity import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUnitTest.kt b/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUnitTest.kt index 0c6c21a3..b3143bb6 100644 --- a/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUnitTest.kt +++ b/app/src/androidTest/java/campus/tech/kakao/map/MapActivityUnitTest.kt @@ -4,7 +4,7 @@ import android.content.Intent import androidx.appcompat.app.AppCompatActivity import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule -import campus.tech.kakao.map.presentation.MapActivity +import campus.tech.kakao.map.ui.MapActivity import campus.tech.kakao.map.ui.ModalBottomSheet import org.junit.Assert.* import org.junit.Before diff --git a/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUITest.kt b/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUITest.kt index 487ef8a7..29ead437 100644 --- a/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUITest.kt +++ b/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUITest.kt @@ -11,8 +11,8 @@ import androidx.test.espresso.matcher.ViewMatchers.hasMinimumChildCount import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule -import campus.tech.kakao.map.presentation.MapActivity -import campus.tech.kakao.map.presentation.PlaceActivity +import campus.tech.kakao.map.ui.MapActivity +import campus.tech.kakao.map.ui.PlaceActivity import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUnitTest.kt b/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUnitTest.kt index 077ff107..1802aafd 100644 --- a/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUnitTest.kt +++ b/app/src/androidTest/java/campus/tech/kakao/map/PlaceActivityUnitTest.kt @@ -6,9 +6,9 @@ import android.view.View import androidx.recyclerview.widget.RecyclerView import androidx.test.core.app.ActivityScenario import androidx.test.ext.junit.runners.AndroidJUnit4 -import campus.tech.kakao.map.data.PlaceDataModel +import campus.tech.kakao.map.domain.PlaceDataModel import campus.tech.kakao.map.data.PlaceDatabaseAccess -import campus.tech.kakao.map.presentation.PlaceActivity +import campus.tech.kakao.map.ui.PlaceActivity import org.junit.Before import org.junit.Test import org.junit.runner.RunWith diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d55dc607..11cd23a6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ @@ -26,7 +26,7 @@ diff --git a/app/src/main/java/campus/tech/kakao/map/data/PlaceDatabaseAccess.kt b/app/src/main/java/campus/tech/kakao/map/data/PlaceDatabaseAccess.kt index 9e65b42b..bc2a1180 100644 --- a/app/src/main/java/campus/tech/kakao/map/data/PlaceDatabaseAccess.kt +++ b/app/src/main/java/campus/tech/kakao/map/data/PlaceDatabaseAccess.kt @@ -3,6 +3,7 @@ package campus.tech.kakao.map.data import android.content.ContentValues import android.content.Context import android.database.Cursor +import campus.tech.kakao.map.domain.PlaceDataModel class PlaceDatabaseAccess(context: Context, databaseName: String) { private val dbHelper = PlaceDatabaseHelper(context, databaseName) diff --git a/app/src/main/java/campus/tech/kakao/map/data/PlaceRepository.kt b/app/src/main/java/campus/tech/kakao/map/data/PlaceRepository.kt index fc0953fd..55a9c78e 100644 --- a/app/src/main/java/campus/tech/kakao/map/data/PlaceRepository.kt +++ b/app/src/main/java/campus/tech/kakao/map/data/PlaceRepository.kt @@ -2,8 +2,7 @@ package campus.tech.kakao.map.data import android.util.Log import campus.tech.kakao.map.BuildConfig -import campus.tech.kakao.map.domain.RetrofitInstance -import campus.tech.kakao.map.domain.RetrofitLocalKeywordService +import campus.tech.kakao.map.domain.PlaceDataModel import retrofit2.Call import retrofit2.Callback import retrofit2.Response diff --git a/app/src/main/java/campus/tech/kakao/map/domain/RetrofitInstance.kt b/app/src/main/java/campus/tech/kakao/map/data/RetrofitInstance.kt similarity index 94% rename from app/src/main/java/campus/tech/kakao/map/domain/RetrofitInstance.kt rename to app/src/main/java/campus/tech/kakao/map/data/RetrofitInstance.kt index c3116871..9b831b58 100644 --- a/app/src/main/java/campus/tech/kakao/map/domain/RetrofitInstance.kt +++ b/app/src/main/java/campus/tech/kakao/map/data/RetrofitInstance.kt @@ -1,4 +1,4 @@ -package campus.tech.kakao.map.domain +package campus.tech.kakao.map.data import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory diff --git a/app/src/main/java/campus/tech/kakao/map/domain/RetrofitLocalCategoryService.kt b/app/src/main/java/campus/tech/kakao/map/data/RetrofitLocalCategoryService.kt similarity index 91% rename from app/src/main/java/campus/tech/kakao/map/domain/RetrofitLocalCategoryService.kt rename to app/src/main/java/campus/tech/kakao/map/data/RetrofitLocalCategoryService.kt index a9052fef..b99179ad 100644 --- a/app/src/main/java/campus/tech/kakao/map/domain/RetrofitLocalCategoryService.kt +++ b/app/src/main/java/campus/tech/kakao/map/data/RetrofitLocalCategoryService.kt @@ -1,4 +1,4 @@ -package campus.tech.kakao.map.domain +package campus.tech.kakao.map.data import campus.tech.kakao.map.data.SearchResult import retrofit2.Call diff --git a/app/src/main/java/campus/tech/kakao/map/domain/RetrofitLocalKeywordService.kt b/app/src/main/java/campus/tech/kakao/map/data/RetrofitLocalKeywordService.kt similarity index 91% rename from app/src/main/java/campus/tech/kakao/map/domain/RetrofitLocalKeywordService.kt rename to app/src/main/java/campus/tech/kakao/map/data/RetrofitLocalKeywordService.kt index ab017907..40bf52eb 100644 --- a/app/src/main/java/campus/tech/kakao/map/domain/RetrofitLocalKeywordService.kt +++ b/app/src/main/java/campus/tech/kakao/map/data/RetrofitLocalKeywordService.kt @@ -1,4 +1,4 @@ -package campus.tech.kakao.map.domain +package campus.tech.kakao.map.data import campus.tech.kakao.map.data.SearchResult import retrofit2.Call diff --git a/app/src/main/java/campus/tech/kakao/map/data/PlaceDataModel.kt b/app/src/main/java/campus/tech/kakao/map/domain/PlaceDataModel.kt similarity index 79% rename from app/src/main/java/campus/tech/kakao/map/data/PlaceDataModel.kt rename to app/src/main/java/campus/tech/kakao/map/domain/PlaceDataModel.kt index 8546123b..a6bf21e8 100644 --- a/app/src/main/java/campus/tech/kakao/map/data/PlaceDataModel.kt +++ b/app/src/main/java/campus/tech/kakao/map/domain/PlaceDataModel.kt @@ -1,4 +1,4 @@ -package campus.tech.kakao.map.data +package campus.tech.kakao.map.domain data class PlaceDataModel( val name: String, diff --git a/app/src/main/java/campus/tech/kakao/map/presentation/KakaoMapApplication.kt b/app/src/main/java/campus/tech/kakao/map/ui/KakaoMapApplication.kt similarity index 72% rename from app/src/main/java/campus/tech/kakao/map/presentation/KakaoMapApplication.kt rename to app/src/main/java/campus/tech/kakao/map/ui/KakaoMapApplication.kt index 6825c20b..844e9b2f 100644 --- a/app/src/main/java/campus/tech/kakao/map/presentation/KakaoMapApplication.kt +++ b/app/src/main/java/campus/tech/kakao/map/ui/KakaoMapApplication.kt @@ -1,10 +1,10 @@ -package campus.tech.kakao.map.presentation +package campus.tech.kakao.map.ui import android.app.Application import campus.tech.kakao.map.BuildConfig import com.kakao.vectormap.KakaoMapSdk -class KaKaoMapApplication : Application() { +class KakaoMapApplication : Application() { override fun onCreate() { super.onCreate() KakaoMapSdk.init(this, BuildConfig.KAKAO_API_KEY) diff --git a/app/src/main/java/campus/tech/kakao/map/presentation/MapActivity.kt b/app/src/main/java/campus/tech/kakao/map/ui/MapActivity.kt similarity index 98% rename from app/src/main/java/campus/tech/kakao/map/presentation/MapActivity.kt rename to app/src/main/java/campus/tech/kakao/map/ui/MapActivity.kt index 1344bdbf..1b764414 100644 --- a/app/src/main/java/campus/tech/kakao/map/presentation/MapActivity.kt +++ b/app/src/main/java/campus/tech/kakao/map/ui/MapActivity.kt @@ -1,4 +1,4 @@ -package campus.tech.kakao.map.presentation +package campus.tech.kakao.map.ui import android.content.Intent import android.content.SharedPreferences @@ -9,7 +9,6 @@ import android.widget.ImageButton import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import campus.tech.kakao.map.ui.ModalBottomSheet import campus.tech.kakao.map.R import com.kakao.vectormap.KakaoMap import com.kakao.vectormap.KakaoMapReadyCallback diff --git a/app/src/main/java/campus/tech/kakao/map/presentation/PlaceActivity.kt b/app/src/main/java/campus/tech/kakao/map/ui/PlaceActivity.kt similarity index 96% rename from app/src/main/java/campus/tech/kakao/map/presentation/PlaceActivity.kt rename to app/src/main/java/campus/tech/kakao/map/ui/PlaceActivity.kt index 11d0e600..ae92687f 100644 --- a/app/src/main/java/campus/tech/kakao/map/presentation/PlaceActivity.kt +++ b/app/src/main/java/campus/tech/kakao/map/ui/PlaceActivity.kt @@ -1,4 +1,4 @@ -package campus.tech.kakao.map.presentation +package campus.tech.kakao.map.ui import android.content.Intent import android.os.Bundle @@ -12,12 +12,10 @@ import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import campus.tech.kakao.map.data.PlaceDataModel +import campus.tech.kakao.map.domain.PlaceDataModel import campus.tech.kakao.map.data.PlaceDatabaseAccess -import campus.tech.kakao.map.ui.PlaceRecyclerViewAdapter import campus.tech.kakao.map.data.PlaceRepository import campus.tech.kakao.map.R -import campus.tech.kakao.map.ui.SearchRecyclerViewAdapter class PlaceActivity : AppCompatActivity() { lateinit var etSearch: EditText @@ -34,7 +32,6 @@ class PlaceActivity : AppCompatActivity() { public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.search_layout) - etSearch = findViewById(R.id.etSearch) btnErase = findViewById(R.id.btnErase) tvNoData = findViewById(R.id.tvNoData) diff --git a/app/src/main/java/campus/tech/kakao/map/ui/PlaceRecyclerViewAdapter.kt b/app/src/main/java/campus/tech/kakao/map/ui/PlaceRecyclerViewAdapter.kt index 86dc17a4..7f567f0d 100644 --- a/app/src/main/java/campus/tech/kakao/map/ui/PlaceRecyclerViewAdapter.kt +++ b/app/src/main/java/campus/tech/kakao/map/ui/PlaceRecyclerViewAdapter.kt @@ -6,7 +6,7 @@ import android.view.ViewGroup import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import campus.tech.kakao.map.R -import campus.tech.kakao.map.data.PlaceDataModel +import campus.tech.kakao.map.domain.PlaceDataModel class PlaceRecyclerViewAdapter( private val places: MutableList, diff --git a/app/src/main/java/campus/tech/kakao/map/ui/SearchRecyclerViewAdapter.kt b/app/src/main/java/campus/tech/kakao/map/ui/SearchRecyclerViewAdapter.kt index 601f833a..d5e35198 100644 --- a/app/src/main/java/campus/tech/kakao/map/ui/SearchRecyclerViewAdapter.kt +++ b/app/src/main/java/campus/tech/kakao/map/ui/SearchRecyclerViewAdapter.kt @@ -9,7 +9,7 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import campus.tech.kakao.map.R -import campus.tech.kakao.map.data.PlaceDataModel +import campus.tech.kakao.map.domain.PlaceDataModel class SearchRecyclerViewAdapter( private val places: MutableList, diff --git a/app/src/main/res/layout/map_layout.xml b/app/src/main/res/layout/map_layout.xml index e00d4501..15d7f24f 100644 --- a/app/src/main/res/layout/map_layout.xml +++ b/app/src/main/res/layout/map_layout.xml @@ -5,7 +5,7 @@ android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".presentation.MapActivity"> + tools:context=".ui.MapActivity"> + tools:context=".ui.PlaceActivity">