Эх сурвалжийг харах

codacy: fix Useless parentheses

AndyScherzinger 6 жил өмнө
parent
commit
6255bfeb9d
37 өөрчлөгдсөн 135 нэмэгдсэн , 176 устгасан
  1. 1 1
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java
  2. 1 1
      src/main/java/com/owncloud/android/authentication/AuthenticatorUrlUtils.java
  3. 5 5
      src/main/java/com/owncloud/android/db/OCUpload.java
  4. 2 2
      src/main/java/com/owncloud/android/files/services/FileDownloader.java
  5. 4 4
      src/main/java/com/owncloud/android/files/services/FileUploader.java
  6. 1 1
      src/main/java/com/owncloud/android/jobs/NotificationJob.java
  7. 2 2
      src/main/java/com/owncloud/android/media/MediaService.java
  8. 1 3
      src/main/java/com/owncloud/android/media/MediaServiceBinder.java
  9. 1 1
      src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java
  10. 2 5
      src/main/java/com/owncloud/android/operations/RenameFileOperation.java
  11. 1 1
      src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java
  12. 1 1
      src/main/java/com/owncloud/android/services/OperationsService.java
  13. 1 4
      src/main/java/com/owncloud/android/services/SyncFolderHandler.java
  14. 1 1
      src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
  15. 1 1
      src/main/java/com/owncloud/android/ui/activity/BaseActivity.java
  16. 1 1
      src/main/java/com/owncloud/android/ui/activity/FileActivity.java
  17. 5 5
      src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
  18. 1 1
      src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java
  19. 2 4
      src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java
  20. 1 1
      src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java
  21. 1 4
      src/main/java/com/owncloud/android/ui/adapter/ProgressListener.java
  22. 26 29
      src/main/java/com/owncloud/android/ui/adapter/SslCertificateViewAdapter.java
  23. 4 4
      src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java
  24. 25 29
      src/main/java/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java
  25. 6 5
      src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java
  26. 21 26
      src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java
  27. 4 6
      src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java
  28. 1 1
      src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
  29. 1 3
      src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java
  30. 1 1
      src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java
  31. 1 1
      src/main/java/com/owncloud/android/ui/fragment/util/FileDetailSharingFragmentHelper.java
  32. 1 6
      src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java
  33. 1 6
      src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
  34. 3 4
      src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java
  35. 1 1
      src/main/java/com/owncloud/android/utils/DisplayUtils.java
  36. 1 2
      src/main/java/com/owncloud/android/utils/FilesSyncHelper.java
  37. 2 3
      src/main/java/com/owncloud/android/utils/MimeTypeUtil.java

+ 1 - 1
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -545,7 +545,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mAuthTokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);
         if (mAuthTokenType == null) {
             if (mAccount != null) {
-                boolean oAuthRequired = (mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_OAUTH2) != null);
+                boolean oAuthRequired = mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_OAUTH2) != null;
                 boolean samlWebSsoRequired = (
                         mAccountMgr.getUserData
                                 (mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null

+ 1 - 1
src/main/java/com/owncloud/android/authentication/AuthenticatorUrlUtils.java

@@ -91,7 +91,7 @@ public abstract class AuthenticatorUrlUtils {
 
             normalizedUrl = normalizeUrlSuffix(normalizedUrl);
         }
-        return (normalizedUrl != null ? normalizedUrl : "");
+        return normalizedUrl != null ? normalizedUrl : "";
     }
 
     public static String trimWebdavSuffix(String url) {

+ 5 - 5
src/main/java/com/owncloud/android/db/OCUpload.java

@@ -1,4 +1,4 @@
-/**
+/*
  * ownCloud Android client application
  *
  * @author LukeOwncloud
@@ -401,8 +401,8 @@ public class OCUpload implements Parcelable {
         mRemotePath = source.readString();
         mAccountName = source.readString();
         mLocalAction = source.readInt();
-        mForceOverwrite = (source.readInt() == 1);
-        mIsCreateRemoteFolder = (source.readInt() == 1);
+        mForceOverwrite = source.readInt() == 1;
+        mIsCreateRemoteFolder = source.readInt() == 1;
         try {
             mUploadStatus = UploadStatus.valueOf(source.readString());
         } catch (IllegalArgumentException x) {
@@ -415,8 +415,8 @@ public class OCUpload implements Parcelable {
             mLastResult = UploadResult.UNKNOWN;
         }
         mCreatedBy = source.readInt();
-        mIsUseWifiOnly = (source.readInt() == 1);
-        mIsWhileChargingOnly = (source.readInt() == 1);
+        mIsUseWifiOnly = source.readInt() == 1;
+        mIsWhileChargingOnly = source.readInt() == 1;
         mFolderUnlockToken = source.readString();
     }
 

+ 2 - 2
src/main/java/com/owncloud/android/files/services/FileDownloader.java

@@ -134,7 +134,7 @@ public class FileDownloader extends Service
                 .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.notification_icon))
                 .setColor(ThemeUtils.primaryColor(getApplicationContext(), true));
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             builder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD);
         }
 
@@ -528,7 +528,7 @@ public class FileDownloader extends Service
                                 new File(download.getSavePath()).getName())
                 );
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             mNotificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD);
         }
         

+ 4 - 4
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -469,7 +469,7 @@ public class FileUploader extends Service
                 .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.notification_icon))
                 .setColor(ThemeUtils.primaryColor(getApplicationContext(), true));
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             builder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD);
         }
 
@@ -601,7 +601,7 @@ public class FileUploader extends Service
                     files[i] = UploadFileOperation.obtainNewOCFileToUpload(
                             remotePaths[i],
                             localPaths[i],
-                            ((mimeTypes != null) ? mimeTypes[i] : null)
+                            mimeTypes != null ? mimeTypes[i] : null
                     );
                     if (files[i] == null) {
                         Log_OC.e(TAG, "obtainNewOCFileToUpload() returned null for remotePaths[i]:" + remotePaths[i]
@@ -1153,7 +1153,7 @@ public class FileUploader extends Service
                         String.format(getString(R.string.uploader_upload_in_progress_content), 0, upload.getFileName())
                 );
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             mNotificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD);
         }
 
@@ -1223,7 +1223,7 @@ public class FileUploader extends Service
             String content;
 
             // check credentials error
-            boolean needsToUpdateCredentials = (ResultCode.UNAUTHORIZED.equals(uploadResult.getCode()));
+            boolean needsToUpdateCredentials = ResultCode.UNAUTHORIZED.equals(uploadResult.getCode());
             tickerId = (needsToUpdateCredentials) ?
                     R.string.uploader_upload_failed_credentials_error : tickerId;
 

+ 1 - 1
src/main/java/com/owncloud/android/jobs/NotificationJob.java

@@ -122,7 +122,7 @@ public class NotificationJob extends Job {
                 .setAutoCancel(true)
                 .setContentIntent(pendingIntent);
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             notificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_PUSH);
         }
 

+ 2 - 2
src/main/java/com/owncloud/android/media/MediaService.java

@@ -538,7 +538,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         mNotificationBuilder.setContentTitle(ticker);
         mNotificationBuilder.setContentText(content);
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             mNotificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_MEDIA);
         }
 
@@ -575,7 +575,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         mNotificationBuilder.setContentTitle(ticker);
         mNotificationBuilder.setContentText(content);
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             mNotificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_MEDIA);
         }
 

+ 1 - 3
src/main/java/com/owncloud/android/media/MediaServiceBinder.java

@@ -57,12 +57,10 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
         mService = service;
     }
 
-
     public boolean isPlaying(OCFile mFile) {
-        return (mFile != null && mFile.equals(mService.getCurrentFile()));
+        return mFile != null && mFile.equals(mService.getCurrentFile());
     }
 
-
     @Override
     public boolean canPause() {
         return true;

+ 1 - 1
src/main/java/com/owncloud/android/operations/RemoveRemoteEncryptedFileOperation.java

@@ -126,7 +126,7 @@ public class RemoveRemoteEncryptedFileOperation extends RemoteOperation {
             int status = client.executeMethod(delete, REMOVE_READ_TIMEOUT, REMOVE_CONNECTION_TIMEOUT);
 
             delete.getResponseBodyAsString();   // exhaust the response, although not interesting
-            result = new RemoteOperationResult((delete.succeeded() || status == HttpStatus.SC_NOT_FOUND), delete);
+            result = new RemoteOperationResult(delete.succeeded() || status == HttpStatus.SC_NOT_FOUND, delete);
             Log_OC.i(TAG, "Remove " + remotePath + ": " + result.getLogMessage());
 
             // remove file from metadata

+ 2 - 5
src/main/java/com/owncloud/android/operations/RenameFileOperation.java

@@ -46,8 +46,6 @@ public class RenameFileOperation extends SyncOperation {
     private String mRemotePath;
     private String mNewName;
     private String mNewRemotePath;
-
-    
     
     /**
      * Constructor
@@ -114,7 +112,7 @@ public class RenameFileOperation extends SyncOperation {
         } catch (IOException e) {
             Log_OC.e(TAG, "Rename " + mFile.getRemotePath() + " to " + ((mNewRemotePath==null) ?
                     mNewName : mNewRemotePath) + ": " +
-                    ((result!= null) ? result.getLogMessage() : ""), e);
+                    (result!= null ? result.getLogMessage() : ""), e);
         }
 
         return result;
@@ -184,7 +182,7 @@ public class RenameFileOperation extends SyncOperation {
             Log_OC.i(TAG, "Test for validity of name " + mNewName + " in the file system failed");
             return false;
         }
-        boolean result = (testFile.exists() && testFile.isFile());
+        boolean result = testFile.exists() && testFile.isFile();
         
         // cleaning ; result is ignored, since there is not much we could do in case of failure,
         // but repeat and repeat...
@@ -192,5 +190,4 @@ public class RenameFileOperation extends SyncOperation {
         
         return result;
     }
-
 }

+ 1 - 1
src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java

@@ -210,7 +210,7 @@ public class SynchronizeFileOperation extends SyncOperation {
                     serverChanged = mServerFile.getModificationTimestamp() !=
                             mLocalFile.getModificationTimestampAtLastSyncForData();
                 } else {
-                    serverChanged = (!mServerFile.getEtag().equals(mLocalFile.getEtag()));
+                    serverChanged = !mServerFile.getEtag().equals(mLocalFile.getEtag());
                 }
                 boolean localChanged = (
                         mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData()

+ 1 - 1
src/main/java/com/owncloud/android/services/OperationsService.java

@@ -331,7 +331,7 @@ public class OperationsService extends Service {
          *          in process.
          */
         public boolean isPerformingBlockingOperation() {
-            return (!mServiceHandler.mPendingOperations.isEmpty());
+            return !mServiceHandler.mPendingOperations.isEmpty();
         }
 
 

+ 1 - 4
src/main/java/com/owncloud/android/services/SyncFolderHandler.java

@@ -51,7 +51,6 @@ class SyncFolderHandler extends Handler {
 
     private static final String TAG = SyncFolderHandler.class.getSimpleName();
 
-
     private OperationsService mService;
 
     private IndexedForest<SynchronizeFolderOperation> mPendingOperations = new IndexedForest<>();
@@ -69,7 +68,6 @@ class SyncFolderHandler extends Handler {
         mService = service;
     }
 
-
     /**
      * Returns True when the folder located in 'remotePath' in the ownCloud account 'account', or any of its
      * descendants, is being synchronized (or waiting for it).
@@ -81,10 +79,9 @@ class SyncFolderHandler extends Handler {
         if (account == null || remotePath == null) {
             return false;
         }
-        return (mPendingOperations.contains(account.name, remotePath));
+        return mPendingOperations.contains(account.name, remotePath);
     }
 
-
     @Override
     public void handleMessage(Message msg) {
         Pair<Account, String> itemSyncKey = (Pair<Account, String>) msg.obj;

+ 1 - 1
src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java

@@ -525,7 +525,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
         NotificationManager notificationManager = ((NotificationManager) getContext().
                 getSystemService(Context.NOTIFICATION_SERVICE));
 
-        if ((android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)) {
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
             builder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_FILE_SYNC);
         }
 

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/BaseActivity.java

@@ -71,7 +71,7 @@ public abstract class BaseActivity extends AppCompatActivity {
     protected void onRestart() {
         Log_OC.v(TAG, "onRestart() start");
         super.onRestart();
-        boolean validAccount = (mCurrentAccount != null && AccountUtils.exists(mCurrentAccount, this));
+        boolean validAccount = mCurrentAccount != null && AccountUtils.exists(mCurrentAccount, this);
         if (!validAccount) {
             swapToDefaultAccount();
         }

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/FileActivity.java

@@ -384,7 +384,7 @@ public abstract class FileActivity extends DrawerActivity
             }
             OwnCloudClient client;
             OwnCloudAccount ocAccount = new OwnCloudAccount(account, context);
-            client = (OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(ocAccount));
+            client = OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(ocAccount);
             if (client != null) {
                 OwnCloudCredentials cred = client.getCredentials();
                 if (cred != null) {

+ 5 - 5
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -1322,8 +1322,8 @@ public class FileDisplayActivity extends HookActivity
                             setFile(currentFile);
                         }
 
-                        mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
-                                !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
+                        mSyncInProgress = !FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
+                                !RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event);
 
                         if (RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.equals(event) &&
                                 synchResult != null && !synchResult.isSuccess()) {
@@ -1410,8 +1410,8 @@ public class FileDisplayActivity extends HookActivity
                 String accountName = intent.getStringExtra(FileUploader.ACCOUNT_NAME);
                 boolean sameAccount = getAccount() != null && accountName.equals(getAccount().name);
                 OCFile currentDir = getCurrentDir();
-                boolean isDescendant = (currentDir != null) && (uploadedRemotePath != null) &&
-                        (uploadedRemotePath.startsWith(currentDir.getRemotePath()));
+                boolean isDescendant = currentDir != null && uploadedRemotePath != null &&
+                        uploadedRemotePath.startsWith(currentDir.getRemotePath());
 
                 if (sameAccount && isDescendant) {
                     String linkedToRemotePath =
@@ -2266,7 +2266,7 @@ public class FileDisplayActivity extends HookActivity
                                         String activityName) {
         mWaitingToSend = file;
         requestForDownload(mWaitingToSend, downloadBehaviour, packageName, activityName);
-        boolean hasSecondFragment = (getSecondFragment() != null);
+        boolean hasSecondFragment = getSecondFragment() != null;
         updateFragmentsVisibility(hasSecondFragment);
     }
 

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -379,7 +379,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         ActionBar actionBar = getSupportActionBar();
 
         if (actionBar != null) {
-            boolean atRoot = (currentDir == null || currentDir.getParentId() == 0);
+            boolean atRoot = currentDir == null || currentDir.getParentId() == 0;
             actionBar.setDisplayHomeAsUpEnabled(!atRoot);
             actionBar.setHomeButtonEnabled(!atRoot);
 

+ 2 - 4
src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java

@@ -99,10 +99,8 @@ public abstract class ToolbarActivity extends BaseActivity {
         boolean inRoot;
 
         // choose the appropriate title
-        inRoot = (
-                chosenFile == null ||
-                        (chosenFile.isFolder() && chosenFile.getParentId() == FileDataStorageManager.ROOT_PARENT_ID)
-        );
+        inRoot =  chosenFile == null ||
+                        (chosenFile.isFolder() && chosenFile.getParentId() == FileDataStorageManager.ROOT_PARENT_ID);
         if (!inRoot) {
             title = chosenFile.getFileName();
         }

+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -321,7 +321,7 @@ public class UploadFilesActivity extends FileActivity implements
             return false;
         } else {
             View mSearchEditFrame = mSearchView.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
-            return (mSearchEditFrame != null && mSearchEditFrame.getVisibility() == View.VISIBLE);
+            return mSearchEditFrame != null && mSearchEditFrame.getVisibility() == View.VISIBLE;
         }
     }
     

+ 1 - 4
src/main/java/com/owncloud/android/ui/adapter/ProgressListener.java

@@ -61,10 +61,7 @@ public class ProgressListener implements OnDatatransferProgressListener {
 
     public boolean isWrapping(ProgressBar progressBar) {
         ProgressBar wrappedProgressBar = mProgressBar.get();
-        return (
-                wrappedProgressBar != null &&
-                        wrappedProgressBar == progressBar   // on purpose; don't replace with equals
-        );
+        return wrappedProgressBar != null && wrappedProgressBar == progressBar; // on purpose; don't replace with equals
     }
 
     public OCUpload getUpload() {

+ 26 - 29
src/main/java/com/owncloud/android/ui/adapter/SslCertificateViewAdapter.java

@@ -38,12 +38,11 @@ public class SslCertificateViewAdapter implements SslUntrustedCertDialog.Certifi
     //private final static String TAG = SslCertificateViewAdapter.class.getSimpleName();
     
     private SslCertificate mCertificate;
-
     
     /**
      * Constructor
      * 
-     * @param 
+     * @param certificate the SSL certificate
      */
     public SslCertificateViewAdapter(SslCertificate certificate) {
         mCertificate = certificate;
@@ -51,7 +50,7 @@ public class SslCertificateViewAdapter implements SslUntrustedCertDialog.Certifi
 
     @Override
     public void updateCertificateView(View dialogView) {
-        TextView nullCerView = (TextView) dialogView.findViewById(R.id.null_cert);
+        TextView nullCerView = dialogView.findViewById(R.id.null_cert);
         if (mCertificate != null) {
             nullCerView.setVisibility(View.GONE);
             showSubject(mCertificate.getIssuedTo(), dialogView);
@@ -65,8 +64,8 @@ public class SslCertificateViewAdapter implements SslUntrustedCertDialog.Certifi
     }
     
     private void showValidity(Date notBefore, Date notAfter, View dialogView) {
-        TextView fromView = ((TextView)dialogView.findViewById(R.id.value_validity_from));
-        TextView toView = ((TextView)dialogView.findViewById(R.id.value_validity_to));
+        TextView fromView = dialogView.findViewById(R.id.value_validity_from);
+        TextView toView = dialogView.findViewById(R.id.value_validity_to);
         DateFormat dateFormat = DateFormat.getDateInstance();
         fromView.setText(dateFormat.format(notBefore));
         toView.setText(dateFormat.format(notAfter));
@@ -74,55 +73,53 @@ public class SslCertificateViewAdapter implements SslUntrustedCertDialog.Certifi
 
     
     private void showSubject(SslCertificate.DName subject, View dialogView) {
-        TextView cnView = ((TextView)dialogView.findViewById(R.id.value_subject_CN));
+        TextView cnView = dialogView.findViewById(R.id.value_subject_CN);
         cnView.setText(subject.getCName());
         cnView.setVisibility(View.VISIBLE);
         
-        TextView oView = ((TextView)dialogView.findViewById(R.id.value_subject_O));
+        TextView oView = dialogView.findViewById(R.id.value_subject_O);
         oView.setText(subject.getOName());
         oView.setVisibility(View.VISIBLE);
         
-        TextView ouView = ((TextView)dialogView.findViewById(R.id.value_subject_OU));
+        TextView ouView = dialogView.findViewById(R.id.value_subject_OU);
         ouView.setText(subject.getUName());
         ouView.setVisibility(View.VISIBLE);
 
         // SslCertificates don't offer this information
-        ((TextView)dialogView.findViewById(R.id.value_subject_C)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.value_subject_ST)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.value_subject_L)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_subject_C)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_subject_ST)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_subject_L)).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_subject_C).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_subject_ST).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_subject_L).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_subject_C).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_subject_ST).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_subject_L).setVisibility(View.GONE);
     }
     
