-
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 신혜서 3주차 과제 STEP1 #52
base: main
Are you sure you want to change the base?
Conversation
검색결과가 없다는 문구 visibility로 정리
검색결과가 없다는 문구 visibility로 정리
에뮬 실행 안되는 오류 수정
SearchView로 변경했습니다.
+ NullPointerException 에러해결
+ NullPointerException 에러해결
RestAPI키를 잘못입력함
RestAPI키를 잘못입력함
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.
혜서님 3주차도 고생 많으셨습니다. 전반적으로 실행하시는 것에 집중해주신 것 같아요. 조금만 더 힘내보죠!
코딩 컨벤션에 대해서는 조금만 더 신경써주세요! 클래스 이름도 조금 더 용도에 맞게 명확하게 짓는 부분도요!
@SerializedName("category_group_name") val categoryName: String, | ||
@SerializedName("id") val id: String, | ||
@SerializedName("address_name") val addressName: String, | ||
@SerializedName("place_name") val placeName: 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.
Gson 을 사용한다면 null safety 하지 않을 수 있어요. 모두 null 처리해주시면 조금 더 안전하게 사용할 수 있어요.
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.
camel case 로 변경 부탁드려요!
class SearchViewModel private constructor(private val searchRepository: SearchRepo) : ViewModel() { | ||
companion object { | ||
@Volatile private var instance: SearchViewModel? = null | ||
|
||
fun getInstance(searchRepository: SearchRepo): SearchViewModel { | ||
return instance ?: synchronized(this) { | ||
instance ?: SearchViewModel(searchRepository).also { instance = it } | ||
} | ||
} | ||
} | ||
fun insertSearchData(data: String) { | ||
searchRepository.insertSearchData(data) | ||
} | ||
|
||
fun getAllSearchData(): List<String> { | ||
return searchRepository.getAllSearchData() | ||
} | ||
|
||
fun bind(s: 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.
사용되지 않는 코드
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
KakaoSdk.init(this, "e6a7c826ae7a55df129b8be2c636e213") |
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 key 들은 코드에 노출되면 안됩니다. 요 블로그 한번 읽어보시면 도움이 될 듯 합니다.
private lateinit var searchResultAdapter: PlaceAdapter | ||
private lateinit var savedSearchAdapter: SavedSearchAdapter | ||
private lateinit var databaseHelper: MyDatabaseHelper | ||
private lateinit var MapViewKakao: MapView |
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 fun createKakaoApiService(): KakaoApiService { | ||
val logging = HttpLoggingInterceptor().apply { | ||
level = HttpLoggingInterceptor.Level.BASIC | ||
} | ||
|
||
val okHttpClient = OkHttpClient.Builder() | ||
.addInterceptor(logging) | ||
.addInterceptor { chain -> | ||
val request = chain.request().newBuilder() | ||
.addHeader("Authorization", "KakaoAK 13c6b4e1c003d0f42b3b07888391c355") | ||
.build() | ||
chain.proceed(request) | ||
} | ||
.build() | ||
|
||
val retrofit = Retrofit.Builder() | ||
.baseUrl("https://dapi.kakao.com") | ||
.client(okHttpClient) | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.build() | ||
|
||
return retrofit.create(KakaoApiService::class.java) | ||
} |
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.
KakaoApiService 는 Activity 에서 생성하면 안될 것 같습니다. kakao api service 를 사용하는 부분은 최대한 viewModel 로 로직을 옮겨주시면 좋을 것 같습니다!
기능 요구 사항
프로그래밍 요구 사항
How to make
(Response 파일에 생성해도 좋았을텐데 약간 돌고돌아오는(?) 느낌입니다!! 쓸데없이 파일을 많이 생성한 느낌)
코드를 보면서 조금 아쉬웠던(?) 점 입니다.
MapContract.COLUMN_ADDRESS to (document.addressName ?: "No Address"),
MapContract.COLUMN_CATEGORY to (document.categoryName ?: "No Category")
이 함수의 경우 그냥 MapContract를 삭제하고 document.categoryName ?: "No Category" 라고 해도 괜찮았을 것 같습니당...STEP2에 고쳐볼께용