Combine Ifs

This commit is contained in:
Mario Danic 2017-01-24 01:48:25 +01:00 committed by AndyScherzinger
parent 9cf274e1ca
commit 90ce5fcea1
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -3,19 +3,18 @@
*
* @author David A. Velasco
* Copyright (C) 2015 ownCloud Inc.
*
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.ui.preview;
@ -123,7 +122,6 @@ public class PreviewImageFragment extends FileFragment {
}
/**
* Creates an empty fragment for image previews.
*
@ -181,10 +179,10 @@ public class PreviewImageFragment extends FileFragment {
}
});
mMultiView = (RelativeLayout) view.findViewById(R.id.multi_view);
setupMultiView(view);
setMultiListLoadingMessage();
mMessageView = (TextView) view.findViewById(R.id.message);
mMessageView.setVisibility(View.GONE);
mProgressWheel = (ProgressBar) view.findViewById(R.id.progressWheel);
mProgressWheel.setVisibility(View.VISIBLE);
return view;
}
@ -619,10 +617,9 @@ public class PreviewImageFragment extends FileFragment {
}
private void toggleImageBackground() {
if (getFile() != null && getFile().getMimetype().equalsIgnoreCase("image/png")) {
if (getActivity() != null && (getActivity() instanceof PreviewImageActivity)) {
if (getFile() != null && getFile().getMimetype().equalsIgnoreCase("image/png") && getActivity() != null
&& getActivity() instanceof PreviewImageActivity && getResources() != null) {
PreviewImageActivity previewImageActivity = (PreviewImageActivity) getActivity();
if (getResources() != null) {
LayerDrawable layerDrawable = (LayerDrawable) mImageView.getDrawable();
Drawable layerOne;
@ -637,9 +634,6 @@ public class PreviewImageFragment extends FileFragment {
mImageView.setImageDrawable(layerDrawable);
}
}
}
}
private static float convertDpToPixel(float dp, Context context) {