-
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_노신 4주차 Step2 #59
base: normenghub
Are you sure you want to change the base?
부산대 Android_노신 4주차 Step2 #59
Conversation
if (savedInstanceState == null) { | ||
showMapFragment() | ||
} |
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.
savedInstanceState가 없을때만 map fragment를 보여주게 한 이유가 있으신가요? 혹시, 화면회전이나 구성요소변경 상황을 대응하려고 하셨던것일까요?
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 searchPlaces(query: String) { | ||
val apiKey = "KakaoAK ${campus.tech.kakao.map.BuildConfig.KAKAO_REST_API_KEY}" | ||
|
||
RetrofitClient.instance.searchPlaces(apiKey, query).enqueue(object : Callback<ResultSearchKeyword> { | ||
override fun onResponse(call: Call<ResultSearchKeyword>, response: Response<ResultSearchKeyword>) { | ||
if (response.isSuccessful && response.body() != null) { | ||
val places = response.body()?.documents ?: emptyList() | ||
if (places.isEmpty()) { | ||
showNoResultMessage() | ||
} else { | ||
hideNoResultMessage() | ||
adapter.updateData(places) | ||
} | ||
} else { | ||
showNoResultMessage() | ||
} | ||
} | ||
|
||
override fun onFailure(call: Call<ResultSearchKeyword>, t: Throwable) { | ||
showNoResultMessage() | ||
} | ||
}) | ||
} |
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.
이 부분은 카카오api를 통해서 장소검색을 수행하는곳 이네요. UI표현, 데이터 조회를 모두 fragment에서 하기 보다는 data를 가져오는곳을 repository로 분리하는것이 좋을것 같습니다. UI 입장에서 어디에서 데이터를 가져오는지 까지 담당할 필요는 없기 때문이죠. 조회가 완료된 형태의 places데이터만 전달받는게 어떨까 합니다.
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.
수정 했습니다.
어려웠던 점
멘토님에게 말씀드린 에러 처리를 못했습니다. 코드리뷰후 수정을 거치겠습니다
중점적으로 리뷰해주셨으면 하는 부분
없습니다.