Closed Bug 1175354 Opened 9 years ago Closed 9 years ago

[Linter: UseCompoundDrawables] Substitute LinearLayout for TextView w/ compound drawable

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox42 fixed)

RESOLVED FIXED
Firefox 42
Tracking Status
firefox42 --- fixed

People

(Reporter: mcomella, Assigned: mcomella)

References

Details

(Whiteboard: [lang=java][good first bug])

Attachments

(2 files)

via lint:

UseCompoundDrawables: Node can be replaced by a TextView with compound drawables
../../src/main/res/layout/preference_search_tip.xml:6: This tag and its children can be replaced by one <TextView/> and a compound drawable

   3    - License, v. 2.0. If a copy of the MPL was not distributed with this
   4    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
   5 
   6 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   7               android:orientation="horizontal"
   8               android:layout_width="match_parent"

Note: This issue has an associated quickfix operation in Eclipse/ADT Fix
Priority: 6 / 10
Category: Performance
Severity: Warning
Explanation: Node can be replaced by a TextView with compound drawables.
A LinearLayout which contains an ImageView and a TextView can be more efficiently handled as a compound drawable (a single TextView, using the drawableTop, drawableLeft, drawableRight and/or drawableBottom attributes to draw one or more images adjacent to the text).

If the two widgets are offset from each other with margins, this can be replaced with a drawablePadding attribute.

There's a lint quickfix to perform this conversion in the Eclipse plugin.

---

Chenxia, mentorable?
Flags: needinfo?(liuche)
In http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/resources/layout/preference_search_tip.xml , add a CompoundDrawable to replace the image. I wonder if we can also turn that <LinearLayout> into a merge? (if so, we should also do that for a lot of the other special Preference layouts)
Flags: needinfo?(liuche)
QA Contact: liuche
Whiteboard: [lang=java] → [lang=java][good first bug]
Assignee: nobody → michael.l.comella
QA Contact: liuche
Bug 1175354 - Use compound drawable instead of LinearLayout and sub-containers. r=liuche
Attachment #8625957 - Flags: review?(liuche)
Comment on attachment 8625957 [details]
MozReview Request: Bug 1175354 - Use compound drawable instead of LinearLayout and sub-containers. r=liuche

Bug 1175354 - Use compound drawable instead of LinearLayout and sub-containers. r=liuche
Attachment #8625957 - Flags: review?(liuche) → review+
https://hg.mozilla.org/mozilla-central/rev/7635a2e4fa64
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
This was backed out in bug 1208790 comment 11. However, a linter ignore tag was added instead of what we've done here, which is another possible fix for this bug, so I'm going to leave it as resolved fixed.
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: