Last active
August 8, 2018 12:02
-
-
Save HanCheng/42a27ec8df2c56ea3b0c to your computer and use it in GitHub Desktop.
cleaning up lint warnings and errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. For paddingStart, Severity: Errors. | |
because we also have paddingLeft, so for old platform, the paddingStart is ignored; so api < 17, the lint tool | |
will show error about paddingStart, and we do not currently support RTL, and paddingStart work the same way as | |
paddingLeft, so i think it really about the NewApi. Because the lint tool just check whether paddingStart is | |
compatible with api < 17, and I check that when api == 16, it works fine and does not crash. I have checked all | |
the lint error list, i do not find other lint checks might solve this. So I think just add | |
tools:ignore="NewApi" will be fine. | |
2. the warnings in build.gradle showing that some of the tools are using the old version, do i need change | |
these to newest, or just suppress lint to ignore NewerVersionAvailable. | |
3. for negative margin wawrnings in the code, | |
/ta-flights-android/TAFlights/src/main/java/com/tripadvisor/android/taflights/views/FlightSearchItemView.java:154: | |
Error: Call requires API level 21 (current min is 14): android.widget.TextView#setLetterSpacing [NewApi] | |
i just use @SuppressLint("NewApi"), the error shows negative margin is avaiable in api 21, but i think it is not the reason; | |
For negative margin in the xml, | |
ta-flights-android/TAFlights/src/main/res/layout/fragment_airport_list.xml:14: Warning: Margin values should | |
not be negative [NegativeMargin] | |
i use tools:ignore="NegativeMargin". | |
4. About RelativeOverlap warnings: | |
/ta-flights-android/TAFlights/src/main/res/layout/flight_search_result_item_row.xml:26: Warning: | |
@id/marketing_airline_name can overlap @id/price if @id/price, @id/marketing_airline_name grow due to localized text expansion [RelativeOverlap] | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
^ | |
/ta-flights-android/TAFlights/src/main/res/layout/leg_details_layout.xml:58: Warning: @id/airline_name_text | |
can overlap @id/amenities_view if @id/airline_name_text grows due to localized text expansion [RelativeOverlap] | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
^ | |
/ta-flights-android/TAFlights/src/main/res/layout/leg_details_layout.xml:197: Warning: ImageView-5 can overlap | |
@id/warning_icon if @id/leg_warning_text grows due to localized text expansion [RelativeOverlap] | |
<ImageView | |
^ | |
/ta-flights-android/TAFlights/src/main/res/layout/outbound_summary_row.xml:35: Warning: @id/marketing_airline_name | |
can overlap @id/outbound_date if @id/outbound_date, @id/marketing_airline_name grow due to localized text expansion [RelativeOverlap] | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
^ | |
/ta-flights-android/TAFlights/src/main/res/layout/search_result_header.xml:94: Warning: @id/travel_date_text_view | |
can overlap @id/travel_place_text_view if @id/travel_place_text_view, @id/travel_date_text_view grow due to localized text expansion [RelativeOverlap] | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
^ | |
/ta-flights-android/TAFlights/src/main/res/layout/search_result_header.xml:126: Warning: @id/baggage_disclaimer_text_view | |
can overlap @id/itinerary_summary if @id/itinerary_summary, @string/flights_app_baggage_fees_cbd grow due to localized text expansion [RelativeOverlap] | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
^ | |
/ta-flights-android/TAFlights/src/main/res/layout/simple_list_item_checkbox_2.xml:22: Warning: @id/text1 can | |
overlap @id/check_box if @id/text1 grows due to localized text expansion [RelativeOverlap] | |
<com.tripadvisor.android.taflights.views.RobotoTextView | |
^ | |
For click_to_call_banner_row.xml, change RelativeLayout to Linearlayout | |
For search_result_header.xml, add tools:ignore="RelativeOverlap" | |
For outbound_summary_row.xml, add tools:ignore="RelativeOverlap" | |
For leg_details_layout.xml, add tools:ignore="RelativeOverlap" | |
For flight_search_result_item_row.xml, add tools:ignore="RelativeOverlap" | |
5. For overdraw warnings, i think add the suppressLint("Overdraw") will be fine; Or improving the performance by: | |
http://stackoverflow.com/questions/11994454/possible-overdraw-root-element-paints-background | |
http://stackoverflow.com/questions/9195762/possible-overdraw-root-element-paints-background | |
second solution might need to change the source code. | |
6. Warnings /ta-flights-android/TAFlights/src/main/res/drawable-xxhdpi: Warning: Missing the following drawables | |
in drawable-xxhdpi: ab_stacked_solid_flightstheme.9.png, cab_background_bottom_flightstheme.9.png, | |
cab_background_top_flightstheme.9.png [IconDensities] | |
these *.9.png files are missing in the drawable-xxhdpi, http://stackoverflow.com/questions/17364394/android-graphics-for-xxhdpi | |
so if we want do this, we can add these files into drawable-xxhdpi, otherwise just add the suppressLint("IconDensities") | |
============================ | |
7. ta-flights-android/TAFlights/src/main/java/com/tripadvisor/android/taflights/views/LetterSpacingTextView.java:35: | |
Error: This method is not overriding anything with the current build target, but will in API level 21 (current target is 19): | |
com.tripadvisor.android.taflights.views.LetterSpacingTextView#getLetterSpacing [Override] | |
public float getLetterSpacing() { | |
~~~~~~~~~~~~~~~~ | |
public void setLetterSpacing(float mLetterSpacing) { | |
~~~~~~~~~~~~~~~~ | |
These two methods are added in API 21, it might override after the target API is 21, so we can add @SuppressLint("Override")for now | |
and if we change the target API in the future we can rename these method | |
ksarmalkar
commented
Nov 18, 2014
- Is good to go.
- Let's leave it for now.
- Is good to go.
- Is good to go.
- And 6. Let's leave it for now.
- Is good to go.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment