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

Commit 17ae6ea

Browse files
bluemarvinkeianhzo
authored andcommitted
Add missing curly brackets to if statements (#1563)
Thanks for doing this @bluemarvin
1 parent 0bf3cb7 commit 17ae6ea

34 files changed

Lines changed: 248 additions & 164 deletions

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ protected void onStart() {
307307
protected void onStop() {
308308
super.onStop();
309309

310-
if (SettingsStore.getInstance(this).getCylinderDensity() > 0.0f)
310+
if (SettingsStore.getInstance(this).getCylinderDensity() > 0.0f) {
311311
TelemetryWrapper.queueCurvedModeActiveEvent();
312+
}
312313

313314
TelemetryWrapper.stop();
314315

@@ -1286,8 +1287,9 @@ public void setCPULevel(int aCPULevel) {
12861287
@Override
12871288
public void openNewWindow(String uri) {
12881289
WindowWidget newWindow = mWindows.addWindow();
1289-
if (newWindow != null)
1290+
if (newWindow != null) {
12901291
newWindow.getSessionStack().newSessionWithUrl(uri);
1292+
}
12911293
}
12921294

12931295
@Override

app/src/common/shared/org/mozilla/vrbrowser/browser/engine/SessionStack.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,9 @@ public void newSessionWithUrl(String url) {
446446

447447
private void stackSession(int sessionId) {
448448
int currentSessionId = getCurrentSessionId();
449-
if (currentSessionId != NO_SESSION)
449+
if (currentSessionId != NO_SESSION) {
450450
pushSession(currentSessionId);
451+
}
451452
setCurrentSession(sessionId);
452453

453454
mCurrentSession = null;
@@ -524,8 +525,9 @@ public void setCurrentSession(int aId) {
524525
}
525526
dumpAllState(mCurrentSession);
526527

527-
if (mCurrentSession != null)
528+
if (mCurrentSession != null) {
528529
mCurrentSession.setActive(true);
530+
}
529531
}
530532

531533
public void setRegion(String aRegion) {
@@ -750,9 +752,9 @@ public int getCurrentSessionId() {
750752
}
751753

752754
public boolean isPrivateMode() {
753-
if (mCurrentSession != null)
755+
if (mCurrentSession != null) {
754756
return mCurrentSession.getSettings().getUsePrivateMode();
755-
757+
}
756758
return false;
757759
}
758760

@@ -1169,72 +1171,72 @@ public void onContentBlocked(@NonNull final GeckoSession session, @NonNull final
11691171
@Nullable
11701172
@Override
11711173
public GeckoResult<PromptResponse> onAlertPrompt(@NonNull GeckoSession geckoSession, @NonNull AlertPrompt alertPrompt) {
1172-
if (mPromptDelegate != null)
1174+
if (mPromptDelegate != null) {
11731175
return mPromptDelegate.onAlertPrompt(geckoSession, alertPrompt);
1174-
1176+
}
11751177
return GeckoResult.fromValue(alertPrompt.dismiss());
11761178
}
11771179

11781180
@Nullable
11791181
@Override
11801182
public GeckoResult<PromptResponse> onButtonPrompt(@NonNull GeckoSession geckoSession, @NonNull ButtonPrompt buttonPrompt) {
1181-
if (mPromptDelegate != null)
1183+
if (mPromptDelegate != null) {
11821184
return mPromptDelegate.onButtonPrompt(geckoSession, buttonPrompt);
1183-
1185+
}
11841186
return GeckoResult.fromValue(buttonPrompt.dismiss());
11851187
}
11861188

11871189
@Nullable
11881190
@Override
11891191
public GeckoResult<PromptResponse> onTextPrompt(@NonNull GeckoSession geckoSession, @NonNull TextPrompt textPrompt) {
1190-
if (mPromptDelegate != null)
1192+
if (mPromptDelegate != null) {
11911193
return mPromptDelegate.onTextPrompt(geckoSession, textPrompt);
1192-
1194+
}
11931195
return GeckoResult.fromValue(textPrompt.dismiss());
11941196
}
11951197

11961198
@Nullable
11971199
@Override
11981200
public GeckoResult<PromptResponse> onAuthPrompt(@NonNull GeckoSession geckoSession, @NonNull AuthPrompt authPrompt) {
1199-
if (mPromptDelegate != null)
1201+
if (mPromptDelegate != null) {
12001202
return mPromptDelegate.onAuthPrompt(geckoSession, authPrompt);
1201-
1203+
}
12021204
return GeckoResult.fromValue(authPrompt.dismiss());
12031205
}
12041206

12051207
@Nullable
12061208
@Override
12071209
public GeckoResult<PromptResponse> onChoicePrompt(@NonNull GeckoSession geckoSession, @NonNull ChoicePrompt choicePrompt) {
1208-
if (mPromptDelegate != null)
1210+
if (mPromptDelegate != null) {
12091211
return mPromptDelegate.onChoicePrompt(geckoSession, choicePrompt);
1210-
1212+
}
12111213
return GeckoResult.fromValue(choicePrompt.dismiss());
12121214
}
12131215

12141216
@Nullable
12151217
@Override
12161218
public GeckoResult<PromptResponse> onColorPrompt(@NonNull GeckoSession geckoSession, @NonNull ColorPrompt colorPrompt) {
1217-
if (mPromptDelegate != null)
1219+
if (mPromptDelegate != null) {
12181220
return mPromptDelegate.onColorPrompt(geckoSession, colorPrompt);
1219-
1221+
}
12201222
return GeckoResult.fromValue(colorPrompt.dismiss());
12211223
}
12221224

12231225
@Nullable
12241226
@Override
12251227
public GeckoResult<PromptResponse> onDateTimePrompt(@NonNull GeckoSession geckoSession, @NonNull DateTimePrompt dateTimePrompt) {
1226-
if (mPromptDelegate != null)
1228+
if (mPromptDelegate != null) {
12271229
return mPromptDelegate.onDateTimePrompt(geckoSession, dateTimePrompt);
1228-
1230+
}
12291231
return GeckoResult.fromValue(dateTimePrompt.dismiss());
12301232
}
12311233

12321234
@Nullable
12331235
@Override
12341236
public GeckoResult<PromptResponse> onFilePrompt(@NonNull GeckoSession geckoSession, @NonNull FilePrompt filePrompt) {
1235-
if (mPromptDelegate != null)
1237+
if (mPromptDelegate != null) {
12361238
return mPromptDelegate.onFilePrompt(geckoSession, filePrompt);
1237-
1239+
}
12381240
return GeckoResult.fromValue(filePrompt.dismiss());
12391241
}
12401242

app/src/common/shared/org/mozilla/vrbrowser/input/CustomKeyboard.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public CustomKeyboard (Context context, int layoutTemplateResId, CharSequence ch
7272

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

75-
if (column >= maxColumns
76-
|| x + mDefaultWidth + horizontalPadding > mDisplayWidth) {
75+
if (column >= maxColumns || x + mDefaultWidth + horizontalPadding > mDisplayWidth) {
7776

7877
mRows[rowIndex].rowEdgeFlags = EDGE_BOTTOM;
7978

@@ -103,8 +102,9 @@ public CustomKeyboard (Context context, int layoutTemplateResId, CharSequence ch
103102
}
104103

105104
for (Row row : mRows) {
106-
if (rows != null)
105+
if (rows != null) {
107106
rows.add(row);
107+
}
108108
}
109109
setParentField(this, "mTotalHeight", y + mDefaultHeight);
110110
}

app/src/common/shared/org/mozilla/vrbrowser/search/suggestions/SuggestionsProvider.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ public int compare(Object obj1, Object obj2) {
2727

2828
} else if (suggestion1.type == suggestion2.type) {
2929
if (mFilterText != null) {
30-
if (suggestion1.title != null && suggestion2.title != null)
30+
if (suggestion1.title != null && suggestion2.title != null) {
3131
return suggestion1.title.toLowerCase().indexOf(mFilterText) - suggestion2.title.toLowerCase().indexOf(mFilterText);
32+
}
3233
return suggestion1.url.toLowerCase().indexOf(mFilterText) - suggestion2.url.indexOf(mFilterText);
3334

3435
} else {
@@ -85,8 +86,9 @@ public CompletableFuture<List<SuggestionItem>> getBookmarkSuggestions(@NonNull L
8586
null,
8687
Type.BOOKMARK
8788
)));
88-
if (mComparator != null)
89+
if (mComparator != null) {
8990
items.sort(mComparator);
91+
}
9092
future.complete(items);
9193
});
9294

@@ -105,8 +107,9 @@ public CompletableFuture<List<SuggestionItem>> getHistorySuggestions(@NonNull fi
105107
null,
106108
Type.HISTORY
107109
)));
108-
if (mComparator != null)
110+
if (mComparator != null) {
109111
items.sort(mComparator);
112+
}
110113
future.complete(items);
111114
});
112115

@@ -145,8 +148,9 @@ public CompletableFuture<List<SuggestionItem>> getSearchEngineSuggestions(@NonNu
145148
Type.SUGGESTION
146149
));
147150
});
148-
if (mComparator != null)
151+
if (mComparator != null) {
149152
items.sort(mComparator);
153+
}
150154
future.complete(items);
151155
});
152156

