Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Image Keyboardをいらすとやで作ってみた
Search
Naoto Nakazato
February 02, 2017
Technology
770
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Image Keyboardをいらすとやで作ってみた
Image Keyboardをいらすとやで作ってみた
http://qiita.com/oxsoft/items/4a10fafee7f31d0ccbdb
Naoto Nakazato
February 02, 2017
More Decks by Naoto Nakazato
See All by Naoto Nakazato
RxJavaを1年使って見えてきたこと
oxsoft
1
2.8k
Other Decks in Technology
See All in Technology
Sigmaで作る業務アプリ
kazushiro_honma
0
110
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
570
Tab5をRubyで動くパソコンにする
kishima
2
280
2026-09-09 【sigma_ucj#1】Sigma を IaC 管理したい! / IaC for Sigma
civitaspo
0
110
module Synths; end
asonas
1
130
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
120
多摩川(.dev)ランニング入門 / Tamagawa.dev#3
fujiwara3
3
450
GoCon2026 - Open Source, Open World
sanposhiho
2
3.1k
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
3
950
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
280
AIオーケストレーションを活用した 開発ワークフローの設計と実践
bqnq
0
130
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
150
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Being A Developer After 40
akosma
91
590k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
Embracing the Ebb and Flow
colly
88
5.2k
Become a Pro
speakerdeck
PRO
31
6.2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
890
Transcript
Image Keyboardを いらすとやで作ってみた @oxsoft
自己紹介 • Naoto Nakazato • Yahoo Japan Corporation • Yahoo!知恵袋
• アカウント ◦ Twitter: @oxsoft ◦ Facebook: naoto.nakazato ◦ GitHub: oxsoft ◦ Qiita: oxsoft ◦ 今回のQiita記事: http://qiita.com/oxsoft/items/4a10fafee7f31d0ccbdb
Image Keyboard Supportしてますか? • キーボードから画像が入力できるようになる機能 • Android 7.1の新機能として App Shortcutsとともに紹介されることが多い
• でも実はサポートライブラリを入れれば使える dependencies { // ... compile 'com.android.support:support-v13:25.1.0' }
Image Keyboard Support • 実はGboardはGIFアニメが入力できる • AlloはImage Keyboardに対応している • FB
Messengerも対応している? • これからスタンプ的な感じで流行りそう
いらすとやで作ってみる https://github.com/oxsoft/Irasutoya
キーボードServiceの作成 public class MainService extends InputMethodService { @Override public View
onCreateInputView() { View inputView = getLayoutInflater().inflate(R.layout.view_keyboard, null); // inputViewの設定 return inputView; } @Override public void onStartInputView(EditorInfo editorInfo, boolean restarting) { // 入力欄に応じた処理 } }
入力欄がサポートしているかチェック @Override public void onStartInputView(EditorInfo editorInfo, boolean restarting) { String[]
mimeTypes = EditorInfoCompat.getContentMimeTypes(editorInfo); boolean pngSupported = false; for (String mimeType : mimeTypes) { if (ClipDescription.compareMimeTypes(mimeType, "image/png")) { pngSupported = true; } } // サポートしていない場合はその旨を表示 unsupported.setVisibility(pngSupported ? View.GONE : View.VISIBLE); }
ContentProviderを用意(FileProviderを使う) <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.sample.content" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider> File file = getFileStreamPath("画像のファイル名"); Uri uri = FileProvider.getUriForFile(this, "com.sample.content", file); AndroidManifest.xml 保存した画像のURIを取得
画像のuriを入力欄に送信 private void commitPngImage(Uri contentUri, String imageDescription, Uri linkUri) {
InputContentInfoCompat inputContentInfo = new InputContentInfoCompat(contentUri, new ClipDescription(imageDescription, new String[]{"image/png"}), linkUri); InputConnection inputConnection = getCurrentInputConnection(); EditorInfo editorInfo = getCurrentInputEditorInfo(); int flags = 0; if (android.os.Build.VERSION.SDK_INT >= 25) { flags |= InputConnectionCompat.INPUT_CONTENT_GRANT_READ_URI_PERMISSION; } InputConnectionCompat.commitContent(inputConnection, editorInfo, inputContentInfo, flags, null); }
まとめ • 意外と簡単に作れた • Uriをやりとりするだけなので、 入力側は既存の画像選択機能が利用できるかも • 今後、画像入力が増えることを期待