-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace show/hide keyboard extensions with new implementation based o…
…n WindowInsetsControllerCompat.
- Loading branch information
1 parent
4bfb5fa
commit 11be15e
Showing
3 changed files
with
26 additions
and
21 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
19 changes: 0 additions & 19 deletions
19
blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Activity.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
21 changes: 21 additions & 0 deletions
21
blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Window.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,21 @@ | ||
package reactivecircus.blueprint.ui.extension | ||
|
||
import android.view.Window | ||
import androidx.core.view.WindowInsetsCompat | ||
import androidx.core.view.WindowInsetsControllerCompat | ||
|
||
/** | ||
* Programmatically shows the soft keyboard. | ||
*/ | ||
public fun Window.showSoftKeyboard() { | ||
WindowInsetsControllerCompat(this, decorView.findViewById(android.R.id.content)) | ||
.show(WindowInsetsCompat.Type.ime()) | ||
} | ||
|
||
/** | ||
* Programmatically hides the soft keyboard. | ||
*/ | ||
public fun Window.hideSoftKeyboard() { | ||
WindowInsetsControllerCompat(this, decorView.findViewById(android.R.id.content)) | ||
.hide(WindowInsetsCompat.Type.ime()) | ||
} |