Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
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.7k
Other Decks in Technology
See All in Technology
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
280
Deep Data Security 機能解説
oracle4engineer
PRO
2
170
サイバーエージェントにおけるAI推進戦略と変革への取り組み
shotatsuge
0
570
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
130
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
210
元・セキュリティ学習経験0大学生による業務紹介 / An Introduction to the Job by a Former College Student with Zero Security Training Experience
nttcom
0
300
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
フィジカル版Github Onshapeの紹介
shiba_8ro
0
330
元銀行員がAIだけでアプリを量産!「バイブコーディング実演セミナー 」
tatsuya1970
0
110
【2026年版】 ベクトル検索とEmbedding最前線
mocobeta
24
7.6k
Zenoh on Zephyr on LiteX
takasehideki
2
110
[チョークトーク資料]AWS DevOps Agent を使いこなす / AWS Dev Ops Agent Chalk Talk AWS Summit Japan 2026
kinunori
4
770
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
15k
Building Adaptive Systems
keathley
44
3.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
400
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
200
Documentation Writing (for coders)
carmenintech
77
5.4k
My Coaching Mixtape
mlcsv
0
150
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
780
WENDY [Excerpt]
tessaabrams
11
38k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Design in an AI World
tapps
1
250
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
740
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をやりとりするだけなので、 入力側は既存の画像選択機能が利用できるかも • 今後、画像入力が増えることを期待