File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
kotlinyan-common/src/main/kotlin/moe/feng/kotlinyan/common Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import android.view.inputmethod.InputMethodManager
1010import android.widget.ImageView
1111import kotlin.concurrent.thread
1212
13- interface ViewExtensions {
13+ interface ViewExtensions : ServiceExtensions {
1414
1515 // Find views
1616
@@ -24,16 +24,14 @@ interface ViewExtensions {
2424 */
2525 fun View.showKeyboard () {
2626 this .requestFocus()
27- val imm = context.getSystemService(Context .INPUT_METHOD_SERVICE ) as InputMethodManager
28- imm.showSoftInput(this , InputMethodManager .SHOW_IMPLICIT )
27+ context.inputMethodManager.showSoftInput(this , InputMethodManager .SHOW_IMPLICIT )
2928 }
3029
3130 /* *
3231 * Hide keyboard when the view is focused.
3332 */
3433 fun View.hideKeyboard () {
35- val imm = context.getSystemService(Context .INPUT_METHOD_SERVICE ) as InputMethodManager
36- imm.hideSoftInputFromWindow(windowToken, 0 )
34+ context.inputMethodManager.hideSoftInputFromWindow(windowToken, 0 )
3735 }
3836
3937 // Visibility Methods
You can’t perform that action at this time.
0 commit comments