From 620e58a2832371631ef2281cf9cad8c74568270b Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Wed, 16 Aug 2017 20:05:25 +0200 Subject: [PATCH] codacy: replace member with local variable --- .../java/com/owncloud/android/media/MediaService.java | 11 +++++------ .../android/ui/activity/UploadFilesActivity.java | 3 +-- .../android/ui/fragment/SearchShareesFragment.java | 3 +-- .../android/ui/fragment/ShareFileFragment.java | 7 +------ 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/owncloud/android/media/MediaService.java b/src/main/java/com/owncloud/android/media/MediaService.java index 27c8663156..2201dd2031 100644 --- a/src/main/java/com/owncloud/android/media/MediaService.java +++ b/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(); } diff --git a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index 45f6d2fccd..d8aed6fb7a 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/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); diff --git a/src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java b/src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java index 3db1f71799..5b527ca240 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java +++ b/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 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 ); diff --git a/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java b/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java index 1d473e7b9a..f071696a1c 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java +++ b/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,