-
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.
[0.2.0-alph/AN-UI,Fix] 화면 나갔다가 5초 이후에 오둥이 보이는 버그 수정 + clearFocus (#225)
* refactor: PokeListFragment -> PokeActivity * test: EventFLowTest * chore: RefreshEventBus 네이밍 변경 * fix: 5초 지나고 화면 다시 돌아오면 오둥이 보이는 버그 수정 * feat: SearchView clearFocus * style: ktFormat * ui: margin 늘리기
- Loading branch information
Showing
12 changed files
with
127 additions
and
123 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
19 changes: 0 additions & 19 deletions
19
android/app/src/main/java/poke/rogue/helper/presentation/dex/PokemonActivity.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
22 changes: 22 additions & 0 deletions
22
android/app/src/main/java/poke/rogue/helper/presentation/util/activity/ActivityExtension.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,22 @@ | ||
package poke.rogue.helper.presentation.util.activity | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.view.inputmethod.InputMethodManager | ||
|
||
fun Activity.hideKeyboard() { | ||
val inputMethodManager = | ||
getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
currentFocus?.let { view -> | ||
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) | ||
view.clearFocus() | ||
} | ||
} | ||
|
||
fun Activity.show() { | ||
val inputMethodManager = | ||
getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
currentFocus?.let { view -> | ||
inputMethodManager.showSoftInput(view, 0) | ||
} | ||
} |
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 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
59 changes: 59 additions & 0 deletions
59
android/app/src/test/java/poke/rogue/helper/presentation/util/event/EventFlowTest.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,59 @@ | ||
package poke.rogue.helper.presentation.util.event | ||
|
||
import io.kotest.matchers.shouldBe | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.flow.launchIn | ||
import kotlinx.coroutines.flow.onEach | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.test.UnconfinedTestDispatcher | ||
import kotlinx.coroutines.test.advanceTimeBy | ||
import kotlinx.coroutines.test.runTest | ||
import org.junit.jupiter.api.Test | ||
|
||
class EventFlowTest { | ||
@OptIn(ExperimentalCoroutinesApi::class) | ||
@Test | ||
fun `EventFlow 는 소비할 때까지 element 가 삭제되지 않는다`() = | ||
runTest(UnconfinedTestDispatcher()) { | ||
// given | ||
val eventFlow = MutableEventFlow<Int>() | ||
// when | ||
eventFlow.emit(1) | ||
delay(10) | ||
// then | ||
eventFlow | ||
.onEach { | ||
println(">>> onEach: $it") | ||
it shouldBe 1 | ||
} | ||
.launchIn(backgroundScope) | ||
} | ||
|
||
@OptIn(ExperimentalCoroutinesApi::class) | ||
@Test | ||
fun `EventFlow 는 element 를 공유하지 않는다`() = | ||
runTest { | ||
// given | ||
val eventFlow = MutableEventFlow<Int>() | ||
// when | ||
eventFlow.emit(1) | ||
delay(10) | ||
// then | ||
backgroundScope.launch { | ||
launch { | ||
eventFlow.collect { | ||
println(">>> collect: $it") | ||
it shouldBe 1 | ||
} | ||
} | ||
launch { | ||
eventFlow.collect { | ||
println(">>> Never Collect AnyThing") | ||
it shouldBe Int.MAX_VALUE | ||
} | ||
} | ||
} | ||
advanceTimeBy(100) | ||
} | ||
} |