diff --git a/README.md b/README.md
index df2a6477..82294c05 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,41 @@
# android-map-keyword
+
+## ๐ ํ๋ก๊ทธ๋จ ์ค๋ช
+
+์นด์นด์ค๋งต์ ํด๋ก ์ฝ๋ฉ์ ์ํด, ๊ฒ์ ๋ ์ด์์์ ์ ์ํ์์ต๋๋ค.
+
+์ด๋ ๋ด๋ถ ์ ์ฅ์์ธ SQLite๋ฅผ ํตํด์ ๋ฐ์ดํฐ๋ฅผ ๊ฒ์ํ๊ณ , ๊ธฐ๋ก์ ์ ์ฅํ๋ ๊ธฐ๋ฅ์ ๊ตฌํํฉ๋๋ค.
+
+## ๐ฏ 1๋จ๊ณ(๋ก์ปฌ ๋ฐ์ดํฐ) ๊ตฌํํ ๊ธฐ๋ฅ
+
+- [X] ๊ฒ์์ด๋ฅผ ์
๋ ฅ ๋ฐ๊ณ ๋ณด์ฌ์ฃผ๋ ๋ ์ด์์ ์ ์
+
+ - [X] ๊ฒ์์ด๋ฅผ ์
๋ ฅ ๋ฐ๋ EditText ์ ์
+
+ - [X] X ๋ฒํผ์ ๋๋ฅด๋ฉด ๊ฒ์์ด๋ฅผ ์ด๊ธฐํํ ์ ์๋๋ก ImageButton ์ ์
+
+ - [X] ๊ฒ์ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ฃผ๋ ๋ ์ด์์ ์ ์
+
+ - [X] ์ด์ ์ ๊ฒ์ ๊ธฐ๋ก์ ํ์ธํ ์ ์๋ ๋ ์ด์์ ์ ์
+
+- [X] ๊ฒ์์ ์ฌ์ฉ๋ ๋ฐ์ดํฐ๋ฅผ ์์ฑํ์ฌ SQLite์ ์ ์ฅ
+
+## ๐ฏ 2๋จ๊ณ(๊ฒ์) ๊ตฌํํ ๊ธฐ๋ฅ
+
+- [X] X๋ฒํผ ํด๋ฆญ ์, ์
๋ ฅ๋ ๊ฒ์์ด๋ฅผ ์ง์ฐ๊ธฐ
+
+- [X] ๊ฒ์์ด๋ฅผ ์
๋ ฅํ๋ฉด ๊ฒ์ ๊ฒฐ๊ณผ๋ฅผ ๋์ ์ฃผ๊ธฐ
+
+ - [X] ์
์ข
(`COLUMN_CATEGORY`)๊ณผ ์ผ์นํ ๊ฒฐ๊ณผ๋ฅผ DB์์ ๋ฆฌ์คํธ๋ก ๊ฐ์ ธ์ค๊ธฐ
+
+ - [X] ๊ฐ์ ธ์จ ๋ฆฌ์คํธ๋ฅผ RecyclerView์ ์ ์ฉํ์ฌ ๋ณด์ฌ์ฃผ๊ธฐ
+
+- [X] ๊ฒ์ ๊ฒฐ๊ณผ ์ค ํ๋๋ฅผ ํด๋ฆญํ๋ ๊ฒฝ์ฐ, ํด๋น ์ฅ์๋ฅผ ๊ฒ์ ๊ธฐ๋ก์ ์ถ๊ฐํ๊ธฐ
+
+ - [X] ๊ฒ์ ๊ธฐ๋ก์ ๋ณด์ฌ์ฃผ๋ item์ ๋ ์ด์์ ์ ์ํ๊ธฐ
+
+ - [X] ์ด๋ฏธ DB์ ์กด์ฌํ๋ค๋ฉด, ํด๋น ๊ฐ์ ์ง์ฐ๊ณ ์๋ก ์ ์ฅํด์ ๋งจ ๋ค๋ก ๊ฐ๋๋ก ๊ตฌํํ๊ธฐ
+
+ - [X] DB์ ์กด์ฌํ์ง ์๋๋ค๋ฉด, ์๋กญ๊ฒ ์ถ๊ฐํ๊ณ ๋งจ ๋ค์์ ๋ถ๋ฌ์ค๊ธฐ
+
+- [X] ๊ฒ์ ๊ธฐ๋ก์ X๋ฒํผ ํด๋ฆญ ์, ํด๋น ๊ฒ์ ๊ธฐ๋ก์ ์ญ์ ํ๊ธฐ
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 9932d6bb..06f1b539 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -47,6 +47,7 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.datastore:datastore-preferences:1.0.0")
+ implementation("androidx.activity:activity:1.8.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6bca2f54..37c62043 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -13,7 +13,7 @@
android:theme="@style/Theme.Map"
tools:targetApi="31">
@@ -23,4 +23,4 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/MainActivity.kt b/app/src/main/java/campus/tech/kakao/map/MainActivity.kt
deleted file mode 100644
index 95b43803..00000000
--- a/app/src/main/java/campus/tech/kakao/map/MainActivity.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package campus.tech.kakao.map
-
-import android.os.Bundle
-import androidx.appcompat.app.AppCompatActivity
-
-class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- }
-}
diff --git a/app/src/main/java/campus/tech/kakao/map/model/HistoryContract.kt b/app/src/main/java/campus/tech/kakao/map/model/HistoryContract.kt
new file mode 100644
index 00000000..1b309d26
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/model/HistoryContract.kt
@@ -0,0 +1,8 @@
+package campus.tech.kakao.map.model
+
+import android.provider.BaseColumns
+
+object HistoryContract : BaseColumns {
+ const val TABLE_NAME = "HISTORY"
+ const val COLUMN_NAME = "name"
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/model/HistoryDbHelper.kt b/app/src/main/java/campus/tech/kakao/map/model/HistoryDbHelper.kt
new file mode 100644
index 00000000..c36f7f0e
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/model/HistoryDbHelper.kt
@@ -0,0 +1,27 @@
+package campus.tech.kakao.map.model
+
+import android.content.Context
+import android.database.sqlite.SQLiteDatabase
+import android.database.sqlite.SQLiteOpenHelper
+
+class HistoryDbHelper(context: Context) :
+ SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
+
+ override fun onCreate(db: SQLiteDatabase?) {
+ db?.let {
+ val query = "CREATE TABLE ${HistoryContract.TABLE_NAME} (" +
+ "${HistoryContract.COLUMN_NAME} VARCHAR(50))"
+ it.execSQL(query)
+ }
+ }
+
+ override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
+ db?.execSQL("DROP TABLE IF EXISTS ${HistoryContract.TABLE_NAME}")
+ onCreate(db)
+ }
+
+ companion object {
+ const val DATABASE_NAME = "history.db"
+ const val DATABASE_VERSION = 1
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/model/Location.kt b/app/src/main/java/campus/tech/kakao/map/model/Location.kt
new file mode 100644
index 00000000..21529b85
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/model/Location.kt
@@ -0,0 +1,7 @@
+package campus.tech.kakao.map.model
+
+data class Location(
+ val name: String,
+ val address: String,
+ val category: String
+)
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/model/LocationContract.kt b/app/src/main/java/campus/tech/kakao/map/model/LocationContract.kt
new file mode 100644
index 00000000..12b27a59
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/model/LocationContract.kt
@@ -0,0 +1,10 @@
+package campus.tech.kakao.map.model
+
+import android.provider.BaseColumns
+
+object LocationContract : BaseColumns {
+ const val TABLE_NAME = "LOCATION"
+ const val COLUMN_NAME = "name"
+ const val COLUMN_ADDRESS = "address"
+ const val COLUMN_CATEGORY = "category"
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/model/LocationDbHelper.kt b/app/src/main/java/campus/tech/kakao/map/model/LocationDbHelper.kt
new file mode 100644
index 00000000..0d3cd4cd
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/model/LocationDbHelper.kt
@@ -0,0 +1,51 @@
+package campus.tech.kakao.map.model
+
+import android.content.ContentValues
+import android.content.Context
+import android.database.sqlite.SQLiteDatabase
+import android.database.sqlite.SQLiteOpenHelper
+
+class LocationDbHelper(context: Context) :
+ SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
+ override fun onCreate(db: SQLiteDatabase?) {
+ db?.let {
+ val query = "CREATE TABLE ${LocationContract.TABLE_NAME} (" +
+ "${LocationContract.COLUMN_NAME} VARCHAR(50)," +
+ "${LocationContract.COLUMN_ADDRESS} VARCHAR(50)," +
+ "${LocationContract.COLUMN_CATEGORY} VARCHAR(20))"
+ it.execSQL(query)
+
+ createLocationData(it)
+ }
+ }
+
+ override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
+ db?.execSQL("DROP TABLE IF EXISTS ${LocationContract.TABLE_NAME}")
+ onCreate(db)
+ }
+
+ private fun createLocationData(db: SQLiteDatabase) {
+ // ์์์ ์นดํ ๋ฐ์ดํฐ 15๊ฐ ์์ฑ
+ for (i in 1..15) {
+ val values = ContentValues()
+ values.put(LocationContract.COLUMN_NAME, "์นดํ$i")
+ values.put(LocationContract.COLUMN_ADDRESS, "์์ธ ์ฑ๋๊ตฌ ์ฑ์๋ $i")
+ values.put(LocationContract.COLUMN_CATEGORY, "์นดํ")
+ db.insert(LocationContract.TABLE_NAME, null, values)
+ }
+
+ // ์์์ ์ฝ๊ตญ ๋ฐ์ดํฐ 15๊ฐ ์์ฑ
+ for (i in 1..15) {
+ val values = ContentValues()
+ values.put(LocationContract.COLUMN_NAME, "์ฝ๊ตญ$i")
+ values.put(LocationContract.COLUMN_ADDRESS, "์์ธ ๊ฐ๋จ๊ตฌ ๋์น๋ $i")
+ values.put(LocationContract.COLUMN_CATEGORY, "์ฝ๊ตญ")
+ db.insert(LocationContract.TABLE_NAME, null, values)
+ }
+ }
+
+ companion object {
+ const val DATABASE_NAME = "location.db"
+ const val DATABASE_VERSION = 1
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/model/SearchLocationRepository.kt b/app/src/main/java/campus/tech/kakao/map/model/SearchLocationRepository.kt
new file mode 100644
index 00000000..f9dc1b69
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/model/SearchLocationRepository.kt
@@ -0,0 +1,80 @@
+package campus.tech.kakao.map.model
+
+import android.content.ContentValues
+import android.content.Context
+
+class SearchLocationRepository(context: Context) {
+ private val locationDbHelper: LocationDbHelper = LocationDbHelper(context)
+ private val historyDbHelper: HistoryDbHelper = HistoryDbHelper(context)
+
+ fun searchLocation(category: String): List {
+ val db = locationDbHelper.readableDatabase
+ val searchQuery = "SELECT * FROM ${LocationContract.TABLE_NAME} " +
+ "WHERE ${LocationContract.COLUMN_CATEGORY} = '$category'"
+ val cursor = db.rawQuery(searchQuery, null)
+
+ val result = mutableListOf()
+ while (cursor.moveToNext()) {
+ result.add(
+ Location(
+ name = cursor.getString(cursor.getColumnIndexOrThrow(LocationContract.COLUMN_NAME)),
+ address = cursor.getString(cursor.getColumnIndexOrThrow(LocationContract.COLUMN_ADDRESS)),
+ category = cursor.getString(cursor.getColumnIndexOrThrow(LocationContract.COLUMN_CATEGORY))
+ )
+ )
+ }
+ cursor.close()
+ db.close()
+
+ return result.toList()
+ }
+
+ fun addHistory(locationName: String) {
+ if (isExistHistory(locationName)) {
+ removeHistory(locationName)
+ }
+
+ val db = historyDbHelper.writableDatabase
+ val historyValues = ContentValues()
+ historyValues.put(HistoryContract.COLUMN_NAME, locationName)
+ db.insert(HistoryContract.TABLE_NAME, null, historyValues)
+
+ db.close()
+ }
+
+ fun getHistory(): List {
+ val db = historyDbHelper.readableDatabase
+ val searchQuery = "SELECT * FROM ${HistoryContract.TABLE_NAME}"
+ val cursor = db.rawQuery(searchQuery, null)
+
+ val result = mutableListOf()
+ while (cursor.moveToNext()) {
+ result.add(cursor.getString(cursor.getColumnIndexOrThrow(HistoryContract.COLUMN_NAME)))
+ }
+
+ cursor.close()
+ db.close()
+ return result.toList()
+ }
+
+ private fun isExistHistory(locationName: String): Boolean {
+ val db = historyDbHelper.readableDatabase
+ val searchQuery = "SELECT * FROM ${HistoryContract.TABLE_NAME} " +
+ "WHERE ${HistoryContract.COLUMN_NAME} = '$locationName'"
+ val cursor = db.rawQuery(searchQuery, null)
+
+ val result = cursor.count > 0
+ cursor.close()
+ db.close()
+
+ return result
+ }
+
+ fun removeHistory(locationName: String) {
+ val db = historyDbHelper.writableDatabase
+ val deleteQuery = "DELETE FROM ${HistoryContract.TABLE_NAME} " +
+ "WHERE ${HistoryContract.COLUMN_NAME} = '$locationName'"
+ db.execSQL(deleteQuery)
+ db.close()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/view/HistoryAdapter.kt b/app/src/main/java/campus/tech/kakao/map/view/HistoryAdapter.kt
new file mode 100644
index 00000000..721a08f5
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/view/HistoryAdapter.kt
@@ -0,0 +1,52 @@
+package campus.tech.kakao.map.view
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.DiffUtil
+import androidx.recyclerview.widget.RecyclerView
+import campus.tech.kakao.map.databinding.ItemHistoryBinding
+import campus.tech.kakao.map.viewmodel.SearchLocationViewModel
+
+class HistoryAdapter(
+ private var dataList: List,
+ private val context: Context,
+ private val viewModel: SearchLocationViewModel
+) : RecyclerView.Adapter() {
+
+ inner class MyViewHolder(private val binding: ItemHistoryBinding) :
+ RecyclerView.ViewHolder(binding.root) {
+ init {
+ binding.removeLocationHistoryButton.setOnClickListener {
+ viewModel.removeHistory(dataList[bindingAdapterPosition])
+ }
+ }
+ fun binding(historyData: String) {
+ binding.locationHistoryNameTextView.text = historyData
+ }
+ }
+
+ fun updateDataList(newDataList: List) {
+ val diffUtil = HistoryDiffUtilCallback(dataList, newDataList)
+ val diffResult = DiffUtil.calculateDiff(diffUtil)
+
+ dataList = newDataList
+ diffResult.dispatchUpdatesTo(this)
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
+ return MyViewHolder(
+ ItemHistoryBinding.inflate(
+ LayoutInflater.from(context),
+ parent,
+ false
+ )
+ )
+ }
+
+ override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
+ holder.binding(dataList[position])
+ }
+
+ override fun getItemCount(): Int = dataList.size
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/view/HistoryDiffUtilCallback.kt b/app/src/main/java/campus/tech/kakao/map/view/HistoryDiffUtilCallback.kt
new file mode 100644
index 00000000..d70fd405
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/view/HistoryDiffUtilCallback.kt
@@ -0,0 +1,18 @@
+package campus.tech.kakao.map.view
+
+import androidx.recyclerview.widget.DiffUtil
+
+class HistoryDiffUtilCallback(
+ private val oldList: List,
+ private val newList: List
+) : DiffUtil.Callback() {
+ override fun getOldListSize(): Int = oldList.size
+
+ override fun getNewListSize(): Int = newList.size
+
+ override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean =
+ oldList[oldItemPosition] == newList[newItemPosition]
+
+ override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean =
+ oldList[oldItemPosition] == newList[newItemPosition]
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/view/SearchLocationActivity.kt b/app/src/main/java/campus/tech/kakao/map/view/SearchLocationActivity.kt
new file mode 100644
index 00000000..630b9956
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/view/SearchLocationActivity.kt
@@ -0,0 +1,59 @@
+package campus.tech.kakao.map.view
+
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.isVisible
+import androidx.lifecycle.ViewModelProvider
+import androidx.recyclerview.widget.LinearLayoutManager
+import campus.tech.kakao.map.databinding.ActivitySearchLocationBinding
+import campus.tech.kakao.map.model.SearchLocationRepository
+import campus.tech.kakao.map.viewmodel.SearchLocationViewModel
+
+class SearchLocationActivity : AppCompatActivity() {
+ private lateinit var viewModel: SearchLocationViewModel
+ private lateinit var binding: ActivitySearchLocationBinding
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ viewModel = ViewModelProvider(this)[SearchLocationViewModel::class.java]
+ viewModel.setRepository(SearchLocationRepository(this))
+ binding = ActivitySearchLocationBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+
+ binding.removeSearchInputButton.setOnClickListener {
+ binding.searchInputEditText.text.clear()
+ }
+
+ binding.searchInputEditText.addTextChangedListener(object : TextWatcher {
+ override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
+ override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
+ override fun afterTextChanged(s: Editable?) {
+ viewModel.searchLocation(s.toString())
+ }
+ })
+
+ viewModel.location.observe(this) {
+ it?.let { locationData ->
+ binding.searchResultRecyclerView.adapter = SearchLocationAdapter(locationData, this, viewModel)
+ binding.searchResultRecyclerView.layoutManager = LinearLayoutManager(this)
+ binding.emptyResultTextView.isVisible = locationData.isEmpty()
+ }
+ }
+
+ viewModel.history.observe(this) {
+ it?.let { historyData ->
+ val adapter = binding.searchHistoryRecyclerView.adapter as? HistoryAdapter
+
+ if (adapter == null) {
+ binding.searchHistoryRecyclerView.adapter = HistoryAdapter(historyData, this, viewModel)
+ } else {
+ adapter.updateDataList(historyData)
+ }
+
+ binding.searchHistoryRecyclerView.isVisible = historyData.isNotEmpty()
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/view/SearchLocationAdapter.kt b/app/src/main/java/campus/tech/kakao/map/view/SearchLocationAdapter.kt
new file mode 100644
index 00000000..14c2928c
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/view/SearchLocationAdapter.kt
@@ -0,0 +1,47 @@
+package campus.tech.kakao.map.view
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import campus.tech.kakao.map.databinding.ItemLocationBinding
+import campus.tech.kakao.map.model.Location
+import campus.tech.kakao.map.viewmodel.SearchLocationViewModel
+
+class SearchLocationAdapter(
+ private val dataList: List,
+ private val context: Context,
+ private val viewModel: SearchLocationViewModel
+) : RecyclerView.Adapter() {
+
+ inner class MyViewHolder(private val binding: ItemLocationBinding) :
+ RecyclerView.ViewHolder(binding.root) {
+ init {
+ binding.root.setOnClickListener {
+ viewModel.addHistory(dataList[bindingAdapterPosition].name)
+ }
+ }
+
+ fun bind(locationData: Location) {
+ binding.locationNameTextView.text = locationData.name
+ binding.locationAddressTextView.text = locationData.address
+ binding.locationTypeTextView.text = locationData.category
+ }
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
+ return MyViewHolder(
+ ItemLocationBinding.inflate(
+ LayoutInflater.from(context),
+ parent,
+ false
+ )
+ )
+ }
+
+ override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
+ holder.bind(dataList[position])
+ }
+
+ override fun getItemCount(): Int = dataList.size
+}
\ No newline at end of file
diff --git a/app/src/main/java/campus/tech/kakao/map/viewmodel/SearchLocationViewModel.kt b/app/src/main/java/campus/tech/kakao/map/viewmodel/SearchLocationViewModel.kt
new file mode 100644
index 00000000..a3080a5e
--- /dev/null
+++ b/app/src/main/java/campus/tech/kakao/map/viewmodel/SearchLocationViewModel.kt
@@ -0,0 +1,35 @@
+package campus.tech.kakao.map.viewmodel
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import campus.tech.kakao.map.model.Location
+import campus.tech.kakao.map.model.SearchLocationRepository
+
+class SearchLocationViewModel : ViewModel() {
+ private lateinit var repository: SearchLocationRepository
+ fun setRepository(repository: SearchLocationRepository) {
+ this.repository = repository
+ _history.value = repository.getHistory()
+ }
+
+ private val _location = MutableLiveData>()
+ val location: LiveData> = _location
+
+ private val _history = MutableLiveData>()
+ val history: LiveData> = _history
+
+ fun searchLocation(category: String) {
+ _location.value = repository.searchLocation(category)
+ }
+
+ fun addHistory(locationName: String) {
+ repository.addHistory(locationName)
+ _history.value = repository.getHistory()
+ }
+
+ fun removeHistory(locationName: String) {
+ repository.removeHistory(locationName)
+ _history.value = repository.getHistory()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/background_round.xml b/app/src/main/res/drawable/background_round.xml
new file mode 100644
index 00000000..bf633b04
--- /dev/null
+++ b/app/src/main/res/drawable/background_round.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/round_close_24.xml b/app/src/main/res/drawable/round_close_24.xml
new file mode 100644
index 00000000..13608b6a
--- /dev/null
+++ b/app/src/main/res/drawable/round_close_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/round_place_24.xml b/app/src/main/res/drawable/round_place_24.xml
new file mode 100644
index 00000000..eca274a7
--- /dev/null
+++ b/app/src/main/res/drawable/round_place_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 24d17df2..00000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_search_location.xml b/app/src/main/res/layout/activity_search_location.xml
new file mode 100644
index 00000000..2a4a86dd
--- /dev/null
+++ b/app/src/main/res/layout/activity_search_location.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_history.xml b/app/src/main/res/layout/item_history.xml
new file mode 100644
index 00000000..1f2ed09e
--- /dev/null
+++ b/app/src/main/res/layout/item_history.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_location.xml b/app/src/main/res/layout/item_location.xml
new file mode 100644
index 00000000..aa280dcb
--- /dev/null
+++ b/app/src/main/res/layout/item_location.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 768b058a..ab247e2f 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -2,4 +2,6 @@
#FF000000
#FFFFFFFF
+ #FF9E9E9E
+ #74C99F
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e5ba5b9c..688e5e1f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,5 @@
Map
+ ๊ฒ์์ด๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.
+ ๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ์์ต๋๋ค.
\ No newline at end of file