|
|
DescriptionFloat card scanner icon at the end of EditText instead of compound drawable
This gives better user experience since compound drawable do not support click event.
BUG=657178, 640430
Committed: https://crrev.com/c3da4b51497fca50ebed5e4adbec3f7ada68ceda
Cr-Commit-Position: refs/heads/master@{#427222}
Patch Set 1 #
Total comments: 6
Patch Set 2 : address comments and tint icon #
Total comments: 2
Patch Set 3 : padding at the end of EditText for action icon #
Total comments: 4
Patch Set 4 : address comments #
Total comments: 4
Patch Set 5 : add comments, move setTranslationY #
Messages
Total messages: 64 (45 generated)
Patchset #1 (id:1) has been deleted
Patchset #1 (id:20001) has been deleted
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== header draft BUG= ========== to ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178 ==========
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #1 (id:40001) has been deleted
Patchset #1 (id:60001) has been deleted
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
gogerald@chromium.org changed reviewers: + rouslan@chromium.org
Hi, PTAL,
https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/res... File chrome/android/java/res/layout/payments_request_editor_textview.xml (right): https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/res... chrome/android/java/res/layout/payments_request_editor_textview.xml:30: android:contentDescription="@string/autofill_scan_credit_card" The content description should ideally be set from Java. See my other comment. https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java (right): https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:64: mActionIcon.setVisibility(VISIBLE); mActionIcon.setContentDescription(fieldModel.getActionDescriptionForAccessibility()); https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:163: // Align the bottom of mActionIcon to the bottom of mInput. Add a comment about why this is necessary. I think it's because the text field changes in size on focus change, but you probably know the reasons better.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #2 (id:100001) has been deleted
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Patchset #2 (id:120001) has been deleted
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/res... File chrome/android/java/res/layout/payments_request_editor_textview.xml (right): https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/res... chrome/android/java/res/layout/payments_request_editor_textview.xml:30: android:contentDescription="@string/autofill_scan_credit_card" On 2016/10/20 22:52:04, rouslan wrote: > The content description should ideally be set from Java. See my other comment. Done. https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java (right): https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:64: mActionIcon.setVisibility(VISIBLE); On 2016/10/20 22:52:04, rouslan wrote: > mActionIcon.setContentDescription(fieldModel.getActionDescriptionForAccessibility()); Done. https://codereview.chromium.org/2434383002/diff/80001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:163: // Align the bottom of mActionIcon to the bottom of mInput. On 2016/10/20 22:52:04, rouslan wrote: > Add a comment about why this is necessary. I think it's because the text field > changes in size on focus change, but you probably know the reasons better. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm
The CQ bit was checked by gogerald@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
I don't own files in chrome/android/java/res/layout/.
The CQ bit was unchecked by gogerald@chromium.org
gogerald@chromium.org changed reviewers: + tedchoc@chromium.org
tedchoc@chromium.org: Please review changes in chrome/android/java/res/layout/*
Description was changed from ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178 ========== to ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178,640430 ==========
https://codereview.chromium.org/2434383002/diff/140001/chrome/android/java/re... File chrome/android/java/res/layout/payments_request_editor_textview.xml (right): https://codereview.chromium.org/2434383002/diff/140001/chrome/android/java/re... chrome/android/java/res/layout/payments_request_editor_textview.xml:11: <org.chromium.chrome.browser.widget.CompatibilityTextInputLayout what happens if this text is very long? Won't the icon overlap it and potentially prevent it from being visible? I feel this needs android:paddingEnd="48dp" or something to ensure that isn't the case.
Patchset #3 (id:160001) has been deleted
Patchset #3 (id:180001) has been deleted
https://codereview.chromium.org/2434383002/diff/140001/chrome/android/java/re... File chrome/android/java/res/layout/payments_request_editor_textview.xml (right): https://codereview.chromium.org/2434383002/diff/140001/chrome/android/java/re... chrome/android/java/res/layout/payments_request_editor_textview.xml:11: <org.chromium.chrome.browser.widget.CompatibilityTextInputLayout On 2016/10/21 17:50:43, Ted C wrote: > what happens if this text is very long? Won't the icon overlap it and > potentially prevent it from being visible? > > I feel this needs android:paddingEnd="48dp" or something to ensure that isn't > the case. Done. Add padding programmatically in EditorTextField.onWindowFocusChanged when action_icon is enabled.
a couple questions about the java code (that you might have already tried, but more trying to get a better understanding) https://codereview.chromium.org/2434383002/diff/200001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java (right): https://codereview.chromium.org/2434383002/diff/200001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:64: Drawable icon = ApiCompatibilityUtils.getDrawable( do you happen to know if TintedDrawable's would work here? In particular, this API "should" do what you want...hopefully. https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chr... https://codereview.chromium.org/2434383002/diff/200001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:172: if (hasWindowFocus && mActionIcon != null) { did you try overwriting onLayout (or measure) instead? This seems to be layout related stuff and that would be more consistent with android's normal pattern. Decent write up about the process if you're not familiar: https://developer.android.com/guide/topics/ui/how-android-draws.html
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2434383002/diff/200001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java (right): https://codereview.chromium.org/2434383002/diff/200001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:64: Drawable icon = ApiCompatibilityUtils.getDrawable( On 2016/10/21 20:13:50, Ted C wrote: > do you happen to know if TintedDrawable's would work here? > > In particular, this API "should" do what you want...hopefully. > https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chr... Done. Did not know this convenient class, turns out it's default tint mode is what I need here, very good to know. https://codereview.chromium.org/2434383002/diff/200001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:172: if (hasWindowFocus && mActionIcon != null) { On 2016/10/21 20:13:50, Ted C wrote: > did you try overwriting onLayout (or measure) instead? This seems to be layout > related stuff and that would be more consistent with android's normal pattern. > > Decent write up about the process if you're not familiar: > https://developer.android.com/guide/topics/ui/how-android-draws.html Done. Just chose a moment late enough :(. Seems onMeasure is late enough in this case.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2434383002/diff/220001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java (right): https://codereview.chromium.org/2434383002/diff/220001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:165: public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { welcome to the wild world of android layouts, so forgive me for the rambling reply. setting the padding actually will retrigger a layout pass as it affects the measurement. I have a couple potential suggestions: 1.) In the XML file, pull this android:layout_width="48dp" out to use a @dimen reference. Then instead of relying on mActionIcon.getWidth(), which will only be resolved after a full measure and layout pass, you would just pull the same value of of dimens. 2.) Instead of relying on a full multi-pass measure/layout, you would do something like the follows: onMeasure(...) { // This assumes the width never changes, potentially an unneeded // optimization. if (mActionIcon != null && mActionIcon.getMeasuredWidth() == 0) { // Using the existing measure specs is fine in this case because we // know the view size is bounded. mActionIcon.onMeasure(widthMeasureSpec, heightMeasureSpec); } if (mActionIcon != null) { // FYI: I'm using getMeasuredWidth() here as it doesn't rely on the // layout pass. ApiCompatibilityUtils.setPaddingRelative(mInput, ApiCompatibilityUtils.getPaddingStart(mInput), mInput.getPaddingTop(), mActionIcon.getMeasuredWidth(), mInput.getPaddingBottom()); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } // The problem with using getY() and getHeight(), getTop() is that it // requires running layout first, so it won't be right inside of // onMeasure (it might have worked because setPadding was causing a // double trigger, but that isn't something we should rely on). // // Since setTranslation[X|Y] only affect draw positioning, it doesn't // trigger a relayout and is therefore safe to do relatively unguarded // here. onLayout(boolean changed, ...) { super.onLayout(...); if (changed && mActionIcon != null) { float offset = mInputLayout.getY() + mInput.getY() + (float) mInput.getHeight() - (float) mActionIcon.getHeight() - mActionIcon.getTop(); mActionIcon.setTranslationY(offset); } } I "hope" that is somewhat clear about the flow of these APIs, but let me know if not. I tried to add inline comments describing it for the use of the review, but not something that should necessarily go in code. https://codereview.chromium.org/2434383002/diff/220001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:198: public AutoCompleteTextView getEditText() { for non-private methods, it's a best practice to add javadocs
Patchset #5 (id:240001) has been deleted
Patchset #5 (id:260001) has been deleted
The CQ bit was checked by gogerald@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Patchset #5 (id:280001) has been deleted
https://codereview.chromium.org/2434383002/diff/220001/chrome/android/java/sr... File chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java (right): https://codereview.chromium.org/2434383002/diff/220001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:165: public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { On 2016/10/24 17:41:41, Ted C (OOO 10.25 - 30) wrote: > welcome to the wild world of android layouts, so forgive me for the rambling > reply. > > setting the padding actually will retrigger a layout pass as it affects the > measurement. > > I have a couple potential suggestions: > 1.) In the XML file, pull this android:layout_width="48dp" out to use a @dimen > reference. Then instead of relying on mActionIcon.getWidth(), which will only > be resolved after a full measure and layout pass, you would just pull the same > value of of dimens. > 2.) Instead of relying on a full multi-pass measure/layout, you would do > something like the follows: > > onMeasure(...) { > // This assumes the width never changes, potentially an unneeded > // optimization. > if (mActionIcon != null && mActionIcon.getMeasuredWidth() == 0) { > // Using the existing measure specs is fine in this case because we > // know the view size is bounded. > mActionIcon.onMeasure(widthMeasureSpec, heightMeasureSpec); > } > if (mActionIcon != null) { > // FYI: I'm using getMeasuredWidth() here as it doesn't rely on the > // layout pass. > ApiCompatibilityUtils.setPaddingRelative(mInput, > ApiCompatibilityUtils.getPaddingStart(mInput), > mInput.getPaddingTop(), > mActionIcon.getMeasuredWidth(), mInput.getPaddingBottom()); > } > super.onMeasure(widthMeasureSpec, heightMeasureSpec); > } > > // The problem with using getY() and getHeight(), getTop() is that it > // requires running layout first, so it won't be right inside of > // onMeasure (it might have worked because setPadding was causing a > // double trigger, but that isn't something we should rely on). > // > // Since setTranslation[X|Y] only affect draw positioning, it doesn't > // trigger a relayout and is therefore safe to do relatively unguarded > // here. > onLayout(boolean changed, ...) { > super.onLayout(...); > if (changed && mActionIcon != null) { > float offset = mInputLayout.getY() + mInput.getY() + (float) > mInput.getHeight() > - (float) mActionIcon.getHeight() - mActionIcon.getTop(); > mActionIcon.setTranslationY(offset); > } > } > > I "hope" that is somewhat clear about the flow of these APIs, but let me know if > not. I tried to add inline comments describing it for the use of the review, > but not something that should necessarily go in code. Done. Clear enough. mAction will soon be grouped into a LinearLayout to add additional icon which will show and gone dynamically (https://codereview.chromium.org/2442933003/), so I would not fix the width by @dimen. https://codereview.chromium.org/2434383002/diff/220001/chrome/android/java/sr... chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorTextField.java:198: public AutoCompleteTextView getEditText() { On 2016/10/24 17:41:41, Ted C (OOO 10.25 - 30) wrote: > for non-private methods, it's a best practice to add javadocs Done.
lgtm
The CQ bit was checked by gogerald@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rouslan@chromium.org Link to the patchset: https://codereview.chromium.org/2434383002/#ps300001 (title: "add comments, move setTranslationY")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clan...)
The CQ bit was checked by gogerald@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178,640430 ========== to ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178,640430 ==========
Message was sent while issue was closed.
Committed patchset #5 (id:300001)
Message was sent while issue was closed.
Description was changed from ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178,640430 ========== to ========== Float card scanner icon at the end of EditText instead of compound drawable This gives better user experience since compound drawable do not support click event. BUG=657178,640430 Committed: https://crrev.com/c3da4b51497fca50ebed5e4adbec3f7ada68ceda Cr-Commit-Position: refs/heads/master@{#427222} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/c3da4b51497fca50ebed5e4adbec3f7ada68ceda Cr-Commit-Position: refs/heads/master@{#427222} |