-
Notifications
You must be signed in to change notification settings - Fork 33
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 남지연 3주차 과제 Step2 #104
base: njiyeon
Are you sure you want to change the base?
Conversation
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.
한 주 수고하셨습니다!
리뷰 남겨드리니 의견 부탁드려요 !
private val remove: ImageView = view.findViewById(R.id.remove_icon) | ||
private val keyword: TextView = view.findViewById(R.id.keyword) |
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.
View의 경우 ~View를 suffix로 붙여서 변수 정의하시는게 변수 알아보기엔 더 좋을것 같아요
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.
넵! 수정하였습니다
val place_name: String, | ||
val address_name: String, | ||
val category_group_name: String |
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.
Kotlin convention인 camel case로 작성해주시고 역직렬화는 SerializedName 어노테이션을 활용해보세요
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.
수정하였습니다 !
newVersion: Int | ||
) { | ||
db?.execSQL(SQL_DELETE_ENTRIES) | ||
onCreate(db) |
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.
넵 수정하였습니다
|
||
fun update(keyword: String) { | ||
val db = dbHelper.writableDatabase | ||
ContentValues().apply { |
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.
apply scope function은 속성을 세팅하기 위해 보통 사용합니다. 아래릐 코드 블럭에 있는 로직을 처리하기에는 어색한 부분이 있네요
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.
객체 생성 후 값을 직접 지정하는 방식으로 수정하였습니다.
binding = ActivitySearchBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
Log.d("123123", Utility.getKeyHash(this)) |
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.
넵 삭제하였습니다 !
|
||
// Retrofit 초기화 | ||
val retrofit = Retrofit.Builder() | ||
.baseUrl("https://dapi.kakao.com/") |
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.
url 관련된 부분은 따로 상수로 빼는게 좋겠네요. BuildConfig 쪽으로도 빼주셔도 좋습니다
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.
KAKAO_BASE_URL 변수로 수정하였습니다.
try { | ||
val response = api.searchKeyword("KakaoAK ${campus.tech.kakao.map.BuildConfig.KAKAO_REST_API_KEY}", keyword) | ||
_items.value = response.documents.map { | ||
Item(it.place_name, it.address_name, it.category_group_name) |
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.
실행해보셨나요? Document 부분 필드명 변경하셨는데 이 부분은 반영되지 않았네요
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.
다시 수정하여 제출하도록 하겠습니다. 제가 지난주에 몸이 안좋아서 과제에 미흡한 부분이 많았습니다. 죄송합니다
} | ||
|
||
override fun onSearchItemClick(item: Item) { | ||
// 검색 항목 클릭 시 수행할 작업 |
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.
코드를 수정하면서 누락되었습니다. 다시 수정하여 업로드하도록 하겠습니다.
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.
몇몇 기능들이 빠져있는걸로 보입니다. 예를 들어 키워드 검색까지는 되는데 아이템 클릭이 안되어서 검색어 저장 및 삭제 구현도 확인할 수 없었습니다. 확인부탁드려요
class KeywordViewModel(private val keywordRepository: KeywordRepository) : ViewModel(), | ||
OnSearchItemClickListener, OnKeywordItemClickListener { |
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.
ItemClickListener를 ViewModel에서 구현한 이유가 있으실까요?
클릭 이벤트와 같은 상호작용을 위한 Interface는 View 내에서만 로직을 구성해주세요. ViewModel은 View와 Model 간의 브릿지 역할을 하기만 해주세요.
그리고 구현했지만 실제 Adapter랑 연결이 안되어 있어서 제대로 작동하지 않고 있네요.
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.
기능이 동작하도록 다시 수정하였습니다!
어려웠던 부분
문제 1
public static final String kakaoRestApiKey = "키값; "라는 오류가 발생합니다.
build 파일은 수정할 수 없다는 내용을 검색하여 gradle에 있었던 문제임을 알게 되었고, 그곳에서 따옴표를 빼고 적었던 걸 발견하여 수정하였습니다.
문제 2
키 값을 읽어올 때, gradle 코드 상의 문제는 없는데 계속해서 오류가 나타나는 문제가 있습니다.
gradle 파일에서 위의 코드로 localproperty를 읽었을 때 계속 오류가 발생하였는데, 아래와 같이 코드를 수정하고, Config로 데이터를 읽는 경우 key값에 따옴표를 표시한 뒤로 오류가 발생하지 않습니다.