-
Notifications
You must be signed in to change notification settings - Fork 0
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
[1.2.0/ AN-UI, AN-FEAT] 배틀 날씨 효과 UI 변경 #487
Changes from 8 commits
d341db8
cae2ac4
f5531a0
24f75f8
1a1f83c
86d1211
ddb40e8
9c53d4d
dbb1229
a525fbd
cf1b0cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package poke.rogue.helper.presentation.battle | ||
|
||
import android.view.View | ||
import androidx.databinding.BindingAdapter | ||
|
||
@BindingAdapter("animatedVisibility") | ||
fun View.setAnimatedVisibility(visible: Boolean) { | ||
if (visible) { | ||
animate().alpha(1f).setDuration(200).withStartAction { | ||
visibility = View.VISIBLE | ||
}.start() | ||
} else { | ||
animate().alpha(0f).setDuration(200).withEndAction { | ||
visibility = View.GONE | ||
}.start() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,9 @@ class BattleViewModel( | |
battleResult.map { it.isSuccess() } | ||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), false) | ||
|
||
private val _showWeatherEffect = MutableStateFlow(false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 저도 동감합니다~ 근데 |
||
val showWeatherEffect = _showWeatherEffect.asStateFlow() | ||
|
||
init { | ||
initWeathers() | ||
handlePokemonSelection(pokemonId, selectionType) | ||
|
@@ -249,6 +252,14 @@ class BattleViewModel( | |
_navigationEvent.emit(NavigateToDetail(pokemonId)) | ||
} | ||
} | ||
|
||
fun toggleWeatherEffect() { | ||
_showWeatherEffect.value = !_showWeatherEffect.value | ||
} | ||
|
||
fun hideWeatherEffect() { | ||
_showWeatherEffect.value = false | ||
} | ||
} | ||
|
||
sealed interface BattleNavigationEvent | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ enum class WeatherIcon( | |
TURBULENCE(R.drawable.icon_air), | ||
} | ||
|
||
fun WeatherUiModel.hasWeatherEffect(): Boolean = effect.isNotBlank() && effect.isNotEmpty() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
fun Weather.toUi(): WeatherUiModel { | ||
val weatherIcon = | ||
when (id) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@color/poke_grey_70" /> | ||
<corners android:radius="4dp" /> | ||
</shape> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@drawable/bg_battle_description" android:state_selected="true" /> | ||
<item android:drawable="@drawable/bg_battle_default"/> | ||
</selector> |
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.
따로 분리하셨군요 굿 👍👍