Upgrade to Pro — share decks privately, control downloads, hide ads and more …

キーボードの切替を いい感じにしたい

キーボードの切替を いい感じにしたい

Ryo Sakaguchi

April 19, 2018
Tweet

More Decks by Ryo Sakaguchi

Other Decks in Programming

Transcript

  1. ©2018 Wantedly, Inc. ΩʔϘʔυͷ੾ସ ద౰ʹ΍Δ৔߹ attachmentButton.setOnClickListener { if (!pickerContainer.isVisible()) {

    val params = window.attributes ImeUtil.hideImeKeyboard(this, editText) pickerContainer.visible() window.attributes = params } else { pickerContainer.gone() ImeUtil.showImeKeyboard(this, editText) } } val attachmentButton = findViewById<ImageView>(R.id.button_plus)
  2. ©2018 Wantedly, Inc. ΩʔϘʔυͷ੾ସ ద౰ʹ΍Δ৔߹ val attachmentButton = findViewById<ImageView>(R.id.button_plus) attachmentButton.setOnClickListener

    { if (!pickerContainer.isVisible()) { val params = window.attributes ImeUtil.hideImeKeyboard(this, editText) pickerContainer.visible() window.attributes = params } else { pickerContainer.gone() ImeUtil.showImeKeyboard(this, editText) } }
  3. ©2018 Wantedly, Inc. ΩʔϘʔυͷ੾ସ ద౰ʹ΍Δ৔߹ val attachmentButton = findViewById<ImageView>(R.id.button_plus) attachmentButton.setOnClickListener

    { if (!pickerContainer.isVisible()) { val params = window.attributes ImeUtil.hideImeKeyboard(this, editText) pickerContainer.visible() window.attributes = params } else { pickerContainer.gone() ImeUtil.showImeKeyboard(this, editText) } } όίϯ/ΨίϯΈ͍ͨͳԻ͕ฉ͖͑ͯͦ͜͏
  4. ©2018 Wantedly, Inc. ͪΐͬͱߟ͑ͯΈͨ .FTTFOHFSΛࢀߟʹ͢Δ ΍ͬͨ͜ͱ w 7JFXߏ଄ͷEVNQͱͬͯΈΔ w BECTIFMMEVNQTZTBDUJWJUZUPQ

    w ͻͨ͢Β੾Γସ͑ͯΈͨ w ΩʔϘʔυͷߴ͞Λۃ୺ʹখ͘͞େ͖ͯ͘͠੾ସࣗମʹͲ͏੍͍ͬͨݶԽͰߦΘΕ͍ͯΔ͔͔֬Ίͨ w ҙ஍ѱʹͳͬͨؾ࣋ͪͰյ͠ʹ͔͔Δ
  5. ©2018 Wantedly, Inc. ͪΐͬͱߟ͑ͯΈͨ .FTTFOHFSΛࢀߟʹ͢Δ Θ͔ͬͨ͜ͱ w 7JFXͷߏ଄ w ಛผͳมΘͬͨ$VTUPN7JFXΛ࢖͍ͬͯΔ༷ࢠ͸ͳ͔ͬͨɻ

    w ͻͨ͢Β੾Γସ͑ͨ w ΩʔϘʔυͷཪʹ7JFX͕͋ΔงғؾΛ௫Μͩ w ͱ͍͏͜ͱ͸ΩʔϘʔυΛӅ͢ʢด͡Δʣࡍʹߴ͕͞มΘΒͳ͚Ε͹ྑ͍ͷͰ͸ʁ w ۃ୺ͳߴ͞ͷ৔߹͸NJONBY)FJHIUΛઃఆ͍ͯ͠Δͷ͔ͿͬյΕΔ͜ͱ͸ͳ͔ͬͨ
  6. ©2018 Wantedly, Inc. ΩʔϘʔυͷ੾ସ ద౰ʹ΍Δ৔߹ val attachmentButton = findViewById<ImageView>(R.id.button_plus) attachmentButton.setOnClickListener

    { if (!pickerContainer.isVisible()) { val params = window.attributes ImeUtil.hideImeKeyboard(this, editText) toAdjustNothing() pickerContainer.visible() window.attributes = params } else { pickerContainer.gone() toAdjustResize() ImeUtil.showImeKeyboard(this, editText) } }
  7. ©2018 Wantedly, Inc. ΩʔϘʔυͷ੾ସ ͪΐͬͱஸೡʹ΍Δ৔߹ val attachmentButton = findViewById<ImageView>(R.id.button_plus) attachmentButton.setOnClickListener

    { if (!pickerContainer.isVisible()) { val params = window.attributes ImeUtil.hideImeKeyboard(this, editText) toAdjustNothing() pickerContainer.visible() window.attributes = params } else { pickerContainer.gone() toAdjustResize() ImeUtil.showImeKeyboard(this, editText) } }
  8. ©2018 Wantedly, Inc. ΩʔϘʔυͷ੾ସ ͪΐͬͱஸೡʹ΍Δ৔߹ val attachmentButton = findViewById<ImageView>(R.id.button_plus) attachmentButton.setOnClickListener

    { if (!pickerContainer.isVisible()) { val params = window.attributes ImeUtil.hideImeKeyboard(this, editText) toAdjustNothing() pickerContainer.visible() window.attributes = params } else { pickerContainer.gone() toAdjustResize() ImeUtil.showImeKeyboard(this, editText) } } ΘΓ͔͠εϜʔζʂ
  9. ©2018 Wantedly, Inc. UP"EKVTU3FTJ[F 4PGU*OQVU.PEF ͦΕͧΕͲ͏͍͏ಈ͖Λ͢Δͷ͔ fun toAdjustResize() { window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)

    } •LayoutManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE •͜Ε͸WindowʹΩʔϘʔυͷग़ݱͷࡍʹɺΩʔϘʔυ͕ද͍ࣔͯ͠Δcontentsʹ͔ͿΒͳ͍Α͏ʹ
 WindowͷResizeΛ͢Δ΋ͷ
  10. ©2018 Wantedly, Inc. UP"EKVTU/PUIJOH 4PGU*OQVU.PEF ͦΕͧΕͲ͏͍͏ಈ͖Λ͢Δͷ͔ fun toAdjustNothing() { window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_Nothing)

    } •LayoutManager.LayoutParams.SOFT_INPUT_ADJUST_Nothing •ΩʔϘʔυͷग़ݱ࣌ʹɺWindowͷߴ͞ௐ੔ͳͲΛ·ͬͨ͘͠ͳ͘ͳΔϞʔυɻ
 ຊ౰ʹԿ΋͠ͳ͍ͷͰɺ௨ৗ࣌ʹ࢖͏ͱcontentsͱ͔Ϳͬͯ͠·͏
  11. ©2018 Wantedly, Inc. UP"EKVTU/PUIJOH %FNP"QQ fun toAdjustNothing() { window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_Nothing) }

    •LayoutManager.LayoutParams.SOFT_INPUT_ADJUST_Nothing •ΩʔϘʔυͷग़ݱ࣌ʹɺWindowͷߴ͞ௐ੔ͳͲΛ·ͬͨ͘͠ͳ͘ͳΔϞʔυɻ
 ຊ౰ʹԿ΋͠ͳ͍ͷͰɺ௨ৗ࣌ʹ࢖͏ͱcontentsͱ͔Ϳͬͯ͠·͏