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
從觀望到全公司落地:AI Agentic Coding 導入實戰 — 流程整合與安全治理
appleboy
1
750
5分でわかる Amazon Connect_20260608
hwangbyeonghun
0
180
プライバシー保護の理論と実践
lycorptech_jp
PRO
1
240
そのタスクオンスケですか?
poropinai1966
0
130
組織における AI-DLC 実践
askul
0
300
依頼文化をやめる日 EM視点で語るPlatform EngineeringとInclusive SRE / Discussing Platform Engineering and Inclusive SRE from an EM's Perspective
shin1988
2
480
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
0
160
Mastraエージェント、どのクラウドにデプロイする?
minorun365
PRO
2
150
グローバルチームと挑むプロダクト開発
sansantech
PRO
1
150
記録をかんたんに、提案をパーソナルに ── AIであすけんが目指すもの
oprstchn
0
140
AI駆動開発におけるQAエンジニアの役割事例 〜AI駆動開発の現場から〜
kobayashiyorimitsu
0
300
Amazon EVS で VCF 9.0 / 9.1 のサポート開始まとめ
mtoyoda
0
190
Featured
See All Featured
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
270
The Cost Of JavaScript in 2023
addyosmani
55
10k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Designing Powerful Visuals for Engaging Learning
tmiket
1
440
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
180
Claude Code のすすめ
schroneko
67
230k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
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