Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Add missing curly brackets to if statements #1563

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,9 @@ protected void onStart() {
protected void onStop() {
super.onStop();

if (SettingsStore.getInstance(this).getCylinderDensity() > 0.0f)
if (SettingsStore.getInstance(this).getCylinderDensity() > 0.0f) {
TelemetryWrapper.queueCurvedModeActiveEvent();
}

TelemetryWrapper.stop();

Expand Down Expand Up @@ -1286,8 +1287,9 @@ public void setCPULevel(int aCPULevel) {
@Override
public void openNewWindow(String uri) {
WindowWidget newWindow = mWindows.addWindow();
if (newWindow != null)
if (newWindow != null) {
newWindow.getSessionStack().newSessionWithUrl(uri);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,9 @@ public void newSessionWithUrl(String url) {

private void stackSession(int sessionId) {
int currentSessionId = getCurrentSessionId();
if (currentSessionId != NO_SESSION)
if (currentSessionId != NO_SESSION) {
pushSession(currentSessionId);
}
setCurrentSession(sessionId);

mCurrentSession = null;
Expand Down Expand Up @@ -524,8 +525,9 @@ public void setCurrentSession(int aId) {
}
dumpAllState(mCurrentSession);

if (mCurrentSession != null)
if (mCurrentSession != null) {
mCurrentSession.setActive(true);
}
}

public void setRegion(String aRegion) {
Expand Down Expand Up @@ -750,9 +752,9 @@ public int getCurrentSessionId() {
}

public boolean isPrivateMode() {
if (mCurrentSession != null)
if (mCurrentSession != null) {
return mCurrentSession.getSettings().getUsePrivateMode();

}
return false;
}

Expand Down Expand Up @@ -1169,72 +1171,72 @@ public void onContentBlocked(@NonNull final GeckoSession session, @NonNull final
@Nullable
@Override
public GeckoResult<PromptResponse> onAlertPrompt(@NonNull GeckoSession geckoSession, @NonNull AlertPrompt alertPrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onAlertPrompt(geckoSession, alertPrompt);

}
return GeckoResult.fromValue(alertPrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onButtonPrompt(@NonNull GeckoSession geckoSession, @NonNull ButtonPrompt buttonPrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onButtonPrompt(geckoSession, buttonPrompt);

}
return GeckoResult.fromValue(buttonPrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onTextPrompt(@NonNull GeckoSession geckoSession, @NonNull TextPrompt textPrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onTextPrompt(geckoSession, textPrompt);

}
return GeckoResult.fromValue(textPrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onAuthPrompt(@NonNull GeckoSession geckoSession, @NonNull AuthPrompt authPrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onAuthPrompt(geckoSession, authPrompt);

}
return GeckoResult.fromValue(authPrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onChoicePrompt(@NonNull GeckoSession geckoSession, @NonNull ChoicePrompt choicePrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onChoicePrompt(geckoSession, choicePrompt);

}
return GeckoResult.fromValue(choicePrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onColorPrompt(@NonNull GeckoSession geckoSession, @NonNull ColorPrompt colorPrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onColorPrompt(geckoSession, colorPrompt);

}
return GeckoResult.fromValue(colorPrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onDateTimePrompt(@NonNull GeckoSession geckoSession, @NonNull DateTimePrompt dateTimePrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onDateTimePrompt(geckoSession, dateTimePrompt);

}
return GeckoResult.fromValue(dateTimePrompt.dismiss());
}

@Nullable
@Override
public GeckoResult<PromptResponse> onFilePrompt(@NonNull GeckoSession geckoSession, @NonNull FilePrompt filePrompt) {
if (mPromptDelegate != null)
if (mPromptDelegate != null) {
return mPromptDelegate.onFilePrompt(geckoSession, filePrompt);

}
return GeckoResult.fromValue(filePrompt.dismiss());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public CustomKeyboard (Context context, int layoutTemplateResId, CharSequence ch

final Key key = new Key(mRows[rowIndex]);

if (column >= maxColumns
|| x + mDefaultWidth + horizontalPadding > mDisplayWidth) {
if (column >= maxColumns || x + mDefaultWidth + horizontalPadding > mDisplayWidth) {

mRows[rowIndex].rowEdgeFlags = EDGE_BOTTOM;

Expand Down Expand Up @@ -103,8 +102,9 @@ public CustomKeyboard (Context context, int layoutTemplateResId, CharSequence ch
}

for (Row row : mRows) {
if (rows != null)
if (rows != null) {
rows.add(row);
}
}
setParentField(this, "mTotalHeight", y + mDefaultHeight);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public int compare(Object obj1, Object obj2) {

} else if (suggestion1.type == suggestion2.type) {
if (mFilterText != null) {
if (suggestion1.title != null && suggestion2.title != null)
if (suggestion1.title != null && suggestion2.title != null) {
return suggestion1.title.toLowerCase().indexOf(mFilterText) - suggestion2.title.toLowerCase().indexOf(mFilterText);
}
return suggestion1.url.toLowerCase().indexOf(mFilterText) - suggestion2.url.indexOf(mFilterText);

} else {
Expand Down Expand Up @@ -85,8 +86,9 @@ public CompletableFuture<List<SuggestionItem>> getBookmarkSuggestions(@NonNull L
null,
Type.BOOKMARK
)));
if (mComparator != null)
if (mComparator != null) {
items.sort(mComparator);
}
future.complete(items);
});

Expand All @@ -105,8 +107,9 @@ public CompletableFuture<List<SuggestionItem>> getHistorySuggestions(@NonNull fi
null,
Type.HISTORY
)));
if (mComparator != null)
if (mComparator != null) {
items.sort(mComparator);
}
future.complete(items);
});

Expand Down Expand Up @@ -145,8 +148,9 @@ public CompletableFuture<List<SuggestionItem>> getSearchEngineSuggestions(@NonNu
Type.SUGGESTION
));
});
if (mComparator != null)
if (mComparator != null) {
items.sort(mComparator);
}
future.complete(items);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ public static void uploadPageLoadToHistogram(String uri) {
return;
}

if (uri == null)
if (uri == null) {
return;
}

try {
URI uriLink = URI.create(uri);
Expand Down Expand Up @@ -546,8 +547,9 @@ private static void queueActiveWindowPctEvent() {
for (long time : activePlacementTime)
totalTime += time;

if (totalTime == 0)
if (totalTime == 0) {
return;
}

float[] pcts = new float[MAX_WINDOWS];
for (int index = 0; index< MAX_WINDOWS; index++)
Expand Down Expand Up @@ -596,10 +598,12 @@ private static void queueOpenWindowsAvgEvent() {
Log.d(LOGTAG, "\tPrivate: " + privateWM);

for (int index = 0; index< MAX_WINDOWS; index++) {
if (openWindows[index] != 0)
if (openWindows[index] != 0) {
openWindows[index] = 1;
if (openPrivateWindows[index] != 0)
}
if (openPrivateWindows[index] != 0) {
openPrivateWindows[index] = 1;
}
}
}

Expand All @@ -622,8 +626,9 @@ private static void queueOpenWindowsPctEvent() {
for (long time : openPrivateWindowsTime)
totalTime += time;

if (totalTime == 0)
if (totalTime == 0) {
return;
}

float[] pcts = new float[MAX_WINDOWS];
for (int index = 0; index< MAX_WINDOWS; index++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,15 @@ public void onBindViewHolder(@NonNull LanguageViewHolder holder, int position) {

} else if (holder.binding.add.getVisibility() == View.VISIBLE &&
ViewUtils.isInsideView(holder.binding.add, (int)event.getRawX(), (int)event.getRawY())) {
if (!language.isDefault() && !language.isPreferred())
if (!language.isDefault() && !language.isPreferred()) {
mLanguageItemCallback.onAdd(holder.binding.add, language);
}

} else if (holder.binding.delete.getVisibility() == View.VISIBLE &&
ViewUtils.isInsideView(holder.binding.delete, (int)event.getRawX(), (int)event.getRawY())) {
if (!language.isDefault() && language.isPreferred())
if (!language.isDefault() && language.isPreferred()) {
mLanguageItemCallback.onRemove(holder.binding.delete, language);
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,25 +747,22 @@ private void onBufferDraw() {
boolean stateHovered = false;
boolean statePressed = false;
for (int state : drawableState) {
if (state == android.R.attr.state_hovered)
if (state == android.R.attr.state_hovered) {
stateHovered = true;
else if (state == android.R.attr.state_pressed)
} else if (state == android.R.attr.state_pressed) {
statePressed = true;
}
}
Drawable keyBackground = mKeyBackground;
int columns = ((CustomKeyboard)mKeyboard).getMaxColums();
if (mFeaturedKeyBackground != null && mFeaturedKeyCodes.contains(key.codes[0])) {
keyBackground = mFeaturedKeyBackground;

} else if ((i == columns && i == keyCount - 1) && mKeySingleBackground != null) {
keyBackground = mKeySingleBackground;

} else if ((i == 0 || i == columns) && mKeyCapStartBackground != null) {
keyBackground = mKeyCapStartBackground;

} else if ((i == keyCount - 1 || i == columns - 1)&& mKeyCapEndBackground != null) {
keyBackground = mKeyCapEndBackground;

}
keyBackground.setState(drawableState);

Expand Down Expand Up @@ -938,8 +935,9 @@ private void detectAndSendKey(int index, int x, int y, long eventTime) {
}
code = key.codes[mTapCount];

if (mKeyboardActionListener != null)
if (mKeyboardActionListener != null) {
mKeyboardActionListener.onMultiTap(key);
}
}
if (mKeyboardActionListener != null) {
mKeyboardActionListener.onKey(code, codes, hasPopup);
Expand Down Expand Up @@ -1218,8 +1216,9 @@ public boolean onHoverEvent(MotionEvent event) {
if (event.getAction() != MotionEvent.ACTION_HOVER_EXIT) {
int touchX = (int) event.getX() - getPaddingLeft();
int touchY = (int) event.getY() - getPaddingTop();
if (touchY >= -mVerticalCorrection)
if (touchY >= -mVerticalCorrection) {
touchY += mVerticalCorrection;
}
keyIndex = getKeyIndices(touchX, touchY, null);
}

Expand All @@ -1245,8 +1244,9 @@ public void setFeaturedKeyBackground(int resId, int[] keyCodes) {
private boolean onModifiedTouchEvent(MotionEvent me, boolean possiblePoly) {
int touchX = (int) me.getX() - getPaddingLeft();
int touchY = (int) me.getY() - getPaddingTop();
if (touchY >= -mVerticalCorrection)
if (touchY >= -mVerticalCorrection) {
touchY += mVerticalCorrection;
}
final int action = me.getAction();
final long eventTime = me.getEventTime();
int keyIndex = getKeyIndices(touchX, touchY, null);
Expand Down Expand Up @@ -1290,8 +1290,9 @@ private boolean onModifiedTouchEvent(MotionEvent me, boolean possiblePoly) {
mDownTime = me.getEventTime();
mLastMoveTime = mDownTime;
checkMultiTap(eventTime, keyIndex);
if (mKeyboardActionListener != null)
if (mKeyboardActionListener != null) {
mKeyboardActionListener.onPress(keyIndex != NOT_A_KEY ? mKeys[keyIndex].codes[0] : 0);
}
if (mCurrentKey >= 0 && mKeys[mCurrentKey].repeatable) {
mRepeatKeyIndex = mCurrentKey;
Message msg = mHandler.obtainMessage(MSG_REPEAT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ private void initialize(Context aContext) {
setClickable(true);

mIcon = findViewById(R.id.settings_button_icon);
if (mIcon != null)
if (mIcon != null) {
mIcon.setImageDrawable(mButtonIcon);
}

mText = findViewById(R.id.settings_button_text);
if (mText != null) {
Expand All @@ -94,8 +95,9 @@ private void initialize(Context aContext) {
}

mSecondaryText = findViewById(R.id.settings_secondary_text);
if (mSecondaryText != null)
if (mSecondaryText != null) {
mSecondaryText.setText(mSecondaryButtonText);
}

setOnHoverListener((view, motionEvent) -> false);
}
Expand Down
Loading