Conversation
ab92aa4 to
a1967fd
Compare
d5d906a to
7197492
Compare
|
Hi @blasten could you take a look at this? I'm trying to add |
| private static String translateAutofillHint(@NonNull String hint) { | ||
| switch (hint) { | ||
| case "addressCity": | ||
| return HintConstants.AUTOFILL_HINT_POSTAL_ADDRESS_LOCALITY; |
There was a problem hiding this comment.
We are very sensitive to adding dependencies to the embedding. This can cause conflict in the future if a plugin adds this dependency.
Since you are returning a String, is there any chance you can remove the dependency and return the raw string?
justinmc
left a comment
There was a problem hiding this comment.
LGTM. Take a look at my comment about fields, otherwise just nitpicks. 👍
| channel.invokeMethod("TextInputClient.requestExistingInputState", null); | ||
| } | ||
|
|
||
| private HashMap<Object, Object> createEditingStateJSON( |
There was a problem hiding this comment.
Could this method be static?
| Configuration[] fields = null; | ||
| if (!json.isNull("fields")) { | ||
| final JSONArray fields = json.getJSONArray("fields"); | ||
| fields = new Configuration[fields.length()]; |
There was a problem hiding this comment.
There are two declarations of fields above, maybe some code got mixed up or missed being deleted.
404cffa to
a1f3344
Compare
a1f3344 to
480f843
Compare
| final double height = arguments.getDouble("height"); | ||
| final JSONArray jsonMatrix = arguments.getJSONArray("transform"); | ||
| final double[] matrix = new double[16]; | ||
| for (int i = 0; i < 16; i++) matrix[i] = jsonMatrix.getDouble(i); |
There was a problem hiding this comment.
| for (int i = 0; i < 16; i++) matrix[i] = jsonMatrix.getDouble(i); | |
| for (int i = 0; i < 16; i++) { | |
| matrix[i] = jsonMatrix.getDouble(i); | |
| } |
|
|
||
| @NonNull | ||
| private static String translateAutofillHint(@NonNull String hint) { | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
There was a problem hiding this comment.
nit: it might be a bit more readable if you do:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return hint;
}
// then switch | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) | ||
| afm = view.getContext().getSystemService(AutofillManager.class); | ||
| else afm = null; |
There was a problem hiding this comment.
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) | |
| afm = view.getContext().getSystemService(AutofillManager.class); | |
| else afm = null; | |
| afm = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? view.getContext().getSystemService(AutofillManager.class) : null; |
There was a problem hiding this comment.
SDK version check doesn't seem to work with ternary expressions, the linter started complaining when I applied the suggested change.
| } | ||
|
|
||
| private void notifyViewEntered() { | ||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; |
There was a problem hiding this comment.
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; | |
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { | |
| return; | |
| } |
| } | ||
|
|
||
| private void notifyViewExited() { | ||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; |
There was a problem hiding this comment.
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; | |
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { | |
| return; | |
| } |
| } | ||
|
|
||
| private void notifyValueChanged(String newValue) { | ||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; |
There was a problem hiding this comment.
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; | |
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { | |
| return; | |
| } |
| if (tx < minMax[0]) minMax[0] = tx; | ||
| else if (tx > minMax[1]) minMax[1] = tx; | ||
|
|
||
| if (ty < minMax[2]) minMax[2] = ty; | ||
| else if (ty > minMax[3]) minMax[3] = ty; |
There was a problem hiding this comment.
I realized the code is missing braces in a few places. The Google style guide for Java suggests that braces are used even if there's only a single statement: https://google.github.io/styleguide/javaguide.html#s4.1.1-braces-always-used
There was a problem hiding this comment.
Thank you for reviewing this!
There was a problem hiding this comment.
All missing braces should be added now. Does the updated code look good to you?
435ac06 to
0ca379f
Compare
Framework PR: flutter/flutter#52126