Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

squid:S1125 - Literal boolean values should not be used in condition … #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions Safe/src/main/java/org/openintents/safe/AskPassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void onCreate(Bundle icicle) {
}

dbHelper = new DBHelper(this);
if (dbHelper.isDatabaseOpen() == false) {
if (!dbHelper.isDatabaseOpen()) {
Dialog dbError = new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.database_error_title)
Expand Down Expand Up @@ -403,7 +403,7 @@ protected void onResume() {
if (debug) {
Log.d(TAG, "onResume()");
}
if (CategoryList.isSignedIn() == true) {
if (CategoryList.isSignedIn()) {
if (debug) {
Log.d(TAG, "already signed in");
}
Expand All @@ -416,7 +416,7 @@ protected void onResume() {
if (dbHelper == null) {
dbHelper = new DBHelper(this);
}
if (dbHelper.isDatabaseOpen() == false) {
if (!dbHelper.isDatabaseOpen()) {
if (debug) {
Log.d(TAG, "eek! database is not open");
}
Expand Down Expand Up @@ -592,7 +592,7 @@ private boolean checkUserPassword(String password) {
} catch (CryptoHelperException e) {
Log.e(TAG, e.toString());
}
if (ch.getStatus() == true) {
if (ch.getStatus()) {
dbMasterKey = decryptedMasterKey;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Safe/src/main/java/org/openintents/safe/CategoryEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
8 changes: 4 additions & 4 deletions Safe/src/main/java/org/openintents/safe/CategoryList.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected void onResume() {
Log.d(TAG, "onResume()");
}

if (isSignedIn() == false) {
if (!isSignedIn()) {
Intent frontdoor = new Intent(this, Safe.class);
frontdoor.setAction(CryptoIntents.ACTION_AUTOLOCK);
startActivity(frontdoor);
Expand All @@ -204,7 +204,7 @@ protected void onResume() {
registerReceiver(mIntentReceiver, filter);

showFirstTimeWarningDialog();
if (Passwords.getPrePopulate() == true) {
if (Passwords.getPrePopulate()) {
prePopulate();
Passwords.clearPrePopulate();
}
Expand Down Expand Up @@ -238,7 +238,7 @@ private void checkForAutoBackup() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
boolean prefAutobackup = sp.getBoolean(PreferenceActivity.PREFERENCE_AUTOBACKUP, true);

if (prefAutobackup == false) {
if (!prefAutobackup) {
return;
}
if (Passwords.countPasswords(-1) < 1) {
Expand Down Expand Up @@ -1086,7 +1086,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// Intent frontdoor = new Intent(this, FrontDoor.class);
// frontdoor.setAction(CryptoIntents.ACTION_AUTOLOCK);
// startActivity(frontdoor);
Expand Down
10 changes: 5 additions & 5 deletions Safe/src/main/java/org/openintents/safe/ChangePass.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected void onResume() {
Log.d(TAG, "onResume()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand Down Expand Up @@ -182,10 +182,10 @@ private boolean changeMasterPassword(String oldPass, String newPass) {
ch.init(CryptoHelper.EncryptionStrong, dbHelper.fetchSalt());
ch.setPassword(oldPass);
decryptedMasterKey = ch.decrypt(encryptedMasterKey);
if (ch.getStatus() == true) { // successful decryption?
if (ch.getStatus()) { // successful decryption?
ch.setPassword(newPass);
encryptedMasterKey = ch.encrypt(decryptedMasterKey);
if (ch.getStatus() == true) { // successful encryption?
if (ch.getStatus()) { // successful encryption?
dbHelper.storeMasterKey(encryptedMasterKey);
Passwords.InitCrypto(CryptoHelper.EncryptionMedium, dbHelper.fetchSalt(), decryptedMasterKey);
Passwords.Reset();
Expand Down Expand Up @@ -398,7 +398,7 @@ private boolean checkUserPassword(String pass) {
dbHelper.close();

// was decryption of the master key successful?
if (ch.getStatus() == true) {
if (ch.getStatus()) {
return true; // then we must have a good master password
}
return false;
Expand All @@ -412,7 +412,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public ParcelFileDescriptor openFile(Uri uri, String mode)
if (debug) {
Log.d(TAG, "Original file path: " + originalFile);
}
if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
Intent frontdoor = new Intent(getContext(), Safe.class);
frontdoor.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getContext().startActivity(frontdoor);
Expand Down
4 changes: 2 additions & 2 deletions Safe/src/main/java/org/openintents/safe/Help.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected void onResume() {
Log.d(TAG, "onResume()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void onCreate(Bundle icicle) {

mPreferences = PreferenceManager.getDefaultSharedPreferences(this);

if (Passwords.Initialize(this) == false) {
if (!Passwords.Initialize(this)) {
finish();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Safe/src/main/java/org/openintents/safe/PassEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
6 changes: 3 additions & 3 deletions Safe/src/main/java/org/openintents/safe/PassEditFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void onPause() {
Log.d(TAG, "onPause()");
}

if (getActivity().isFinishing() && discardEntry == false && allFieldsEmpty() == false) {
if (getActivity().isFinishing() && !discardEntry && !allFieldsEmpty()) {
savePassword();
}
try {
Expand All @@ -296,7 +296,7 @@ public void onResume() {
Log.d(TAG, "onResume()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// if (Passwords.isCryptoInitialized()) {
// saveState();
// }
Expand Down Expand Up @@ -436,7 +436,7 @@ private void populateFields() {
if (debug) {
Log.d(TAG, "populateFields()");
}
if (pass_gen_ret == true) {
if (pass_gen_ret) {
pass_gen_ret = false;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions Safe/src/main/java/org/openintents/safe/PassGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected void onPause() {
protected void onResume() {
super.onResume();

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
4 changes: 2 additions & 2 deletions Safe/src/main/java/org/openintents/safe/PassList.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected void onResume() {
Log.d(TAG, "onResume()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand Down Expand Up @@ -597,7 +597,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
8 changes: 4 additions & 4 deletions Safe/src/main/java/org/openintents/safe/PassView.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private View createView(int position, View view) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.pass_view, null);
}
if (populateFields(rowids[position], view) == false) {
if (!populateFields(rowids[position], view)) {
// failed to retreive record
return null;
}
Expand Down Expand Up @@ -283,7 +283,7 @@ public void onClick(View arg0) {
return;
}

if (usernameCopiedToClipboard == false) {
if (!usernameCopiedToClipboard) {
// don't copy the password if username was already copied
clipboard(getString(R.string.password), passwordText.getText().toString());
}
Expand Down Expand Up @@ -416,7 +416,7 @@ protected void onResume() {
Log.d(TAG, "onResume()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand Down Expand Up @@ -687,7 +687,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public boolean onPreferenceClick(Preference pref) {
protected void onResume() {
super.onResume();

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand All @@ -177,7 +177,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
10 changes: 5 additions & 5 deletions Safe/src/main/java/org/openintents/safe/Restore.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void onCreate(Bundle icicle) {
}

firstTime = icicle != null ? icicle.getBoolean(Restore.KEY_FIRST_TIME) : false;
if (firstTime == false) {
if (!firstTime) {
Bundle extras = getIntent().getExtras();
firstTime = extras != null ? extras.getBoolean(Restore.KEY_FIRST_TIME) : false;
}
Expand Down Expand Up @@ -177,7 +177,7 @@ protected void onResume() {
Log.d(TAG, "onResume()");
}

if ((!firstTime) && (CategoryList.isSignedIn() == false)) {
if ((!firstTime) && (!CategoryList.isSignedIn())) {
startActivity(frontdoor);
return;
}
Expand Down Expand Up @@ -273,7 +273,7 @@ this, getString(R.string.crypto_error)
).show();
return false;
}
if (ch.getStatus() == false) {
if (!ch.getStatus()) {
Toast.makeText(
Restore.this, getString(R.string.restore_decrypt_error),
Toast.LENGTH_LONG
Expand Down Expand Up @@ -304,7 +304,7 @@ this, getString(R.string.crypto_error)
} catch (CryptoHelperException e) {
Log.e(TAG, e.toString());
}
if (ch.getStatus() == false) {
if (!ch.getStatus()) {
Toast.makeText(
Restore.this, getString(R.string.restore_decrypt_error),
Toast.LENGTH_LONG
Expand Down Expand Up @@ -407,7 +407,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
2 changes: 1 addition & 1 deletion Safe/src/main/java/org/openintents/safe/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void onUserInteraction() {
Log.d(TAG, "onUserInteraction()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
// startActivity(frontdoor);
} else {
if (restartTimerIntent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void onResume() {
Log.d(TAG, "onResume()");
}

if (CategoryList.isSignedIn() == false) {
if (!CategoryList.isSignedIn()) {
startActivity(frontdoor);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions Safe/src/main/java/org/openintents/safe/model/Passwords.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public static List<PassEntry> getPassEntries(long categoryId, boolean decrypt, b
passList.add(passEntry);
}
}
if (decrypt == true) {
if (decrypt) {
Collections.sort(
passList, new Comparator<PassEntry>() {
public int compare(PassEntry o1, PassEntry o2) {
Expand All @@ -355,7 +355,7 @@ public static PassEntry getPassEntry(Long id, boolean decrypt, boolean descripti
if (passEntry == null) {
return null;
}
if (decrypt == false) {
if (!decrypt) {
return passEntry;
}
if (passEntry.needsDecryptDescription) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void setNotification(Context context) {
Log.d(TAG, "builder=" + CheckWrappers.mNotificationBuilderAvailable);
}
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|| (CheckWrappers.mNotificationBuilderAvailable == false)) {
|| (!CheckWrappers.mNotificationBuilderAvailable)) {
notificationCompat = new NotificationCompat.Builder(context)
.setContentTitle(context.getString(R.string.app_name))
.setContentText(
Expand Down Expand Up @@ -125,7 +125,7 @@ public static void clearNotification(Context context) {
@SuppressLint("NewApi")
public static void updateProgress(Context context, int max, int progress) {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) &&
(CheckWrappers.mNotificationBuilderAvailable == true)) {
(CheckWrappers.mNotificationBuilderAvailable)) {
wrapBuilder.setProgress(max, progress, false);
wrapBuilder.notifyManager(mNotifyManager, NOTIFICATION_ID);
}
Expand Down