Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 404cffa

Browse files
review
1 parent 10a7a2b commit 404cffa

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package io.flutter.embedding.engine.systemchannels;
22

33
import android.view.inputmethod.EditorInfo;
4+
import android.view.View;
45
import androidx.annotation.NonNull;
56
import androidx.annotation.Nullable;
6-
import androidx.autofill.HintConstants;
77
import io.flutter.Log;
88
import io.flutter.embedding.engine.dart.DartExecutor;
99
import io.flutter.plugin.common.JSONMethodCodec;
@@ -134,7 +134,7 @@ public void requestExistingInputState() {
134134
channel.invokeMethod("TextInputClient.requestExistingInputState", null);
135135
}
136136

137-
private HashMap<Object, Object> createEditingStateJSON(
137+
private static HashMap<Object, Object> createEditingStateJSON(
138138
String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) {
139139
HashMap<Object, Object> state = new HashMap<>();
140140
state.put("text", text);
@@ -316,10 +316,10 @@ public static Configuration fromJson(@NonNull JSONObject json)
316316
}
317317
Configuration[] fields = null;
318318
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()];
321321
for (int i = 0; i < fields.length; i++) {
322-
fields[i] = Configuration.fromJson(fields.getJSONObject(i));
322+
fields[i] = Configuration.fromJson(jsonFields.getJSONObject(i));
323323
}
324324
}
325325
final Integer inputAction = inputActionFromTextInputAction(inputActionName);
@@ -384,77 +384,77 @@ public static Autofill fromJson(@NonNull JSONObject json)
384384
private static String translateAutofillHint(@NonNull String hint) {
385385
switch (hint) {
386386
case "addressCity":
387-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_LOCALITY;
387+
return "addressLocality";
388388
case "addressState":
389-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_REGION;
389+
return "addressRegion";
390390
case "birthday":
391-
return HintConstants.AUTOFILL_HINT_BIRTH_DATE_FULL;
391+
return "birthDateFull";
392392
case "birthdayDay":
393-
return HintConstants.AUTOFILL_HINT_BIRTH_DATE_DAY;
393+
return "birthDateDay";
394394
case "birthdayMonth":
395-
return HintConstants.AUTOFILL_HINT_BIRTH_DATE_MONTH;
395+
return "birthDateMonth";
396396
case "birthdayYear":
397-
return HintConstants.AUTOFILL_HINT_BIRTH_DATE_YEAR;
397+
return "birthDateYear";
398398
case "countryName":
399-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_COUNTRY;
399+
return "addressCountry";
400400
case "creditCardExpirationDate":
401-
return HintConstants.AUTOFILL_HINT_CREDIT_CARD_NUMBER;
401+
return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE;
402402
case "creditCardExpirationDay":
403-
return HintConstants.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY;
403+
return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY;
404404
case "creditCardExpirationMonth":
405-
return HintConstants.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH;
405+
return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH;
406406
case "creditCardExpirationYear":
407-
return HintConstants.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR;
407+
return View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR;
408408
case "creditCardNumber":
409-
return HintConstants.AUTOFILL_HINT_CREDIT_CARD_NUMBER;
409+
return View.AUTOFILL_HINT_CREDIT_CARD_NUMBER;
410410
case "creditCardSecurityCode":
411-
return HintConstants.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE;
411+
return View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE;
412412
case "email":
413-
return HintConstants.AUTOFILL_HINT_EMAIL_ADDRESS;
413+
return View.AUTOFILL_HINT_EMAIL_ADDRESS;
414414
case "familyName":
415-
return HintConstants.AUTOFILL_HINT_PERSON_NAME_FAMILY;
415+
return "personFamilyName";
416416
case "fullStreetAddress":
417-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_STREET_ADDRESS;
417+
return "streetAddress";
418418
case "gender":
419-
return HintConstants.AUTOFILL_HINT_GENDER;
419+
return "gender";
420420
case "givenName":
421-
return HintConstants.AUTOFILL_HINT_PERSON_NAME_GIVEN;
421+
return "personGivenName";
422422
case "middleInitial":
423-
return HintConstants.AUTOFILL_HINT_PERSON_NAME_MIDDLE_INITIAL;
423+
return "personMiddleInitial";
424424
case "middleName":
425-
return HintConstants.AUTOFILL_HINT_PERSON_NAME_MIDDLE;
425+
return "personMiddleName";
426426
case "name":
427-
return HintConstants.AUTOFILL_HINT_PERSON_NAME;
427+
return "personName";
428428
case "namePrefix":
429-
return HintConstants.AUTOFILL_HINT_PERSON_NAME_PREFIX;
429+
return "personNamePrefix";
430430
case "nameSuffix":
431-
return HintConstants.AUTOFILL_HINT_PERSON_NAME_SUFFIX;
431+
return "personNameSuffix";
432432
case "newPassword":
433-
return HintConstants.AUTOFILL_HINT_NEW_PASSWORD;
433+
return "newPassword";
434434
case "newUsername":
435-
return HintConstants.AUTOFILL_HINT_NEW_USERNAME;
435+
return "newUsername";
436436
case "oneTimeCode":
437-
return HintConstants.AUTOFILL_HINT_SMS_OTP;
437+
return "smsOTPCode";
438438
case "password":
439-
return HintConstants.AUTOFILL_HINT_PASSWORD;
439+
return View.AUTOFILL_HINT_PASSWORD;
440440
case "postalAddress":
441-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS;
441+
return View.AUTOFILL_HINT_POSTAL_ADDRESS;
442442
case "postalAddressExtended":
443-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_ADDRESS;
443+
return "extendedAddress";
444444
case "postalAddressExtendedPostalCode":
445-
return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_EXTENDED_POSTAL_CODE;
445+
return "extendedPostalCode";
446446
case "postalCode":
447-
return HintConstants.AUTOFILL_HINT_POSTAL_CODE;
447+
return View.AUTOFILL_HINT_POSTAL_CODE;
448448
case "telephoneNumber":
449-
return HintConstants.AUTOFILL_HINT_PHONE_NUMBER;
449+
return "phoneNumber";
450450
case "telephoneNumberCountryCode":
451-
return HintConstants.AUTOFILL_HINT_PHONE_COUNTRY_CODE;
451+
return "phoneCountryCode";
452452
case "telephoneNumberDevice":
453-
return HintConstants.AUTOFILL_HINT_PHONE_NUMBER_DEVICE;
453+
return "phoneNumberDevice";
454454
case "telephoneNumberNational":
455-
return HintConstants.AUTOFILL_HINT_PHONE_NATIONAL;
455+
return "phoneNational";
456456
case "username":
457-
return HintConstants.AUTOFILL_HINT_NEW_USERNAME;
457+
return View.AUTOFILL_HINT_USERNAME;
458458
default:
459459
return hint;
460460
}

0 commit comments

Comments
 (0)