CustomDescription.Builder.BatchUpdate(IValidator, BatchUpdates) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
一連のリモート ビュー操作を適用して、条件が満たされたときにプレゼンテーション テンプレートを更新します。
[Android.Runtime.Register("batchUpdate", "(Landroid/service/autofill/Validator;Landroid/service/autofill/BatchUpdates;)Landroid/service/autofill/CustomDescription$Builder;", "GetBatchUpdate_Landroid_service_autofill_Validator_Landroid_service_autofill_BatchUpdates_Handler", ApiSince=28)]
public virtual Android.Service.Autofill.CustomDescription.Builder BatchUpdate(Android.Service.Autofill.IValidator condition, Android.Service.Autofill.BatchUpdates updates);
[<Android.Runtime.Register("batchUpdate", "(Landroid/service/autofill/Validator;Landroid/service/autofill/BatchUpdates;)Landroid/service/autofill/CustomDescription$Builder;", "GetBatchUpdate_Landroid_service_autofill_Validator_Landroid_service_autofill_BatchUpdates_Handler", ApiSince=28)>]
abstract member BatchUpdate : Android.Service.Autofill.IValidator * Android.Service.Autofill.BatchUpdates -> Android.Service.Autofill.CustomDescription.Builder
override this.BatchUpdate : Android.Service.Autofill.IValidator * Android.Service.Autofill.BatchUpdates -> Android.Service.Autofill.CustomDescription.Builder
パラメーター
- condition
- IValidator
更新をトリガーするために使用される条件。 この値は null にすることはできません。
- updates
- BatchUpdates
条件が満たされたときにテンプレート プレゼンテーションに適用されるアクション。 この値は null にすることはできません。
返品
このビルダー。 この値は null にすることはできません。
- 属性
注釈
一連のリモート ビュー操作を適用して、条件が満たされたときにプレゼンテーション テンプレートを更新します。 これにより、自動入力サービスによって制御される保存 UI の部分を動的にカスタマイズできます。 このような動的カスタマイズは、ターゲット ビューの内容に基づいています。
変換が子ビューに適用された後、更新は追加された順序で適用されます。
RemoteViews template = new RemoteViews(pgkName, R.layout.my_full_template);
Pattern notEmptyPattern = Pattern.compile(".+");
Validator hasAddress = new RegexValidator(addressAutofillId, notEmptyPattern);
Validator hasCcNumber = new RegexValidator(ccNumberAutofillId, notEmptyPattern);
RemoteViews addressUpdates = new RemoteViews(pgkName, R.layout.my_full_template)
addressUpdates.setViewVisibility(R.id.address, View.VISIBLE);
// Make address visible
BatchUpdates addressBatchUpdates = new BatchUpdates.Builder()
.updateTemplate(addressUpdates)
.build();
RemoteViews ccUpdates = new RemoteViews(pgkName, R.layout.my_full_template)
ccUpdates.setViewVisibility(R.id.cc_number, View.VISIBLE);
// Mask credit card number (as .....LAST_4_DIGITS) and make it visible
BatchUpdates ccBatchUpdates = new BatchUpdates.Builder()
.updateTemplate(ccUpdates)
.transformChild(R.id.templateCcNumber, new CharSequenceTransformation
.Builder(ccNumberId, Pattern.compile("^.*(\\d\\d\\d\\d)$"), "...$1")
.build())
.build();
CustomDescription customDescription = new CustomDescription.Builder(template)
.batchUpdate(hasAddress, addressBatchUpdates)
.batchUpdate(hasCcNumber, ccBatchUpdates)
.build();
もう 1 つの方法は、最初に子を追加してから、変換を適用することです。
RemoteViews template = new RemoteViews(pgkName, R.layout.my_base_template);
RemoteViews addressPresentation = new RemoteViews(pgkName, R.layout.address)
RemoteViews addressUpdates = new RemoteViews(pgkName, R.layout.my_template)
addressUpdates.addView(R.id.parentId, addressPresentation);
BatchUpdates addressBatchUpdates = new BatchUpdates.Builder()
.updateTemplate(addressUpdates)
.build();
RemoteViews ccPresentation = new RemoteViews(pgkName, R.layout.cc)
RemoteViews ccUpdates = new RemoteViews(pgkName, R.layout.my_template)
ccUpdates.addView(R.id.parentId, ccPresentation);
BatchUpdates ccBatchUpdates = new BatchUpdates.Builder()
.updateTemplate(ccUpdates)
.transformChild(R.id.templateCcNumber, new CharSequenceTransformation
.Builder(ccNumberId, Pattern.compile("^.*(\\d\\d\\d\\d)$"), "...$1")
.build())
.build();
CustomDescription customDescription = new CustomDescription.Builder(template)
.batchUpdate(hasAddress, addressBatchUpdates)
.batchUpdate(hasCcNumber, ccBatchUpdates)
.build();
android.service.autofill.CustomDescription.Builder.batchUpdateの Android リファレンス。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。