Browse Source

codacy: replace member with local variable

AndyScherzinger 7 years ago
parent
commit
620e58a283

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

@@ -112,10 +112,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
     /** Current focus state */
     private AudioFocus mAudioFocus = AudioFocus.NO_FOCUS;
 
-
-    /** 'True' when the current song is streaming from the network */
-    private boolean mIsStreaming = false;
-
     /** Wifi lock kept to prevents the device from shutting off the radio when streaming a file. */
     private WifiLock mWifiLock;
 
@@ -447,13 +443,13 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             createMediaPlayerIfNeeded();
             mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
             String url = mFile.getStoragePath();
+            boolean mIsStreaming = false;
             /* Streaming is not possible right now
             if (url == null || url.length() <= 0) {
                 url = AccountUtils.constructFullURLForAccount(this, mAccount) + mFile.getRemotePath();
             }
             mIsStreaming = url.startsWith("http:") || url.startsWith("https:");
             */
-            mIsStreaming = false;
 
             mPlayer.setDataSource(url);
 
@@ -464,9 +460,12 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             mPlayer.prepareAsync();
 
             // prevent the Wifi from going to sleep when streaming
+            /*
             if (mIsStreaming) {
                 mWifiLock.acquire();
-            } else if (mWifiLock.isHeld()) {
+            } else
+            */
+            if (mWifiLock.isHeld()) {
                 mWifiLock.release();
             }
 

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

@@ -79,7 +79,6 @@ public class UploadFilesActivity extends FileActivity implements
     private boolean mSelectAll = false;
     private boolean mLocalFolderPickerMode = false;
     private LocalFileListFragment mFileListFragment;
-    private Button mCancelBtn;
     protected Button mUploadBtn;
     private Spinner mBehaviourSpinner;
     private Account mAccountOnCreation;
@@ -151,7 +150,7 @@ public class UploadFilesActivity extends FileActivity implements
         mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list);
         
         // Set input controllers
-        mCancelBtn = (Button) findViewById(R.id.upload_files_btn_cancel);
+        Button mCancelBtn = (Button) findViewById(R.id.upload_files_btn_cancel);
         mCancelBtn.setOnClickListener(this);
         mUploadBtn = (AppCompatButton) findViewById(R.id.upload_files_btn_upload);
         mUploadBtn.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);

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

@@ -72,7 +72,6 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
 
     // other members
     private ArrayList<OCShare> mShares;
-    private ShareUserListAdapter mUserGroupsAdapter = null;
     private ShareFragmentListener mListener;
 
 
@@ -183,7 +182,7 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
     private void updateListOfUserGroups() {
         // Update list of users/groups
         // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
-        mUserGroupsAdapter = new ShareUserListAdapter(
+        ShareUserListAdapter mUserGroupsAdapter = new ShareUserListAdapter(
                 getActivity().getApplicationContext(),
                 R.layout.share_user_item, mShares, this
         );

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

@@ -118,11 +118,6 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
      */
     private OCCapability mCapabilities;
 
-    /**
-     * Adapter to show private shares.
-     */
-    private ShareUserListAdapter mUserGroupsAdapter = null;
-
     /**
      * Public share bound to the file.
      */
@@ -651,7 +646,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
     private void updateListOfUserGroups() {
         // Update list of users/groups
         // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
-        mUserGroupsAdapter = new ShareUserListAdapter(
+        ShareUserListAdapter mUserGroupsAdapter = new ShareUserListAdapter(
                 getActivity(),
                 R.layout.share_user_item,
                 mPrivateShares,