-
Notifications
You must be signed in to change notification settings - Fork 6k
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Take a look at my comment about fields
, otherwise just nitpicks. 👍
@@ -119,6 +134,16 @@ public void requestExistingInputState() { | |||
channel.invokeMethod("TextInputClient.requestExistingInputState", null); | |||
} | |||
|
|||
private HashMap<Object, Object> createEditingStateJSON( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDK version check doesn't seem to work with ternary expressions, the linter started complaining when I applied the suggested change.
@@ -277,16 +301,48 @@ private void hideTextInput(View view) { | |||
mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); | |||
} | |||
|
|||
private void notifyViewEntered() { | |||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All missing braces should be added now. Does the updated code look good to you?
435ac06
to
0ca379f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Framework PR: flutter/flutter#52126