-    
     private void showIssuer(SslCertificate.DName issuer, View dialogView) {
-        TextView cnView = ((TextView)dialogView.findViewById(R.id.value_issuer_CN));
+        TextView cnView = dialogView.findViewById(R.id.value_issuer_CN);
         cnView.setText(issuer.getCName());
         cnView.setVisibility(View.VISIBLE);
         
-        TextView oView = ((TextView)dialogView.findViewById(R.id.value_issuer_O));
+        TextView oView = dialogView.findViewById(R.id.value_issuer_O);
         oView.setText(issuer.getOName());
         oView.setVisibility(View.VISIBLE);
 
-        TextView ouView = ((TextView)dialogView.findViewById(R.id.value_issuer_OU));
+        TextView ouView = dialogView.findViewById(R.id.value_issuer_OU);
         ouView.setText(issuer.getUName());
         ouView.setVisibility(View.VISIBLE);
         
         // SslCertificates don't offer this information
-        ((TextView)dialogView.findViewById(R.id.value_issuer_C)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.value_issuer_ST)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.value_issuer_L)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_issuer_C)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_issuer_ST)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_issuer_L)).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_issuer_C).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_issuer_ST).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_issuer_L).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_issuer_C).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_issuer_ST).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_issuer_L).setVisibility(View.GONE);
     }
     
     private void hideSignature(View dialogView) {
-        ((TextView)dialogView.findViewById(R.id.label_signature)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.label_signature_algorithm)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.value_signature_algorithm)).setVisibility(View.GONE);
-        ((TextView)dialogView.findViewById(R.id.value_signature)).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_signature).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.label_signature_algorithm).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_signature_algorithm).setVisibility(View.GONE);
+        dialogView.findViewById(R.id.value_signature).setVisibility(View.GONE);
     }
