-
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
[0.2.0-alph/AN-UI,Fix] 화면 나갔다가 5초 이후에 들어오면 오둥이 보이는 버그 수정 + clearFocus #225
Changes from all commits
e1abef6
717ddbc
41290c4
e91e47e
c922bc2
c7e5188
2ad1033
05f0642
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
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) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,10 @@ import kotlinx.coroutines.launch | |
|
||
object RefreshEventBus { | ||
private val coroutineScope: CoroutineScope = CoroutineScope(SupervisorJob()) | ||
private val _event = MutableEventFlow<Unit>(capacity = 1) | ||
private val _event = MutableEventFlow<Unit>() | ||
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. capacity 는 왜 없어졌나요? 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. DefaultArgument로 빼서 없앴습니다 ㅋㅋㅋㅋ |
||
val event: EventFlow<Unit> = _event.asEventFlow() | ||
|
||
fun send() { | ||
fun refresh() { | ||
coroutineScope.launch { | ||
_event.emit(Unit) | ||
} | ||
|
This file was deleted.
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. 감사합니다!~ |
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 가 삭제되지 않는다`() = | ||
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. EventFlow 테스트는 이런식으로 하는거군요 ! 👍 |
||
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) | ||
} | ||
} |
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.
오홍