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
150
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
760
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
2.9k
kotlin-mpp-library-tips
uzzu
1
6.5k
Coroutine Kyuin
uzzu
2
340
Other Decks in Technology
See All in Technology
エンジニアリング戦略の作り方 / Crafting Engineering Strategy
iwashi86
21
7k
小さく始める AI 活用推進 ― 日経電子版 Web チームの事例/nikkei-tech-talk47
nikkei_engineer_recruiting
0
270
AIエージェントが名古屋の猛暑からあなたを守る
happysamurai294
0
130
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
250
【Cyber-sec+】経営層を"動かす"ための考え方
hssh2_bin
0
190
Kubernetesにおける学習基盤とLLMOpsの概要
ry
1
310
失敗を資産に変えるClaude Code
shinyasaita
0
680
【セミナー資料】Claude Code をセキュアに使うための考え方と設定の勘どころ / Claude Code Webinar 20260616
masahirokawahara
2
370
不要なレビューをAIにまかせて AIコーディングの環境改善を加速した
shoota
1
180
Kiroで書いた 設計書 が AI レビューの 採点基準 になる
ezaki
0
120
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.1k
200個のGitHubリポジトリを横断調査したかった
icck
0
130
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
The Cult of Friendly URLs
andyhume
79
6.9k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
160
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Producing Creativity
orderedlist
PRO
348
40k
Building an army of robots
kneath
306
46k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
180
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
430
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
160
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