CustomDescription.Builder.BatchUpdate(IValidator, BatchUpdates) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Aggiorna il modello di presentazione quando una condizione viene soddisfatta applicando una serie di operazioni di visualizzazione remota.
[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
Parametri
- condition
- IValidator
condizione utilizzata per attivare gli aggiornamenti. Questo valore non può essere Null.
- updates
- BatchUpdates
azioni da applicare alla presentazione del modello quando la condizione viene soddisfatta. Questo valore non può essere Null.
Valori restituiti
questo generatore. Questo valore non può essere Null.
- Attributi
Commenti
Aggiorna il modello di presentazione quando una condizione viene soddisfatta applicando una serie di operazioni di visualizzazione remota. Ciò consente la personalizzazione dinamica della parte dell'interfaccia utente di salvataggio controllata dal servizio di riempimento automatico. Tale personalizzazione dinamica si basa sul contenuto delle visualizzazioni di destinazione.
Gli aggiornamenti vengono applicati nella sequenza in cui vengono aggiunti, dopo l'applicazione delle trasformazioni alle visualizzazioni figlio.
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();
Un altro approccio consiste nell'aggiungere prima un elemento figlio, quindi applicare le trasformazioni.
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();
Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dalla e usati in base ai termini descritti in Creative License 2.5 Attribution License.