app/src/common/shared/org/mozilla/vrbrowser/telemetry/TelemetryWrapper.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ public static void uploadPageLoadToHistogram(String uri) {
286286
return;
287287
}
288288

289-
if (uri == null)
289+
if (uri == null) {
290290
return;
291+
}
291292

292293
try {
293294
URI uriLink = URI.create(uri);
@@ -546,8 +547,9 @@ private static void queueActiveWindowPctEvent() {
546547
for (long time : activePlacementTime)
547548
totalTime += time;
548549

549-
if (totalTime == 0)
550+
if (totalTime == 0) {
550551
return;
552+
}
551553

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

598600
for (int index = 0; index< MAX_WINDOWS; index++) {
599-
if (openWindows[index] != 0)
601+
if (openWindows[index] != 0) {
600602
openWindows[index] = 1;
601-
if (openPrivateWindows[index] != 0)
603+
}
604+
if (openPrivateWindows[index] != 0) {
602605
openPrivateWindows[index] = 1;
606+
}
603607
}
604608
}
605609

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

625-
if (totalTime == 0)
629+
if (totalTime == 0) {
626630
return;
631+
}
627632

628633
float[] pcts = new float[MAX_WINDOWS];
629634
for (int index = 0; index< MAX_WINDOWS; index++)

app/src/common/shared/org/mozilla/vrbrowser/ui/adapters/LanguagesAdapter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@ public void onBindViewHolder(@NonNull LanguageViewHolder holder, int position) {
153153

154154
} else if (holder.binding.add.getVisibility() == View.VISIBLE &&
155155
ViewUtils.isInsideView(holder.binding.add, (int)event.getRawX(), (int)event.getRawY())) {
156-
if (!language.isDefault() && !language.isPreferred())
156+
if (!language.isDefault() && !language.isPreferred()) {
157157
mLanguageItemCallback.onAdd(holder.binding.add, language);
158+
}
158159

159160
} else if (holder.binding.delete.getVisibility() == View.VISIBLE &&
160161
ViewUtils.isInsideView(holder.binding.delete, (int)event.getRawX(), (int)event.getRawY())) {
161-
if (!language.isDefault() && language.isPreferred())
162+
if (!language.isDefault() && language.isPreferred()) {
162163
mLanguageItemCallback.onRemove(holder.binding.delete, language);
164+
}
163165
}
164166

165167
}

