diff --git a/scripts/analysis/lint-results.txt b/scripts/analysis/lint-results.txt index 9a13c695df..bf24c5db3f 100644 --- a/scripts/analysis/lint-results.txt +++ b/scripts/analysis/lint-results.txt @@ -1,2 +1,2 @@ DO NOT TOUCH; GENERATED BY DRONE - Lint Report: 91 warnings + Lint Report: 85 warnings diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java index 097008b887..f594064466 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -49,7 +49,6 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; -import android.widget.RelativeLayout; import android.widget.TextView; import com.caverock.androidsvg.SVG; @@ -115,7 +114,6 @@ public class PreviewImageFragment extends FileFragment implements Injectable { private static final String MIME_TYPE_SVG = "image/svg+xml"; private PhotoView mImageView; - private RelativeLayout mMultiView; private LinearLayout mMultiListContainer; private TextView mMultiListMessage; @@ -206,8 +204,6 @@ public class PreviewImageFragment extends FileFragment implements Injectable { mImageView.setOnClickListener(v -> togglePreviewImageFullScreen()); - mMultiView = view.findViewById(R.id.multi_view); - setupMultiView(view); setMultiListLoadingMessage(); @@ -298,7 +294,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { task.execute(getFile()); } } - mMultiView.setVisibility(View.GONE); + mMultiListContainer.setVisibility(View.GONE); mImageView.setBackgroundColor(getResources().getColor(R.color.background_color_inverse)); mImageView.setVisibility(View.VISIBLE); @@ -651,7 +647,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { } } - mMultiView.setVisibility(View.GONE); + mMultiListContainer.setVisibility(View.GONE); if (getResources() != null) { mImageView.setBackgroundColor(getResources().getColor(R.color.background_color_inverse)); } @@ -712,7 +708,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { } private void setMultiListLoadingMessage() { - if (mMultiView != null) { + if (mMultiListContainer != null) { mMultiListHeadline.setText(R.string.file_list_loading); mMultiListMessage.setText(""); @@ -727,7 +723,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { mMultiListMessage.setText(message); mMultiListIcon.setImageResource(icon); - mMultiView.setBackgroundColor(getResources().getColor(R.color.background_color_inverse)); + mMultiListContainer.setBackgroundColor(getResources().getColor(R.color.background_color_inverse)); mMultiListHeadline.setTextColor(getResources().getColor(R.color.standard_grey)); mMultiListMessage.setTextColor(getResources().getColor(R.color.standard_grey)); @@ -740,7 +736,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { public void setErrorPreviewMessage() { try { if (getActivity() != null) { - Snackbar.make(mMultiView, + Snackbar.make(mMultiListContainer, R.string.resized_image_not_possible_download, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.common_yes, v -> { @@ -748,14 +744,16 @@ public class PreviewImageFragment extends FileFragment implements Injectable { if (activity != null) { activity.requestForDownload(getFile()); } else { - Snackbar.make(mMultiView, + Snackbar.make(mMultiListContainer, getResources().getString(R.string.could_not_download_image), Snackbar.LENGTH_INDEFINITE).show(); } } ).show(); } else { - Snackbar.make(mMultiView, R.string.resized_image_not_possible, Snackbar.LENGTH_INDEFINITE).show(); + Snackbar.make(mMultiListContainer, + R.string.resized_image_not_possible, + Snackbar.LENGTH_INDEFINITE).show(); } } catch (IllegalArgumentException e) { Log_OC.d(TAG, e.getMessage()); @@ -764,7 +762,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable { public void setNoConnectionErrorMessage() { try { - Snackbar.make(mMultiView, R.string.auth_no_net_conn_title, Snackbar.LENGTH_LONG).show(); + Snackbar.make(mMultiListContainer, R.string.auth_no_net_conn_title, Snackbar.LENGTH_LONG).show(); } catch (IllegalArgumentException e) { Log_OC.d(TAG, e.getMessage()); } diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 5484f18895..2badb1550b 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -112,7 +112,6 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene private VideoView mVideoPreview; private int mSavedPlaybackPosition; - private RelativeLayout mMultiView; private RelativeLayout mPreviewContainer; private LinearLayout mMultiListContainer; @@ -197,7 +196,6 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene mVideoPreview.setOnTouchListener(this); mMediaController = view.findViewById(R.id.media_controller); - mMultiView = view.findViewById(R.id.multi_view); setupMultiView(view); setMultiListLoadingMessage(); @@ -213,7 +211,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene } private void setMultiListLoadingMessage() { - if (mMultiView != null) { + if (mMultiListContainer != null) { mMultiListHeadline.setText(R.string.file_list_loading); mMultiListMessage.setText(""); @@ -323,7 +321,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene mMediaController.setMediaPlayer(mMediaPlayerServiceConnection); mMediaPlayerServiceConnection.bind(); mMediaPlayerServiceConnection.start(mAccount, file, mAutoplay, mSavedPlaybackPosition); - mMultiView.setVisibility(View.GONE); + mMultiListContainer.setVisibility(View.GONE); mPreviewContainer.setVisibility(View.VISIBLE); } else if (MimeTypeUtil.isVideo(file)) { stopAudio(); @@ -337,7 +335,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene } @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.removeItem(R.id.action_search); inflater.inflate(R.menu.item_file, menu); @@ -525,10 +523,10 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene previewMediaFragment.mVideoUri = uri; previewMediaFragment.mVideoPreview.setVideoURI(uri); } else { - previewMediaFragment.mMultiView.setVisibility(View.VISIBLE); + previewMediaFragment.mMultiListContainer.setVisibility(View.VISIBLE); previewMediaFragment.setMessageForMultiList( - previewMediaFragment.getString(R.string.stream_not_possible_headline), - R.string.stream_not_possible_message, R.drawable.file_movie); + previewMediaFragment.getString(R.string.stream_not_possible_headline), + R.string.stream_not_possible_message, R.drawable.file_movie); } } else { Log_OC.e(TAG, "Error streaming file: no previewMediaFragment!"); @@ -548,7 +546,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene @Override public void onPrepared(MediaPlayer vp) { Log_OC.v(TAG, "onPrepared"); - mMultiView.setVisibility(View.GONE); + mMultiListContainer.setVisibility(View.GONE); mPreviewContainer.setVisibility(View.VISIBLE); mVideoPreview.seekTo(mSavedPlaybackPosition); if (mAutoplay) { @@ -590,7 +588,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene final Context context = getActivity(); if (mVideoPreview.getWindowToken() != null && context != null) { String message = ErrorFormat.toString(context, what, extra); - mMultiView.setVisibility(View.VISIBLE); + mMultiListContainer.setVisibility(View.VISIBLE); setMessageForMultiList(message, R.string.preview_sorry, R.drawable.file_movie); } return true; @@ -648,7 +646,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene } @Override - public void onConfigurationChanged(Configuration newConfig) { + public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); Log_OC.v(TAG, "onConfigurationChanged " + this); } @@ -710,15 +708,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene return mSavedPlaybackPosition; } - public boolean isPlaying() { - if (mPrepared) { - mAutoplay = mVideoPreview.isPlaying(); - } - return mAutoplay; - } - private void toggleDrawerLockMode(ContainerActivity containerActivity, int lockMode) { ((DrawerActivity) containerActivity).setDrawerLockMode(lockMode); } - } diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java index 6c7e07837c..46c5287eac 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFileFragment.java @@ -227,8 +227,8 @@ public class PreviewTextFileFragment extends PreviewTextFragment { textView.setVisibility(View.VISIBLE); } - if (mMultiView != null) { - mMultiView.setVisibility(View.GONE); + if (mMultiListContainer != null) { + mMultiListContainer.setVisibility(View.GONE); } } } diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java index 112f861e75..05b5f1e2c7 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java @@ -34,7 +34,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; -import android.widget.RelativeLayout; import android.widget.TextView; import com.nextcloud.client.account.UserAccountManager; @@ -86,8 +85,8 @@ public abstract class PreviewTextFragment extends FileFragment implements Search protected boolean mSearchOpen; protected TextView mTextPreview; protected Handler mHandler; - protected RelativeLayout mMultiView; protected String mOriginalText; + protected View mMultiListContainer; private TextView mMultiListMessage; private TextView mMultiListHeadline; @@ -109,8 +108,6 @@ public abstract class PreviewTextFragment extends FileFragment implements Search View ret = inflater.inflate(R.layout.text_file_preview, container, false); mTextPreview = ret.findViewById(R.id.text_preview); - mMultiView = ret.findViewById(R.id.multi_view); - setupMultiView(ret); setMultiListLoadingMessage(); @@ -118,6 +115,7 @@ public abstract class PreviewTextFragment extends FileFragment implements Search } private void setupMultiView(View view) { + mMultiListContainer = view.findViewById(R.id.empty_list_view); mMultiListMessage = view.findViewById(R.id.empty_list_view_text); mMultiListHeadline = view.findViewById(R.id.empty_list_view_headline); mMultiListIcon = view.findViewById(R.id.empty_list_icon); @@ -125,7 +123,7 @@ public abstract class PreviewTextFragment extends FileFragment implements Search } private void setMultiListLoadingMessage() { - if (mMultiView != null) { + if (mMultiListContainer != null) { mMultiListHeadline.setText(R.string.file_list_loading); mMultiListMessage.setText(""); @@ -219,7 +217,7 @@ public abstract class PreviewTextFragment extends FileFragment implements Search * Finishes the preview */ protected void finish() { - getActivity().runOnUiThread(() -> getActivity().onBackPressed()); + requireActivity().runOnUiThread(() -> requireActivity().onBackPressed()); } public static void setText(TextView textView, String text, OCFile file, Activity activity) { diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java index 306909bd56..b723c7ce93 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewTextStringFragment.java @@ -147,8 +147,8 @@ public class PreviewTextStringFragment extends PreviewTextFragment { mTextPreview.setVisibility(View.VISIBLE); } - if (mMultiView != null) { - mMultiView.setVisibility(View.GONE); + if (mMultiListContainer != null) { + mMultiListContainer.setVisibility(View.GONE); } } diff --git a/src/main/res/layout/empty_list.xml b/src/main/res/layout/empty_list.xml index 749d8064b6..9e14beb902 100644 --- a/src/main/res/layout/empty_list.xml +++ b/src/main/res/layout/empty_list.xml @@ -1,5 +1,4 @@ - - - - - + android:visibility="gone" /> @@ -75,15 +65,14 @@ android:paddingTop="@dimen/standard_half_padding" android:paddingBottom="@dimen/standard_half_padding" android:text="@string/file_list_empty" - android:visibility="gone"/> + android:visibility="gone" /> - + android:theme="@style/Button.Primary" + android:visibility="gone" + app:cornerRadius="@dimen/button_corner_radius" /> diff --git a/src/main/res/layout/file_preview.xml b/src/main/res/layout/file_preview.xml index 0f1bd40bf0..483594e868 100644 --- a/src/main/res/layout/file_preview.xml +++ b/src/main/res/layout/file_preview.xml @@ -3,7 +3,7 @@ ownCloud Android client application Copyright (C) 2015 ownCloud Inc. - + 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. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - + --> + android:layout_margin="@dimen/standard_margin" /> - - - - - - - + + - \ No newline at end of file + diff --git a/src/main/res/layout/grid_image.xml b/src/main/res/layout/grid_image.xml index a91e06193c..f65f371288 100644 --- a/src/main/res/layout/grid_image.xml +++ b/src/main/res/layout/grid_image.xml @@ -15,7 +15,7 @@ along with this program. If not, see . --> - - + android:layout_height="match_parent" + android:layout_margin="@dimen/grid_image_icon_margin" + android:contentDescription="@null" + android:visibility="gone" + app:corners="6" + app:height_weight="0.6" + app:width_weight="0.4" /> - + - + - + - + - + - - - - - - + + diff --git a/src/main/res/layout/preview_image_fragment.xml b/src/main/res/layout/preview_image_fragment.xml index a140ffa3d9..69d7f60f6d 100644 --- a/src/main/res/layout/preview_image_fragment.xml +++ b/src/main/res/layout/preview_image_fragment.xml @@ -34,20 +34,11 @@ android:contentDescription="@string/preview_image_description" android:src="@drawable/image_fail" /> - - - - - - - - - + + diff --git a/src/main/res/layout/text_file_preview.xml b/src/main/res/layout/text_file_preview.xml index e072674a9c..7412aa8d32 100644 --- a/src/main/res/layout/text_file_preview.xml +++ b/src/main/res/layout/text_file_preview.xml @@ -39,22 +39,15 @@ android:visibility="gone" tools:visibility="visible" tools:maxLength="40" - tools:text="@tools:sample/lorem/random"/> + tools:text="@tools:sample/lorem/random" /> - - - - - - - + +