-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
부산대 Android_김정희_5주차 과제_2단계 #83
base: lovelhee
Are you sure you want to change the base?
Changes from all commits
04c907f
8b097b3
1e95da9
4a7f9a8
42afbd1
517f77f
7ce9207
97252e2
de8235e
c09822b
6648952
f768d06
4667bef
34d7f19
af00889
4696833
270aa41
d8b123a
ba8c9e9
d87066d
14eab04
bbf77e9
566e065
9761014
a8018be
83e4264
d55b398
0a8dbb8
72262c9
6199ae0
a1ea940
5ad8740
923a0e6
ed5c86b
9d0cb76
1ad92d6
c4d7d2c
789b398
200828c
e2799c0
8969b8d
ecfb8d4
491fd21
6547a98
779e8bf
1012e1c
8668c0b
5387bbc
39c2aca
cdc82a9
f5f422f
3355c00
649ec19
964fa52
7f38d89
b251102
d636f3f
2ddc919
ebf3aa5
a799aac
e4daf88
59f842d
2c127ca
078fd2e
2623c4d
3a508e5
95bf427
706f113
b0126f0
2105f5b
f515e0f
19241e0
44b0c8b
2a48e98
27fdfc3
bc60c27
2f197c3
a9d021d
1426ecf
f410091
8b53376
df98574
a326fb9
f64ef36
5ef4c73
58f0b7c
10d4af5
0ef011a
2fe82cb
dd6806c
5f276af
a8d7d08
d876e3d
bd802f4
f34c050
fb20a77
80e3e32
f99f9a8
e8f6ef1
4efd28f
c9b3deb
b1a01df
b119c29
397118a
b2cd4d4
519b7a4
cd214ea
ed93aca
78d2c65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,12 @@ | ||
package campus.tech.kakao.map.database | ||
|
||
import android.content.Context | ||
import androidx.room.Database | ||
import androidx.room.Room | ||
import androidx.room.RoomDatabase | ||
import campus.tech.kakao.map.model.MapItemEntity | ||
|
||
@Database(entities = [MapItemEntity::class], version = 1, exportSchema = false) | ||
abstract class AppDatabase : RoomDatabase() { | ||
abstract fun mapItemDao(): MapItemDao | ||
|
||
companion object { | ||
@Volatile | ||
private var instanceDb: AppDatabase? = null | ||
abstract fun mapItemDao(): MapItemDao | ||
|
||
fun getDatabase(context: Context): AppDatabase { | ||
return instanceDb ?: synchronized(this) { | ||
val instance = Room.databaseBuilder( | ||
context.applicationContext, | ||
AppDatabase::class.java, | ||
"mapItemDatabase" | ||
).build() | ||
instanceDb = instance | ||
instance | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package campus.tech.kakao.map.network | ||
|
||
import campus.tech.kakao.map.model.KakaoMapProductResponse | ||
import retrofit2.Call | ||
import retrofit2.Response | ||
import retrofit2.http.GET | ||
import retrofit2.http.Header | ||
import retrofit2.http.Query | ||
|
||
interface KakaoMapRetrofitService { | ||
@GET("v2/local/search/keyword.json") | ||
fun searchPlaces( | ||
suspend fun searchPlaces( | ||
@Header("Authorization") apiKey: String, | ||
@Query("query") query: String | ||
): Call<KakaoMapProductResponse> | ||
): Response<KakaoMapProductResponse> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package campus.tech.kakao.map.ui | ||
// | ||
//import android.widget.EditText | ||
//import androidx.databinding.BindingAdapter | ||
//import androidx.databinding.InverseBindingAdapter | ||
//import androidx.databinding.InverseBindingListener | ||
//import androidx.lifecycle.MutableLiveData | ||
// | ||
//@BindingAdapter("app:keyword") | ||
//fun setKeyword(editText: EditText, keyword: MutableLiveData<String>?) { | ||
// if (keyword != null && editText.text.toString() != keyword.value) { | ||
// editText.setText(keyword.value) | ||
// } | ||
//} | ||
// | ||
//@InverseBindingAdapter(attribute = "app:keyword") | ||
//fun getKeyword(editText: EditText): String { | ||
// return editText.text.toString() | ||
//} | ||
Comment on lines
+9
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아마 XML EditText에 양방향 데이터바인딩 을 적용하기위한 코드로 보이네요. MutableLiveData 타입으로 선언후 XML에서 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 양방향을 적용시키기 위함이 맞습니다! 처음에 코드를 짤 때 해당 오류가 계속 발생해서 자료를 찾아보니 BindingAdapter를 사용하는 것이 해결 방법이라고 해서 모든 xml 바인딩에 커스텀 어댑터가 필수적이라고 오해했어요 😢 멘토님이 알려주신 방법이 훨씬 좋은 거 같습니다 👍👍 |
||
// | ||
//@BindingAdapter("app:keywordAttrChanged") | ||
//fun setKeywordListener(editText: EditText, listener: InverseBindingListener?) { | ||
// if (listener != null) { | ||
// editText.addTextChangedListener(object : android.text.TextWatcher { | ||
// override fun afterTextChanged(s: android.text.Editable?) { | ||
// listener.onChange() | ||
// } | ||
// | ||
// override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} | ||
// override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {} | ||
// }) | ||
// } | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트코드가 모두 주석처리 되어있네요.
동작변경으로 인해 새롭게 작성해야해서 그런것인가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MainActivty.kt 를 변경하면서 해당 테스트 빌드시 오류가 나길래 잠시 주석처리해뒀습니다 - !! 추후에 테스트도 리팩토링 해보려구요!