app/src/common/shared/org/mozilla/vrbrowser/ui/views/CustomKeyboardView.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -747,25 +747,22 @@ private void onBufferDraw() {
747747
boolean stateHovered = false;
748748
boolean statePressed = false;
749749
for (int state : drawableState) {
750-
if (state == android.R.attr.state_hovered)
750+
if (state == android.R.attr.state_hovered) {
751751
stateHovered = true;
752-
else if (state == android.R.attr.state_pressed)
752+
} else if (state == android.R.attr.state_pressed) {
753753
statePressed = true;
754+
}
754755
}
755756
Drawable keyBackground = mKeyBackground;
756757
int columns = ((CustomKeyboard)mKeyboard).getMaxColums();
757758
if (mFeaturedKeyBackground != null && mFeaturedKeyCodes.contains(key.codes[0])) {
758759
keyBackground = mFeaturedKeyBackground;
759-
760760
} else if ((i == columns && i == keyCount - 1) && mKeySingleBackground != null) {
761761
keyBackground = mKeySingleBackground;
762-
763762
} else if ((i == 0 || i == columns) && mKeyCapStartBackground != null) {
764763
keyBackground = mKeyCapStartBackground;
765-
766764
} else if ((i == keyCount - 1 || i == columns - 1)&& mKeyCapEndBackground != null) {
767765
keyBackground = mKeyCapEndBackground;
768-
769766
}
770767
keyBackground.setState(drawableState);
771768

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

941-
if (mKeyboardActionListener != null)
938+
if (mKeyboardActionListener != null) {
942939
mKeyboardActionListener.onMultiTap(key);
940+
}
943941
}
944942
if (mKeyboardActionListener != null) {
945943
mKeyboardActionListener.onKey(code, codes, hasPopup);
@@ -1218,8 +1216,9 @@ public boolean onHoverEvent(MotionEvent event) {
12181216
if (event.getAction() != MotionEvent.ACTION_HOVER_EXIT) {
12191217
int touchX = (int) event.getX() - getPaddingLeft();
12201218
int touchY = (int) event.getY() - getPaddingTop();
1221-
if (touchY >= -mVerticalCorrection)
1219+
if (touchY >= -mVerticalCorrection) {
12221220
touchY += mVerticalCorrection;
1221+
}
12231222
keyIndex = getKeyIndices(touchX, touchY, null);
12241223
}
12251224

@@ -1245,8 +1244,9 @@ public void setFeaturedKeyBackground(int resId, int[] keyCodes) {
12451244
private boolean onModifiedTouchEvent(MotionEvent me, boolean possiblePoly) {
12461245
int touchX = (int) me.getX() - getPaddingLeft();
12471246
int touchY = (int) me.getY() - getPaddingTop();
1248-
if (touchY >= -mVerticalCorrection)
1247+
if (touchY >= -mVerticalCorrection) {
12491248
touchY += mVerticalCorrection;
1249+
}
12501250
final int action = me.getAction();
12511251
final long eventTime = me.getEventTime();
12521252
int keyIndex = getKeyIndices(touchX, touchY, null);
@@ -1290,8 +1290,9 @@ private boolean onModifiedTouchEvent(MotionEvent me, boolean possiblePoly) {
12901290
mDownTime = me.getEventTime();
12911291
mLastMoveTime = mDownTime;
12921292
checkMultiTap(eventTime, keyIndex);
1293-
if (mKeyboardActionListener != null)
1293+
if (mKeyboardActionListener != null) {
12941294
mKeyboardActionListener.onPress(keyIndex != NOT_A_KEY ? mKeys[keyIndex].codes[0] : 0);
1295+
}
12951296
if (mCurrentKey >= 0 && mKeys[mCurrentKey].repeatable) {
12961297
mRepeatKeyIndex = mCurrentKey;
12971298
Message msg = mHandler.obtainMessage(MSG_REPEAT);

app/src/common/shared/org/mozilla/vrbrowser/ui/views/HoneycombButton.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ private void initialize(Context aContext) {
8282
setClickable(true);
8383

8484
mIcon = findViewById(R.id.settings_button_icon);
85-
if (mIcon != null)
85+
if (mIcon != null) {
8686
mIcon.setImageDrawable(mButtonIcon);
87+
}
8788

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

9697
mSecondaryText = findViewById(R.id.settings_secondary_text);
97-
if (mSecondaryText != null)
98+
if (mSecondaryText != null) {
9899
mSecondaryText.setText(mSecondaryButtonText);
100+
}
99101

100102
setOnHoverListener((view, motionEvent) -> false);
101103
}

0 commit comments

Comments
 (0)