-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: DataStore 의존성 설정 * feat: Datastore 저장 로직 추가 * feat: 저장된 선택 데이터 UI 에 반영 * refactor: Skill 캐싱 * refactor: Test 객체 수정 * refactor: context 참조 수정 * refactor: 리팩토링 리뷰 반영 * refactor: 아이디 저장값 분리 * feat: Spinner 초기화 시 0으로 자동 선택되는거 방지하는 ItemSelectListener 구현 * feat: 날씨저장 * fix: BattleActivity Context 수정 * refactor: xxStream postFix 붙이기, suspend 함수 제거 * ktlintFormat * fix: weather 가 결과에 영향 안주던거 수정 * refactor : Flow 반환 함수 네이밍 (Stream) 붙이기 * refactor: hashMap -> mutableMap * ktLintFormat --------- Co-authored-by: JoYehyun <[email protected]>
- Loading branch information
1 parent
c26fa01
commit 61aa1a4
Showing
7 changed files
with
103 additions
and
33 deletions.
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
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
27 changes: 27 additions & 0 deletions
27
...p/src/main/java/poke/rogue/helper/presentation/battle/view/WeatherItemSelectedListener.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 poke.rogue.helper.presentation.battle.view | ||
|
||
import android.view.View | ||
import android.widget.AdapterView | ||
|
||
inline fun <reified T> itemSelectListener(crossinline onSelected: (T) -> Unit): AdapterView.OnItemSelectedListener { | ||
var isSpinnerInitialized = false | ||
return object : AdapterView.OnItemSelectedListener { | ||
override fun onItemSelected( | ||
parent: AdapterView<*>?, | ||
view: View?, | ||
position: Int, | ||
id: Long, | ||
) { | ||
if (isSpinnerInitialized) { | ||
val selectedData = parent?.getItemAtPosition(position) | ||
val castedData = | ||
requireNotNull(selectedData as? T) { "Selected data is not a ${T::class.simpleName}" } | ||
onSelected(castedData) | ||
} else { | ||
isSpinnerInitialized = true | ||
} | ||
} | ||
|
||
override fun onNothingSelected(parent: AdapterView<*>?) {} | ||
} | ||
} |
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
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