-
 }

+ 4 - 4
src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java

@@ -303,14 +303,14 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
         fakeFileToCheatThumbnailsCacheManagerInterface.setStoragePath(item.getLocalPath());
         fakeFileToCheatThumbnailsCacheManagerInterface.setMimetype(item.getMimeType());
 
-        boolean allowedToCreateNewThumbnail = (ThumbnailsCacheManager.cancelPotentialThumbnailWork(
-                fakeFileToCheatThumbnailsCacheManagerInterface, itemViewHolder.thumbnail)
+        boolean allowedToCreateNewThumbnail = ThumbnailsCacheManager.cancelPotentialThumbnailWork(
+                fakeFileToCheatThumbnailsCacheManagerInterface, itemViewHolder.thumbnail
         );
 
         // TODO this code is duplicated; refactor to a common place
-        if ((MimeTypeUtil.isImage(fakeFileToCheatThumbnailsCacheManagerInterface)
+        if (MimeTypeUtil.isImage(fakeFileToCheatThumbnailsCacheManagerInterface)
                 && fakeFileToCheatThumbnailsCacheManagerInterface.getRemoteId() != null &&
-                item.getUploadStatus() == UploadStatus.UPLOAD_SUCCEEDED)) {
+                item.getUploadStatus() == UploadStatus.UPLOAD_SUCCEEDED) {
             // Thumbnail in Cache?
             Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
                     String.valueOf(fakeFileToCheatThumbnailsCacheManagerInterface.getRemoteId())

+ 25 - 29
src/main/java/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java

@@ -70,7 +70,7 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
     }
 
     private byte[] getDigest(String algorithm, byte[] message) {
-        MessageDigest md = null;
+        MessageDigest md;
 
         try {
             md = MessageDigest.getInstance(algorithm);
@@ -82,10 +82,10 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
     }
 
     private void showSignature(View dialogView) {
-        byte[] cert = null;
+        byte[] cert;
 
-        TextView certFingerprintView = ((TextView) dialogView.findViewById(R.id.value_certificate_fingerprint));
-        TextView algorithmView = ((TextView) dialogView.findViewById(R.id.value_signature_algorithm));
+        TextView certFingerprintView = dialogView.findViewById(R.id.value_certificate_fingerprint);
+        TextView algorithmView = dialogView.findViewById(R.id.value_signature_algorithm);
 
         try {
             cert = mCertificate.getEncoded();
@@ -103,15 +103,12 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
                 algorithmView.setText(mCertificate.getSigAlgName());
 
             }
-
         } catch (CertificateEncodingException e) {
             Log.e(TAG, "Problem while trying to decode the certificate.");
         }
-
-
     }
     
-    private final String getDigestHexBytesWithColonsAndNewLines(View dialogView, final String digestType, final byte [] cert) {
+    private String getDigestHexBytesWithColonsAndNewLines(View dialogView, final String digestType, final byte [] cert) {
         final byte[] rawDigest;
         final String newLine = System.getProperty("line.separator");
 
@@ -134,8 +131,8 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
      }    
 
     private void showValidity(Date notBefore, Date notAfter, View dialogView) {
-        TextView fromView = ((TextView)dialogView.findViewById(R.id.value_validity_from));
-        TextView toView = ((TextView)dialogView.findViewById(R.id.value_validity_to));
+        TextView fromView = dialogView.findViewById(R.id.value_validity_from);
+        TextView toView = dialogView.findViewById(R.id.value_validity_to);
         DateFormat dateFormat = DateFormat.getDateInstance();
         fromView.setText(dateFormat.format(notBefore));
         toView.setText(dateFormat.format(notAfter));
@@ -143,12 +140,12 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
 
     private void showSubject(X500Principal subject, View dialogView) {
         Map<String, String> s = parsePrincipal(subject);
-        TextView cnView = ((TextView)dialogView.findViewById(R.id.value_subject_CN));
-        TextView oView = ((TextView)dialogView.findViewById(R.id.value_subject_O));
-        TextView ouView = ((TextView)dialogView.findViewById(R.id.value_subject_OU));
-        TextView cView = ((TextView)dialogView.findViewById(R.id.value_subject_C));
-        TextView stView = ((TextView)dialogView.findViewById(R.id.value_subject_ST));
-        TextView lView = ((TextView)dialogView.findViewById(R.id.value_subject_L));
+        TextView cnView = dialogView.findViewById(R.id.value_subject_CN);
+        TextView oView = dialogView.findViewById(R.id.value_subject_O);
+        TextView ouView = dialogView.findViewById(R.id.value_subject_OU);
+        TextView cView = dialogView.findViewById(R.id.value_subject_C);
+        TextView stView = dialogView.findViewById(R.id.value_subject_ST);
+        TextView lView = dialogView.findViewById(R.id.value_subject_L);
         
         if (s.get("CN") != null) {
             cnView.setText(s.get("CN"));
@@ -190,12 +187,12 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
     
     private void showIssuer(X500Principal issuer, View dialogView) {
         Map<String, String> s = parsePrincipal(issuer);
-        TextView cnView = ((TextView)dialogView.findViewById(R.id.value_issuer_CN));
-        TextView oView = ((TextView)dialogView.findViewById(R.id.value_issuer_O));
-        TextView ouView = ((TextView)dialogView.findViewById(R.id.value_issuer_OU));
-        TextView cView = ((TextView)dialogView.findViewById(R.id.value_issuer_C));
-        TextView stView = ((TextView)dialogView.findViewById(R.id.value_issuer_ST));
-        TextView lView = ((TextView)dialogView.findViewById(R.id.value_issuer_L));
+        TextView cnView = dialogView.findViewById(R.id.value_issuer_CN);
+        TextView oView = dialogView.findViewById(R.id.value_issuer_O);
+        TextView ouView = dialogView.findViewById(R.id.value_issuer_OU);
+        TextView cView = dialogView.findViewById(R.id.value_issuer_C);
+        TextView stView = dialogView.findViewById(R.id.value_issuer_ST);
+        TextView lView = dialogView.findViewById(R.id.value_issuer_L);
         
         if (s.get("CN") != null) {
             cnView.setText(s.get("CN"));
@@ -237,18 +234,17 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
     
 
     private Map<String, String> parsePrincipal(X500Principal principal) {
-        Map<String, String> result = new HashMap<String, String>();
+        Map<String, String> result = new HashMap<>();
         String toParse = principal.getName();
         String[] pieces = toParse.split(",");
-        String[] tokens = {"CN", "O", "OU", "C", "ST", "L"}; 
-        for (int i=0; i < pieces.length ; i++) {
-            for (int j=0; j<tokens.length; j++) {
-                if (pieces[i].startsWith(tokens[j] + "=")) {
-                    result.put(tokens[j], pieces[i].substring(tokens[j].length()+1));
+        String[] tokens = {"CN", "O", "OU", "C", "ST", "L"};
+        for (String piece : pieces) {
+            for (String token : tokens) {
+                if (piece.startsWith(token + "=")) {
+                    result.put(token, piece.substring(token.length() + 1));
                 }
             }
         }
         return result;
     }
-
 }

+ 6 - 5
src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java

@@ -29,6 +29,7 @@ package com.owncloud.android.ui.dialog;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.os.Bundle;
+import android.support.annotation.NonNull;
 
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
@@ -70,16 +71,15 @@ implements ConfirmationDialogFragmentListener {
             // choose message for a single file
             OCFile file = files.get(0);
 
-            messageStringId = (file.isFolder()) ?
+            messageStringId = file.isFolder() ?
                 R.string.confirmation_remove_folder_alert :
                 R.string.confirmation_remove_file_alert;
 
         } else {
             // choose message for more than one file
-            messageStringId = (containsFolder) ?
+            messageStringId = containsFolder ?
                 R.string.confirmation_remove_folders_alert :
                 R.string.confirmation_remove_files_alert;
-
         }
 
         int localRemoveButton = (!containsFavorite && (containsFolder || containsDown)) ?
@@ -124,7 +124,8 @@ implements ConfirmationDialogFragmentListener {
         alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
         alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color);
     }
-    
+
+    @NonNull
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
         Dialog dialog = super.onCreateDialog(savedInstanceState);
@@ -157,4 +158,4 @@ implements ConfirmationDialogFragmentListener {
     public void onNeutral(String callerTag) {
         // nothing to do here
     }
-}
+}

+ 21 - 26
src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java

@@ -89,7 +89,6 @@ public class SslValidatorDialog extends Dialog {
         mListener = listener;
     }
     
-    
     /**
      * {@inheritDoc}
      */
@@ -161,25 +160,23 @@ public class SslValidatorDialog extends Dialog {
 
             /// refresh
             if (mException.getCertPathValidatorException() != null) {
-                ((TextView)mView.findViewById(R.id.reason_cert_not_trusted)).setVisibility(View.VISIBLE);
+                mView.findViewById(R.id.reason_cert_not_trusted).setVisibility(View.VISIBLE);
             }
             
             if (mException.getCertificateExpiredException() != null) {
-                ((TextView)mView.findViewById(R.id.reason_cert_expired)).setVisibility(View.VISIBLE);
+                mView.findViewById(R.id.reason_cert_expired).setVisibility(View.VISIBLE);
             }
             
             if (mException.getCertificateNotYetValidException() != null) {
-                ((TextView)mView.findViewById(R.id.reason_cert_not_yet_valid)).setVisibility(View.VISIBLE);
+                mView.findViewById(R.id.reason_cert_not_yet_valid).setVisibility(View.VISIBLE);
             } 
 
             if (mException.getSslPeerUnverifiedException() != null ) {
-                ((TextView)mView.findViewById(R.id.reason_hostname_not_verified)).setVisibility(View.VISIBLE);
+                mView.findViewById(R.id.reason_hostname_not_verified).setVisibility(View.VISIBLE);
             }
             
-            
             showCertificateData(mException.getServerCertificate());
         }
-        
     }
     
     private void showCertificateData(X509Certificate cert) {
@@ -197,8 +194,8 @@ public class SslValidatorDialog extends Dialog {
     }
 
     private void showSignature(X509Certificate cert) {
-        TextView sigView = ((TextView)mView.findViewById(R.id.value_signature));
-        TextView algorithmView = ((TextView)mView.findViewById(R.id.value_signature_algorithm));
+        TextView sigView = mView.findViewById(R.id.value_signature);
+        TextView algorithmView = mView.findViewById(R.id.value_signature_algorithm);
         sigView.setText(getHex(cert.getSignature()));
         algorithmView.setText(cert.getSigAlgName());
     }
@@ -219,20 +216,20 @@ public class SslValidatorDialog extends Dialog {
 
     @SuppressWarnings("deprecation")
     private void showValidity(Date notBefore, Date notAfter) {
-        TextView fromView = ((TextView)mView.findViewById(R.id.value_validity_from));
-        TextView toView = ((TextView)mView.findViewById(R.id.value_validity_to));
+        TextView fromView = mView.findViewById(R.id.value_validity_from);
+        TextView toView = mView.findViewById(R.id.value_validity_to);
         fromView.setText(notBefore.toLocaleString());
         toView.setText(notAfter.toLocaleString());
     }
 
     private void showSubject(X500Principal subject) {
         Map<String, String> s = parsePrincipal(subject);
-        TextView cnView = ((TextView)mView.findViewById(R.id.value_subject_CN));
-        TextView oView = ((TextView)mView.findViewById(R.id.value_subject_O));
-        TextView ouView = ((TextView)mView.findViewById(R.id.value_subject_OU));
-        TextView cView = ((TextView)mView.findViewById(R.id.value_subject_C));
-        TextView stView = ((TextView)mView.findViewById(R.id.value_subject_ST));
-        TextView lView = ((TextView)mView.findViewById(R.id.value_subject_L));
+        TextView cnView = mView.findViewById(R.id.value_subject_CN);
+        TextView oView = mView.findViewById(R.id.value_subject_O);
+        TextView ouView = mView.findViewById(R.id.value_subject_OU);
+        TextView cView = mView.findViewById(R.id.value_subject_C);
+        TextView stView = mView.findViewById(R.id.value_subject_ST);
+        TextView lView = mView.findViewById(R.id.value_subject_L);
         
         if (s.get("CN") != null) {
             cnView.setText(s.get("CN"));
@@ -274,12 +271,12 @@ public class SslValidatorDialog extends Dialog {
     
     private void showIssuer(X500Principal issuer) {
         Map<String, String> s = parsePrincipal(issuer);
-        TextView cnView = ((TextView)mView.findViewById(R.id.value_issuer_CN));
-        TextView oView = ((TextView)mView.findViewById(R.id.value_issuer_O));
-        TextView ouView = ((TextView)mView.findViewById(R.id.value_issuer_OU));
-        TextView cView = ((TextView)mView.findViewById(R.id.value_issuer_C));
-        TextView stView = ((TextView)mView.findViewById(R.id.value_issuer_ST));
-        TextView lView = ((TextView)mView.findViewById(R.id.value_issuer_L));
+        TextView cnView = mView.findViewById(R.id.value_issuer_CN);
+        TextView oView = mView.findViewById(R.id.value_issuer_O);
+        TextView ouView = mView.findViewById(R.id.value_issuer_OU);
+        TextView cView = mView.findViewById(R.id.value_issuer_C);
+        TextView stView = mView.findViewById(R.id.value_issuer_ST);
+        TextView lView = mView.findViewById(R.id.value_issuer_L);
         
         if (s.get("CN") != null) {
             cnView.setText(s.get("CN"));
@@ -321,7 +318,7 @@ public class SslValidatorDialog extends Dialog {
     
 
     private Map<String, String> parsePrincipal(X500Principal principal) {
-        Map<String, String> result = new HashMap<String, String>();
+        Map<String, String> result = new HashMap<>();
         String toParse = principal.getName();
         String[] pieces = toParse.split(",");
         String[] tokens = {"CN", "O", "OU", "C", "ST", "L"}; 
@@ -341,11 +338,9 @@ public class SslValidatorDialog extends Dialog {
             NetworkUtils.addCertToKnownServersStore(mException.getServerCertificate(), getContext());
         }
     }
-
     
     public interface OnSslValidatorListener {
         public void onSavedCertificate();
         public void onFailedSavingCertificate();
     }
 }
-

+ 4 - 6
src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -156,7 +156,7 @@ public class EditShareFragment extends Fragment {
      */
     public void refreshCapabilitiesFromDB() {
         if (getActivity() instanceof FileActivity) {
-            FileActivity fileActivity = ((FileActivity) getActivity());
+            FileActivity fileActivity = (FileActivity) getActivity();
             if (fileActivity.getStorageManager() != null) {
                 mCapabilities = fileActivity.getStorageManager().getCapability(mAccount.name);
             }
@@ -202,26 +202,24 @@ public class EditShareFragment extends Fragment {
                 // from checking when iOS is ready
                 AppCompatCheckBox checkBox = editShareView.findViewById(R.id.canEditCreateCheckBox);
                 checkBox.setChecked((sharePermissions & OCShare.CREATE_PERMISSION_FLAG) > 0);
-                checkBox.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
+                checkBox.setVisibility(canEdit ? View.VISIBLE : View.GONE);
                 ThemeUtils.tintCheckbox(checkBox, accentColor);
 
                 checkBox = editShareView.findViewById(R.id.canEditChangeCheckBox);
                 checkBox.setChecked((sharePermissions & OCShare.UPDATE_PERMISSION_FLAG) > 0);
-                checkBox.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
+                checkBox.setVisibility(canEdit ? View.VISIBLE : View.GONE);
                 ThemeUtils.tintCheckbox(checkBox, accentColor);
 
                 checkBox = editShareView.findViewById(R.id.canEditDeleteCheckBox);
                 checkBox.setChecked((sharePermissions & OCShare.DELETE_PERMISSION_FLAG) > 0);
-                checkBox.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
+                checkBox.setVisibility(canEdit ? View.VISIBLE : View.GONE);
                 ThemeUtils.tintCheckbox(checkBox, accentColor);
             }
 
             setPermissionsListening(editShareView, true);
-
         }
     }
 
-
     /**
      * Binds or unbinds listener for user actions to enable or disable a permission on the edited share
      * to the views receiving the user events.

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -457,7 +457,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
      * @return True when the fragment was created with the empty layout.
      */
     public boolean isEmpty() {
-        return (layout == R.layout.empty_list || getFile() == null || account == null);
+        return layout == R.layout.empty_list || getFile() == null || account == null;
     }
 
     /**

+ 1 - 3
src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java

@@ -695,9 +695,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
      * @return 'True' when public share is disabled in the server
      */
     private boolean isPublicShareDisabled() {
-        return (mCapabilities != null &&
-                mCapabilities.getFilesSharingPublicEnabled().isFalse()
-        );
+        return mCapabilities != null && mCapabilities.getFilesSharingPublicEnabled().isFalse();
     }
 
     /**

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/contactsbackup/ContactsBackupFragment.java

@@ -361,7 +361,7 @@ public class ContactsBackupFragment extends FileFragment implements DatePickerDi
         final ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
 
         // check permissions
-        if ((PermissionUtil.checkSelfPermission(contactsPreferenceActivity, Manifest.permission.READ_CONTACTS))) {
+        if (PermissionUtil.checkSelfPermission(contactsPreferenceActivity, Manifest.permission.READ_CONTACTS)) {
             return true;
         } else {
             // Check if we should show an explanation

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/util/FileDetailSharingFragmentHelper.java

@@ -71,6 +71,6 @@ public class FileDetailSharingFragmentHelper {
      * @return 'True' when public share is disabled in the server.
      */
     public static boolean isPublicShareDisabled(OCCapability capabilities) {
-        return (capabilities != null && capabilities.getFilesSharingPublicEnabled().isFalse());
+        return capabilities != null && capabilities.getFilesSharingPublicEnabled().isFalse();
     }
 }

+ 1 - 6
src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -424,18 +424,13 @@ public class PreviewImageActivity extends FileActivity implements
                 } else {
                     Log_OC.d(TAG, "Download finished, but the fragment is offscreen");
                 }
-                
             }
             removeStickyBroadcast(intent);
         }
-
     }
 
     public boolean getSystemUIVisible() {
-        if (getSupportActionBar() != null) {
-            return (getSupportActionBar().isShowing());
-        }
-        return true;
+        return getSupportActionBar() == null || getSupportActionBar().isShowing();
     }
 
     public void toggleFullScreen() {

+ 1 - 6
src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java

@@ -697,10 +697,9 @@ public class PreviewImageFragment extends FileFragment {
      * @return 'True' if the file can be handled by the fragment.
      */
     public static boolean canBePreviewed(OCFile file) {
-        return (file != null && MimeTypeUtil.isImage(file));
+        return file != null && MimeTypeUtil.isImage(file);
     }
 
-
     /**
      * Finishes the preview
      */
@@ -741,14 +740,12 @@ public class PreviewImageFragment extends FileFragment {
         }
     }
 
-
     private static int convertDpToPixel(float dp, Context context) {
         Resources resources = context.getResources();
         DisplayMetrics metrics = resources.getDisplayMetrics();
         return (int) (dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
     }
 
-
     public PhotoView getImageView() {
         return mImageView;
     }
@@ -763,7 +760,5 @@ public class PreviewImageFragment extends FileFragment {
             this.drawable = drawable;
             this.ocFile = ocFile;
         }
-
     }
-
 }

+ 3 - 4
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -58,7 +58,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Scanner;
 
-public class PreviewTextFragment extends FileFragment {
+public class    PreviewTextFragment extends FileFragment {
     private static final String EXTRA_FILE = "FILE";
     private static final String EXTRA_ACCOUNT = "ACCOUNT";
     private static final String TAG = PreviewTextFragment.class.getSimpleName();
@@ -402,10 +402,9 @@ public class PreviewTextFragment extends FileFragment {
         unsupportedTypes.add("text/vnd.rn-realtext");
         unsupportedTypes.add("text/vnd.wap.wml");
         unsupportedTypes.add("text/vnd.wap.wmlscript");
-        return (file != null && file.isDown() && MimeTypeUtil.isText(file) &&
+        return file != null && file.isDown() && MimeTypeUtil.isText(file) &&
                 !unsupportedTypes.contains(file.getMimeType()) &&
-                !unsupportedTypes.contains(MimeTypeUtil.getMimeTypeFromPath(file.getRemotePath()))
-        );
+                !unsupportedTypes.contains(MimeTypeUtil.getMimeTypeFromPath(file.getRemotePath()));
     }
 
     /**

+ 1 - 1
src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -266,7 +266,7 @@ public class DisplayUtils {
         hostEnd = (hostEnd == -1 ? urlNoDots.length() : hostStart + hostEnd);
 
         String host = urlNoDots.substring(hostStart, hostEnd);
-        host = (toASCII ? IDN.toASCII(host) : IDN.toUnicode(host));
+        host = toASCII ? IDN.toASCII(host) : IDN.toUnicode(host);
 
         return dots + urlNoDots.substring(0, hostStart) + host + urlNoDots.substring(hostEnd);
     }

+ 1 - 2
src/main/java/com/owncloud/android/utils/FilesSyncHelper.java

@@ -113,7 +113,6 @@ public class FilesSyncHelper {
 
         } else {
             try {
-
                 if (dryRun) {
                     arbitraryDataProvider.storeOrUpdateKeyValue(GLOBAL, syncedFolderInitiatedKey,
                             currentTimeString);
@@ -157,7 +156,7 @@ public class FilesSyncHelper {
         SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver);
 
         for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
-            if ((syncedFolder.isEnabled()) && ((MediaFolderType.CUSTOM != syncedFolder.getType()) || !skipCustom)) {
+            if (syncedFolder.isEnabled() && (MediaFolderType.CUSTOM != syncedFolder.getType() || !skipCustom)) {
                 insertAllDBEntriesForSyncedFolder(syncedFolder);
             }
         }

+ 2 - 3
src/main/java/com/owncloud/android/utils/MimeTypeUtil.java

@@ -282,11 +282,10 @@ public class MimeTypeUtil {
      * @return 'True' if the file is simple text (e.g. not application-dependent, like .doc or .docx)
      */
     public static boolean isText(OCFile file) {
-        return (MimeTypeUtil.isText(file.getMimeType())
-                || MimeTypeUtil.isText(getMimeTypeFromPath(file.getRemotePath())));
+        return MimeTypeUtil.isText(file.getMimeType())
+                || MimeTypeUtil.isText(getMimeTypeFromPath(file.getRemotePath()));
     }
 
-
     /**
      * @param file the file to be analyzed
      * @return 'True' if the file is a vcard