<commit_before>package com.ridi.books.helper.view

import android.content.Context
import android.view.View
import android.view.inputmethod.InputMethodManager

private val Context.inputMethodManager: InputMethodManager
    get() = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager

@JvmOverloads
fun View.showSoftKeyboard(flags: Int = InputMethodManager.SHOW_IMPLICIT) =
    context.inputMethodManager.showSoftInput(this, flags)

@JvmOverloads
fun View.hideSoftKeyboard(flags: Int = 0) = context.inputMethodManager.hideSoftInputFromWindow(windowToken, flags)

@JvmOverloads
fun Context.toggleSoftKeyboard(showFlags: Int = 0, hideFlags: Int = 0) {
    inputMethodManager.toggleSoftInput(showFlags, hideFlags)
}<commit_msg>뷰에 포커스를 주고 동시에 키보드를 띄우는 확장 매서드 추가<commit_after>package com.ridi.books.helper.view

import android.content.Context
import android.view.View
import android.view.inputmethod.InputMethodManager

private val Context.inputMethodManager: InputMethodManager
    get() = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager

@JvmOverloads
fun View.showSoftKeyboard(flags: Int = InputMethodManager.SHOW_IMPLICIT) =
    context.inputMethodManager.showSoftInput(this, flags)

@JvmOverloads
fun View.hideSoftKeyboard(flags: Int = 0) = context.inputMethodManager.hideSoftInputFromWindow(windowToken, flags)

@JvmOverloads
fun Context.toggleSoftKeyboard(showFlags: Int = 0, hideFlags: Int = 0) {
    inputMethodManager.toggleSoftInput(showFlags, hideFlags)
}

@JvmOverloads
fun View.focusAndShowSoftKeyboard(
    flags: Int = InputMethodManager.SHOW_IMPLICIT,
    repeatIntervalInMs: Long = 100,
    condition: () -> Boolean = { true }
) {
    if (condition().not()) {
        return
    }

    requestFocus()
    if (showSoftKeyboard(flags).not()) {
        postDelayed({ focusAndShowSoftKeyboard(flags, repeatIntervalInMs, condition) }, repeatIntervalInMs)
    }
}
{'fraction_non_alphanumeric': 0.0912906610703043, 'fraction_numerical': 0.00472193074501574, 'mean_word_length': 5.909420289855072, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6345660', 'n_tokens_mistral': 599, 'n_tokens_neox': 623, 'n_words': 111}