|
1 | 1 | package io.flutter.embedding.engine.systemchannels;
|
2 | 2 |
|
3 | 3 | import android.view.inputmethod.EditorInfo;
|
| 4 | +import android.view.View; |
4 | 5 | import androidx.annotation.NonNull;
|
5 | 6 | import androidx.annotation.Nullable;
|
6 |
| -import androidx.autofill.HintConstants; |
7 | 7 | import io.flutter.Log;
|
8 | 8 | import io.flutter.embedding.engine.dart.DartExecutor;
|
9 | 9 | import io.flutter.plugin.common.JSONMethodCodec;
|
@@ -134,7 +134,7 @@ public void requestExistingInputState() {
|
134 | 134 | channel.invokeMethod("TextInputClient.requestExistingInputState", null);
|
135 | 135 | }
|
136 | 136 |
|
137 |
| - private HashMap<Object, Object> createEditingStateJSON( |
| 137 | + private static HashMap<Object, Object> createEditingStateJSON( |
138 | 138 | String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) {
|
139 | 139 | HashMap<Object, Object> state = new HashMap<>();
|
140 | 140 | state.put("text", text);
|
@@ -316,10 +316,10 @@ public static Configuration fromJson(@NonNull JSONObject json)
|
316 | 316 | }
|
317 | 317 | Configuration[] fields = null;
|
318 | 318 | if (!json.isNull("fields")) {
|
319 |
| - final JSONArray fields = json.getJSONArray("fields"); |
320 |
| - fields = new Configuration[fields.length()]; |
| 319 | + final JSONArray jsonFields = json.getJSONArray("fields"); |
| 320 | + fields = new Configuration[jsonFields.length()]; |
321 | 321 | for (int i = 0; i < fields.length; i++) {
|
322 |
| - fields[i] = Configuration.fromJson(fields.getJSONObject(i)); |
| 322 | + fields[i] = Configuration.fromJson(jsonFields.getJSONObject(i)); |
323 | 323 | }
|
324 | 324 | }
|
325 | 325 | final Integer inputAction = inputActionFromTextInputAction(inputActionName);
|
@@ -384,77 +384,77 @@ public static Autofill fromJson(@NonNull JSONObject json)
|
384 | 384 | private static String translateAutofillHint(@NonNull String hint) {
|
385 | 385 | switch (hint) {
|
386 | 386 | case "addressCity":
|
387 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_LOCALITY; |
| 387 | + return "addressLocality"; |
388 | 388 | case "addressState":
|
389 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_REGION; |
| 389 | + return "addressRegion"; |
390 | 390 | case "birthday":
|
391 |
| - return HintConstants.AUTOFILL_HINT_BIRTH_DATE_FULL; |
| 391 | + return "birthDateFull"; |
392 | 392 | case "birthdayDay":
|
393 |
| - return HintConstants.AUTOFILL_HINT_BIRTH_DATE_DAY; |
| 393 | + return "birthDateDay"; |
394 | 394 | case "birthdayMonth":
|
395 |
| - return HintConstants.AUTOFILL_HINT_BIRTH_DATE_MONTH; |
| 395 | + return "birthDateMonth"; |
396 | 396 | case "birthdayYear":
|
397 |
| - return HintConstants.AUTOFILL_HINT_BIRTH_DATE_YEAR; |
| 397 | + return "birthDateYear"; |
398 | 398 | case "countryName":
|
399 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_COUNTRY; |
| 399 | + return "addressCountry"; |
400 | 400 | case "creditCardExpirationDate":
|
401 |
| - return HintConstants.AUTOFILL_HINT_CREDIT_CARD_NUMBER; |
| 401 | + return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE; |
402 | 402 | case "creditCardExpirationDay":
|
403 |
| - return HintConstants.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY; |
| 403 | + return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY; |
404 | 404 | case "creditCardExpirationMonth":
|
405 |
| - return HintConstants.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH; |
| 405 | + return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH; |
406 | 406 | case "creditCardExpirationYear":
|
407 |
| - return HintConstants.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR; |
| 407 | + return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR; |
408 | 408 | case "creditCardNumber":
|
409 |
| - return HintConstants.AUTOFILL_HINT_CREDIT_CARD_NUMBER; |
| 409 | + return View.AUTOFILL_HINT_CREDIT_CARD_NUMBER; |
410 | 410 | case "creditCardSecurityCode":
|
411 |
| - return HintConstants.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE; |
| 411 | + return View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE; |
412 | 412 | case "email":
|
413 |
| - return HintConstants.AUTOFILL_HINT_EMAIL_ADDRESS; |
| 413 | + return View.AUTOFILL_HINT_EMAIL_ADDRESS; |
414 | 414 | case "familyName":
|
415 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME_FAMILY; |
| 415 | + return "personFamilyName"; |
416 | 416 | case "fullStreetAddress":
|
417 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_STREET_ADDRESS; |
| 417 | + return "streetAddress"; |
418 | 418 | case "gender":
|
419 |
| - return HintConstants.AUTOFILL_HINT_GENDER; |
| 419 | + return "gender"; |
420 | 420 | case "givenName":
|
421 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME_GIVEN; |
| 421 | + return "personGivenName"; |
422 | 422 | case "middleInitial":
|
423 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME_MIDDLE_INITIAL; |
| 423 | + return "personMiddleInitial"; |
424 | 424 | case "middleName":
|
425 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME_MIDDLE; |
| 425 | + return "personMiddleName"; |
426 | 426 | case "name":
|
427 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME; |
| 427 | + return "personName"; |
428 | 428 | case "namePrefix":
|
429 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME_PREFIX; |
| 429 | + return "personNamePrefix"; |
430 | 430 | case "nameSuffix":
|
431 |
| - return HintConstants.AUTOFILL_HINT_PERSON_NAME_SUFFIX; |
| 431 | + return "personNameSuffix"; |
432 | 432 | case "newPassword":
|
433 |
| - return HintConstants.AUTOFILL_HINT_NEW_PASSWORD; |
| 433 | + return "newPassword"; |
434 | 434 | case "newUsername":
|
435 |
| - return HintConstants.AUTOFILL_HINT_NEW_USERNAME; |
| 435 | + return "newUsername"; |
436 | 436 | case "oneTimeCode":
|
437 |
| - return HintConstants.AUTOFILL_HINT_SMS_OTP; |
| 437 | + return "smsOTPCode"; |
438 | 438 | case "password":
|
439 |
| - return HintConstants.AUTOFILL_HINT_PASSWORD; |
| 439 | + return View.AUTOFILL_HINT_PASSWORD; |
440 | 440 | case "postalAddress":
|
441 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS; |
| 441 | + return View.AUTOFILL_HINT_POSTAL_ADDRESS; |
442 | 442 | case "postalAddressExtended":
|
443 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_ADDRESS; |
| 443 | + return "extendedAddress"; |
444 | 444 | case "postalAddressExtendedPostalCode":
|
445 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_POSTAL_CODE; |
| 445 | + return "extendedPostalCode"; |
446 | 446 | case "postalCode":
|
447 |
| - return HintConstants.AUTOFILL_HINT_POSTAL_CODE; |
| 447 | + return View.AUTOFILL_HINT_POSTAL_CODE; |
448 | 448 | case "telephoneNumber":
|
449 |
| - return HintConstants.AUTOFILL_HINT_PHONE_NUMBER; |
| 449 | + return "phoneNumber"; |
450 | 450 | case "telephoneNumberCountryCode":
|
451 |
| - return HintConstants.AUTOFILL_HINT_PHONE_COUNTRY_CODE; |
| 451 | + return "phoneCountryCode"; |
452 | 452 | case "telephoneNumberDevice":
|
453 |
| - return HintConstants.AUTOFILL_HINT_PHONE_NUMBER_DEVICE; |
| 453 | + return "phoneNumberDevice"; |
454 | 454 | case "telephoneNumberNational":
|
455 |
| - return HintConstants.AUTOFILL_HINT_PHONE_NATIONAL; |
| 455 | + return "phoneNational"; |
456 | 456 | case "username":
|
457 |
| - return HintConstants.AUTOFILL_HINT_NEW_USERNAME; |
| 457 | + return View.AUTOFILL_HINT_USERNAME; |
458 | 458 | default:
|
459 | 459 | return hint;
|
460 | 460 | }
|
|
0 commit comments