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
Autofill Framework
Search
uzzu
December 17, 2020
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Autofill Framework
第2回Android知見共有会 @cookpad
uzzu
December 17, 2020
More Decks by uzzu
See All by uzzu
Context Receiversに思いを馳せる / Context Receivers
uzzu
0
770
StoreKitのこれまでとこれから / StoreKit 2 from 1
uzzu
5
21k
アプリ内課金の最新事情 クライアントサイド編 / In-app Purchase in Cookpad 2019
uzzu
3
4.7k
Billing Client 2.0 acknowledgement
uzzu
0
17k
Promoting IAP対応から学ぶ外部アプリ内課金実装 / Promoting IAP and others
uzzu
2
1.6k
ブログ作り直した / My blog @ Othlo Tech
uzzu
0
220
新規アプリ開発を支えるユーザ・決済基盤
uzzu
2
3k
kotlin-mpp-library-tips
uzzu
1
6.5k
Coroutine Kyuin
uzzu
2
340
Other Decks in Technology
See All in Technology
RAGの精度向上とエージェント活用
kintotechdev
2
130
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
8k
デジタル・デザイン構想 by Sayaka Ishizuka
y150saya
0
190
AWS Summit 2026で見えたSIerにとっての Amazon Quickの位置づけ
maf_0521
0
160
5分でわかるDuckDB Quack
chanyou0311
4
310
#エンジニアBooks 30分でわかる 「技術記事を書く技術」 / engineer-books 2026-06-30
jnchito
1
180
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
1
1.2k
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
360
Claude Codeとハーネスについて考えてみる
oikon48
17
8k
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
350
組織における AI-DLC 実践
askul
0
300
【FinOps】データドリブンな意思決定を目指して
z63d
3
600
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
The SEO identity crisis: Don't let AI make you average
varn
0
510
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
From π to Pie charts
rasagy
0
230
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
450
The SEO Collaboration Effect
kristinabergwall1
1
500
AI: The stuff that nobody shows you
jnunemaker
PRO
8
760
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Transcript
Autofill framework uzzu @ user-payment dept
Agenda ɾAutofill frameworkͬͯԿ ɾಋೖํ๏ ɾͲΜͳײ͡Ͱಈ͔͢ͷ ɾ·ͱΊ
Autofill framework ɾΞϓϦͰҎԼͷೖྗใΛࣗಈೖྗ͢Δࣄ͕Ͱ͖ΔΈ ɹΞΧϯτೝূใɺΫϨδοτΧʔυใɺॅॴɺਓ໊ɺి൪߸ɺ ɹϫϯλΠϜύεϫʔυ ɾAutofill ServiceʹରԠͨ͠ύεϫʔυϚωʔδϟʔͱ࿈ܞͯ͠ೖྗใΛอଘ͢Δࣄ ɹͰ͖Δ (ࠓճলུ) ɹ৽͍͠ύεϫʔυΛύεϫʔυϚωʔδϟͰੜ্ͨ͠Ͱࣗಈೖྗ͢ΔͳͲ
ɾWeb͚ʹDigital Asset LinksΛ༻ҙ͢Δ͜ͱͰWebͷಉαʔϏεͷೝূใΛ ɹΞϓϦͰར༻Ͱ͖Δ ɾminSdkVersion >= 26 (※)
None
͍ํ(1) - ઃఆ • ઃఆ>γεςϜ>ݴޠͱೖྗ>ৄࡉઃఆ>ೖྗΞγελϯ τ>ࣗಈೖྗαʔϏε ͔ΒࣗಈೖྗαʔϏεΛ༗ޮʹ͢ Δ ↑ΤϛϡϨʔλͰಈ࡞֬ೝ͢Δ߹ཁ֬ೝ •
্ͰGoogleΞΧϯτͰϩάΠϯ͓ͯ͘͠ͷΕ ͳ͍
͍ํ(2) - Autofill༗ޮແޮͷ֬ೝ fun Context.isAutofillAvailable(): Boolean { if (Build.VERSION.SDK_INT <
Build.VERSION_CODES.O) { return false } val manager = getSystemService(AutofillManager::class.java) return manager != null && manager.isEnabled }
͍ํ(3) - ࣗಈೖྗͷͨΊͷHintͷઃఆ • ࢦఆจࣈྻ View.AUTOFILL_HINT_* ͳఆ͕ٛ͋ΔͷͰͦͪΒΛࢀߟʹ • ෳ༩͑ΔࣄͰ͖Δ •
ࣗલͷViewʹHintsΛઃఆ͢Δ߹ View#setAutofillHints(vararg String) • ٯʹɺೖྗิͨ͘͠ͳ͍߹ android:importantForAutofill=“no” “auto”, “no”, “yes”, “noExcludedDescendants”, “yesExcludeDescendants” <EditText android:id="@+id/password_field" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPassword" android:autofillHints="password" />
͍ํ(4) - ࣗಈೖྗͨ͠༰ͷऔಘ • EditText#getText() ͳͲɺݩͷViewͷ࣮ʹ߹ΘͤͯऔಘɺͰجຊతʹOK • View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE ͷ߹ɺೖྗ༰ͷᐆດ ͞ʹҙ
(06/2022, 6/2022, June 2022, …) ->EditTextͳΓΛܧঝͯ͠AutofillValueΛ༻͍ΔࣄͰᐆດ͞Λճආ͢Δ
override fun getAutofillType(): Int { return AUTOFILL_TYPE_DATE } override fun
getAutofillValue(): AutofillValue { val calendar = Calendar.getInstance() calendar.clear() val (year, month) = sanitize(text?.toString()) calendar.set(Calendar.YEAR, year) calendar.set(Calendar.MONTH, month) val unixTime: Long = calendar.timeInMillis return AutofillValue.forDate(unixTime) } override fun autofill(value: AutofillValue) { if (!value.isDate) { return } val calendar = Calendar.getInstance() calendar.timeInMillis = value.dateValue setText(DateFormat.format("MM/yy", calendar)) }
͍ํ(5) - ͋ͱAdvanced ɾࣗಈೖྗΛ࣮ࢪ͠ͳ͍߹AutofillManager#cancel ɾActivity1ͭʹର͠ෳͷFragmentͰը໘ભҠ͠ͳ͕Βೖ ྗ͢Δ߹ɺ࠷ޙʹ AutoFillManager#commit ͢Δ
طͷ(1) - DialogͰͷར༻ • API Level 27ҎલͰDialogͷϏϡʔΛදࣔޙʹαΠ ζมߋΛ͢ΔͱࣗಈೖྗͷରͱΈͳ͞Εͳ͘ͳΔ
طͷ(1) - ճආࡦ • window token ΛৼΓ͢ class Dialog(context: Context)
: Dialog(context) { private var token: IBinder? = null override fun onWindowAttributesChanged(params: WindowManager.LayoutParams) { if (params.token == null && token != null) { params.token = token } super.onWindowAttributesChanged(params) } override fun onAttachedToWindow() { if (context.isDialogResizedWorkAroundRequired() /* API 26ͩͬͨΒ */) { token = requireNotNull(ownerActivity).window.attributes.token } super.onAttachedToWindow() } }
طͷ(2) - RecyclerViewͰͷར༻ • RecyclerViewͰͷར༻࣌ʹҙਤͤ͵ೖྗϑΟʔϧυʹ ࣗಈೖྗ͞Εͯ͠·͏ (View͕࠶ར༻͞ΕΔࣄ͕͋Δͷ͔ͩΒͳΜͱͳ͘ ؾ͔࣋ͪΔ…)
طͷ(2) - ղܾࡦ (minSdkVersion >= 28) • AutofillManager͕IdΛ࠾൪͍ͯ͠ΔͷͰɺ֤ΞΠςϜʹIdΛ࠾൪͢Δ data class
Item( val text: String, // Viewදࣔͷҝͷͳʹ͔ // : val autofillId: Int // Autofill framework༻ͷId ΛՃ ) // RecyclerViewʹՃ͢Δཁૉʹ1ͭͣͭ࠾൪ val autofillId = autofillManager.nextAutofillId • ͦͷޙonBindViewHolderͰViewHolder্Ͱ͍࣋ͬͯΔTextViewʹ View#setAutofillId(autofillId) ͢Δ
·ͱΊ • ϑΟʔϧυʹೖྗ͢Δ࣌ؒΛݮͨ͠ΓɺೖྗϛεΛ࠷খݶʹ͑Δࣄ͕Ͱ͖Δ • Autofill ServiceʹରԠͨ͠ύεϫʔυϚωʔδϟʔͱ࿈ܞͯ͠ೖྗใΛอଘͰ͖Δ • ΣϒαΠτͱͷؔ࿈͚Ͱ AndroidΞϓϦͰͷϩάΠϯ࣌ʹ WebͰͷϩάΠϯใΛࣗಈೖྗͰ͖Δ
• minSdkVersion >=26 Ͱ͋Δ͕ɺطͷʹखؒগͳ͘ରॲ͢ΔͳΒ minSdkVersion >= 28 • androidx.autofill Ͱ͏গ͠Ճػೳ͕͑Δ (ιϑτΣΞΩʔϘʔυɺOTPपΓͷαϙʔτ͕खް͍)͕ ݱࡏ1.1.0-rc01 minSdkVersion >= 30