Bug 1240500 - Pre: whitespace cleanup and unnecessary comment cleanup r=me
MozReview-Commit-ID: FDOsOUSitk4
--- a/mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
@@ -171,17 +171,16 @@ class SearchEngineRow extends AnimatedHe
private void refreshOccurrencesWith(String pattern, String string) {
mOccurrences.clear();
final int patternLength = pattern.length();
int indexOfMatch = 0;
int lastIndexOfMatch = 0;
while(indexOfMatch != -1) {
indexOfMatch = string.indexOf(pattern, lastIndexOfMatch);
lastIndexOfMatch = indexOfMatch + patternLength;
- // Crash here?
if(indexOfMatch != -1) {
mOccurrences.add(indexOfMatch);
}
}
}
/**
* Sets the content for the suggestion view.
@@ -206,17 +205,17 @@ class SearchEngineRow extends AnimatedHe
final String searchTerm = getSuggestionTextFromView(mUserEnteredView);
final int searchTermLength = searchTerm.length();
refreshOccurrencesWith(searchTerm, suggestion);
if (mOccurrences.size() > 0) {
final SpannableStringBuilder sb = new SpannableStringBuilder(suggestion);
int nextStartSpanIndex = 0;
// Done to make sure that the stretch of text after the last occurrence, till the end of the suggestion, is made bold
mOccurrences.add(suggestion.length());
- for(int occurrence : mOccurrences) {
+ for (int occurrence : mOccurrences) {
// Even though they're the same style, SpannableStringBuilder will interpret there as being only one Span present if we re-use a StyleSpan
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
sb.setSpan(boldSpan, nextStartSpanIndex, occurrence, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
nextStartSpanIndex = occurrence + searchTermLength;
}
mOccurrences.clear();
suggestionText.setText(sb);
} else {