Skip to content

Commit

Permalink
Decrease spotbugs
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 authored and AndyScherzinger committed Nov 20, 2023
1 parent a1e4b22 commit ee08d6a
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda

private static final String ARG_FILE = "FILE";
private static final String ARG_USER = "USER";
public static final int PERMISSION_EDITING_ALLOWED = 17;

private OCFile file;
private User user;
Expand Down Expand Up @@ -118,8 +117,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
} else {
Bundle arguments = getArguments();
if (arguments != null) {
file = getArguments().getParcelable(ARG_FILE);
user = getArguments().getParcelable(ARG_USER);
file = arguments.getParcelable(ARG_FILE);
user = arguments.getParcelable(ARG_USER);
}
}

Expand Down Expand Up @@ -149,12 +148,11 @@ public void onActivityCreated(Bundle savedInstanceState) {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = FileDetailsSharingFragmentBinding.inflate(inflater, container, false);
View view = binding.getRoot();

fileOperationsHelper = fileActivity.getFileOperationsHelper();
fileDataStorageManager = fileActivity.getStorageManager();

AccountManager accountManager = AccountManager.get(getContext());
AccountManager accountManager = AccountManager.get(requireContext());
String userId = accountManager.getUserData(user.toPlatformAccount(),
com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);

Expand All @@ -165,11 +163,12 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
user,
viewThemeUtils,
file.isEncrypted()));
binding.sharesList.setLayoutManager(new LinearLayoutManager(getContext()));

binding.sharesList.setLayoutManager(new LinearLayoutManager(requireContext()));

setupView();

return view;
return binding.getRoot();
}

@Override
Expand Down Expand Up @@ -216,9 +215,7 @@ private void setupView() {
private void disableSearchView(View view) {
view.setEnabled(false);

if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;

if (view instanceof ViewGroup viewGroup) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
disableSearchView(viewGroup.getChildAt(i));
}
Expand Down Expand Up @@ -302,7 +299,7 @@ public void copyLink(OCShare share) {
if (TextUtils.isEmpty(share.getShareLink())) {
fileOperationsHelper.getFileWithLink(file, viewThemeUtils);
} else {
ClipboardUtil.copyToClipboard(getActivity(), share.getShareLink());
ClipboardUtil.copyToClipboard(requireActivity(), share.getShareLink());
}
}
}
Expand Down Expand Up @@ -496,7 +493,7 @@ private boolean isReshareForbidden(OCShare share) {

@VisibleForTesting
public void search(String query) {
SearchView searchView = getView().findViewById(R.id.searchView);
SearchView searchView = requireView().findViewById(R.id.searchView);
searchView.setQuery(query, true);
}

Expand Down

0 comments on commit ee08d6a

Please sign in to comment.