Browse Source

removal of code warnings

AndyScherzinger 8 years ago
parent
commit
46d0f01ad6

+ 4 - 7
src/com/owncloud/android/services/observer/FolderObserver.java

@@ -111,13 +111,12 @@ public class FolderObserver extends FileObserver {
         synchronized(mObservedChildren) {
             if (path != null && path.length() > 0 && mObservedChildren.containsKey(path)) {
                 
-                if (    ((event & FileObserver.MODIFY) != 0) ||
+                if (    (((event & FileObserver.MODIFY) != 0) ||
                         ((event & FileObserver.ATTRIB) != 0) ||
-                        ((event & FileObserver.MOVED_TO) != 0) ) {
-                    
-                    if (!mObservedChildren.get(path)) {
+                        ((event & FileObserver.MOVED_TO) != 0)) &&
+                        !mObservedChildren.get(path)) {
+
                         mObservedChildren.put(path, Boolean.TRUE);
-                    }
                 }
                 
                 if ((event & FileObserver.CLOSE_WRITE) != 0 && mObservedChildren.get(path)) {
@@ -134,7 +133,6 @@ public class FolderObserver extends FileObserver {
                 (path == null || path.length() == 0)) {
             Log_OC.d(TAG, "Stopping the observance on " + mPath);
         }
-        
     }
     
 
@@ -212,5 +210,4 @@ public class FolderObserver extends FileObserver {
         // or maybe just toast them;
         // or nothing, very strange fails
     }
-
 }

+ 38 - 39
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -248,45 +248,44 @@ public class FileDisplayActivity extends HookActivity
      */
     private void upgradeNotificationForInstantUpload() {
         // check for Android 5+ if legacy instant upload is activated --> disable + show info
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-            if (PreferenceManager.instantPictureUploadEnabled(this) || PreferenceManager.instantPictureUploadEnabled
-                    (this)) {
-
-                // remove legacy shared preferences
-                SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
-                editor.remove("instant_uploading")
-                        .remove("instant_video_uploading")
-                        .remove("instant_upload_path")
-                        .remove("instant_upload_path_use_subfolders")
-                        .remove("instant_upload_on_wifi")
-                        .remove("instant_upload_on_charging")
-                        .remove("instant_video_upload_path")
-                        .remove("instant_video_upload_path_use_subfolders")
-                        .remove("instant_video_upload_on_wifi")
-                        .remove("instant_video_uploading")
-                        .remove("instant_video_upload_on_charging")
-                        .remove("prefs_instant_behaviour").apply();
-
-                // show info pop-up
-                new AlertDialog.Builder(this, R.style.Theme_ownCloud_Dialog)
-                        .setTitle(R.string.drawer_folder_sync)
-                        .setMessage(R.string.folder_sync_new_info)
-                        .setPositiveButton(R.string.drawer_open, new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int which) {
-                                // show instant upload
-                                Intent folderSyncIntent = new Intent(getApplicationContext(), FolderSyncActivity.class);
-                                dialog.dismiss();
-                                startActivity(folderSyncIntent);
-                            }
-                        })
-                        .setNegativeButton(R.string.drawer_close, new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int which) {
-                                dialog.dismiss();
-                            }
-                        })
-                        .setIcon(R.drawable.ic_cloud_upload)
-                        .show();
-            }
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
+                (PreferenceManager.instantPictureUploadEnabled(this) ||
+                        PreferenceManager.instantPictureUploadEnabled(this))) {
+
+            // remove legacy shared preferences
+            SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
+            editor.remove("instant_uploading")
+                    .remove("instant_video_uploading")
+                    .remove("instant_upload_path")
+                    .remove("instant_upload_path_use_subfolders")
+                    .remove("instant_upload_on_wifi")
+                    .remove("instant_upload_on_charging")
+                    .remove("instant_video_upload_path")
+                    .remove("instant_video_upload_path_use_subfolders")
+                    .remove("instant_video_upload_on_wifi")
+                    .remove("instant_video_uploading")
+                    .remove("instant_video_upload_on_charging")
+                    .remove("prefs_instant_behaviour").apply();
+
+            // show info pop-up
+            new AlertDialog.Builder(this, R.style.Theme_ownCloud_Dialog)
+                    .setTitle(R.string.drawer_folder_sync)
+                    .setMessage(R.string.folder_sync_new_info)
+                    .setPositiveButton(R.string.drawer_open, new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialog, int which) {
+                            // show instant upload
+                            Intent folderSyncIntent = new Intent(getApplicationContext(), FolderSyncActivity.class);
+                            dialog.dismiss();
+                            startActivity(folderSyncIntent);
+                        }
+                    })
+                    .setNegativeButton(R.string.drawer_close, new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialog, int which) {
+                            dialog.dismiss();
+                        }
+                    })
+                    .setIcon(R.drawable.ic_cloud_upload)
+                    .show();
         }
     }
 

+ 2 - 1
src/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java

@@ -264,8 +264,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
     @Override
     public void onDestroyView() {
         Log_OC.d(TAG, "destroy SyncedFolderPreferencesDialogFragment view");
-        if (getDialog() != null && getRetainInstance())
+        if (getDialog() != null && getRetainInstance()) {
             getDialog().setDismissMessage(null);
+        }
         super.onDestroyView();
     }
 

+ 1 - 1
src/com/owncloud/android/ui/dialog/parcel/SyncedFolderParcelable.java

@@ -147,7 +147,7 @@ public class SyncedFolderParcelable implements Parcelable {
         this.mChargingOnly = mChargingOnly;
     }
 
-    public boolean getEnabled() {
+    public Boolean getEnabled() {
         return mEnabled;
     }