-
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주차 2단계(리팩토링 완료) #72
Open
JieunYume
wants to merge
33
commits into
kakao-tech-campus-2nd-step2:jieunyume
Choose a base branch
from
JieunYume:jieunyume-step2
base: jieunyume
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a749e88
docs: README.md 작성
JieunYume 80c47d6
refactor: SavedLocationHolder의 뷰 변수를 by lazy로 변경
JieunYume 3abbc9b
feat: 저장된 검색어의 제목(title)을 전달하는 콜백 함수 구현
JieunYume b0527b5
feat: itemView에 콜백 함수 적용
JieunYume adca161
feat: MainActivity에서 콜백 함수 구현해서 LocationViewModel의 searchLocationsFro…
JieunYume 6d7449b
refactor: handleNoResultMessage() 함수를 만들어서 중복 코드 제거
JieunYume e533b25
feat: searchEditText의 text를 저장된 검색어의 제목(title)로 설정
JieunYume 2eb7b23
feat: searchEditText의 커서 위치 변경
JieunYume 0b3db81
refactor: 콜백 함수 이름을 네이밍 컨벤션에 맞게 변경
JieunYume 193fa3c
refactor: LocationLocalDataSource에서 중복 코드를 함수로 분리
JieunYume 681b945
feat: 키워드로 장소 검색하는 api에서 x, y 값 받아오기
JieunYume 88faf63
feat: 검색 결과 목록 중 하나의 항목을 선택하면 MapActivity로 전환되게 구현
JieunYume 66c2ece
feat: mapView의 좌표를 검색 결과 목록 중 선택된 항목의 좌표로 설정
JieunYume 4f44f65
feat: 검색 결과 목록 중 선택된 항목의 좌표에 KakaoMap label을 추가
JieunYume 97a4556
feat: SharedPreferences에 마지막 좌표 저장 및 불러오기 기능 구현
JieunYume e1786ed
feat: onMapError() 호출 시 에러 화면 노출
JieunYume c3d8a4a
feat: MapActivity에서 BottomSheet를 사용하여 위치 정보 노출
JieunYume 038d548
refactor: 뷰 변수들을 by lazy로 정의하도록 변경
JieunYume 116e601
refactor: onMapError()에서 에러 메세지를 띄울 때 스레드를 runOnUiThread로 변경
JieunYume 8b2cd64
refactor: 저장된 데이터가 없을 때 null 처리로 BottomSheet가 뜨지 않게 설정
JieunYume b99401c
refactor: onMapReady에서 함수 분리
JieunYume 8e0f341
docs: update README.md
JieunYume 5bb2978
feat: mockito 의존성 주입
JieunYume 9cd5962
test: MapAcitivty UI 테스트
JieunYume 2a94f4b
test: MainActivity UI 테스트
JieunYume 985f813
test: LocationLocalDataSource 단위 테스트
JieunYume bc7d87d
test: LocationLocalDataSource에서 위치 검색 기능 삭제
JieunYume 322ff94
refactor: Location의 lat과 lng의 자료형을 String에서 Double로 변경
JieunYume f5b77ec
refactor: 2주차 과제 코드 삭제
JieunYume b5df635
refactor: KakaoSdk의 초기화 코드를 MapActivity에서 App 클래스로 이동
JieunYume 1e95911
refactor: onMapReady() 내에서 runOnUiThread() 삭제
JieunYume 5472947
refactor: SharedPreference를 싱글톤으로 사용하고, MapActivity에서 ViewModel을 통해 사…
JieunYume af188b9
refactor: DataSource와 Repository 이름 변경
JieunYume File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
package campus.tech.kakao.map | ||
|
||
import android.app.Application | ||
import campus.tech.kakao.map.model.datasource.SharedPreferences | ||
import com.kakao.vectormap.KakaoMapSdk | ||
|
||
class App : Application(){ | ||
companion object{ | ||
lateinit var sharedPreferencesManager : SharedPreferences | ||
} | ||
override fun onCreate() { | ||
sharedPreferencesManager = SharedPreferences(applicationContext) | ||
KakaoMapSdk.init(this, BuildConfig.KAKAO_API_KEY) | ||
super.onCreate() | ||
KakaoMapSdk.init(this, BuildConfig.KAKAO_API_KEY); | ||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/campus/tech/kakao/map/model/datasource/LastLocationLocalDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package campus.tech.kakao.map.model.datasource | ||
|
||
import campus.tech.kakao.map.App | ||
import campus.tech.kakao.map.model.Location | ||
|
||
class LastLocationLocalDataSource() { | ||
|
||
fun putLastLocation(location: Location) { | ||
if (location != null) { | ||
App.sharedPreferencesManager.putString("longitude", location.longitude.toString()) | ||
App.sharedPreferencesManager.putString("latitude", location.latitude.toString()) | ||
App.sharedPreferencesManager.putString("title", location.title.toString()) | ||
App.sharedPreferencesManager.putString("address", location.address.toString()) | ||
App.sharedPreferencesManager.putString("category", location.category.toString()) | ||
} | ||
} | ||
|
||
fun getLastLocation(): Location? { | ||
val title = App.sharedPreferencesManager.getString("title", "") | ||
if(title == "") return null | ||
val longitude = App.sharedPreferencesManager.getString("longitude", "").toString().toDouble() | ||
val latitude = App.sharedPreferencesManager.getString("latitude", "").toString().toDouble() | ||
val address = App.sharedPreferencesManager.getString("address", "").toString() | ||
val category = App.sharedPreferencesManager.getString("category", "").toString() | ||
return Location(title, address, category, longitude, latitude) | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
app/src/main/java/campus/tech/kakao/map/model/datasource/LocationLocalDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/java/campus/tech/kakao/map/model/datasource/SharedPreferences.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package campus.tech.kakao.map.model.datasource | ||
|
||
import android.content.Context | ||
|
||
class SharedPreferences(context: Context) { | ||
private val prefs = context.getSharedPreferences("myPref", Context.MODE_PRIVATE) | ||
|
||
fun getString(key: String, defValue: String): String { | ||
return prefs.getString(key, defValue).toString() | ||
} | ||
|
||
fun putString(key: String, value: String) { | ||
prefs.edit().putString(key, value).apply() | ||
|
||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/campus/tech/kakao/map/model/repository/LastLocationRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package campus.tech.kakao.map.model.repository | ||
|
||
import campus.tech.kakao.map.model.Location | ||
import campus.tech.kakao.map.model.datasource.LastLocationLocalDataSource | ||
|
||
class LastLocationRepository( | ||
private val lastLocationLocalDataSource: LastLocationLocalDataSource | ||
) { | ||
fun putLastLocation(location: Location){ | ||
lastLocationLocalDataSource.putLastLocation(location) | ||
} | ||
|
||
fun getLastLocation(): Location? { | ||
return lastLocationLocalDataSource.getLastLocation() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
app/src/main/java/campus/tech/kakao/map/view/map/Coordinates.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
app/src/main/java/campus/tech/kakao/map/view/search/OnItemSelectedListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package campus.tech.kakao.map.view.search | ||
|
||
import campus.tech.kakao.map.model.Location | ||
import campus.tech.kakao.map.model.SavedLocation | ||
|
||
interface OnItemSelectedListener { | ||
fun onLocationViewClicked(title: String, longitude: Double, latitude: Double, address:String) | ||
fun onLocationViewClicked(location: Location) | ||
fun onSavedLocationXButtonClicked(item: SavedLocation) | ||
fun onSavedLocationViewClicked(title: String) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,5 @@ class LocationViewModel( | |
handleNoResultMessage(getSearchedLocationsSize()) | ||
} | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이부분은 추후에 hilt 적용해보면서 의존성 주입받을 수 있도록 변경해보죠!