Merge pull request #6347 from nextcloud/uselessParent

Remove useless parents
This commit is contained in:
Andy Scherzinger 2020-06-24 23:15:04 +02:00 committed by GitHub
commit 01d9d2e437
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 117 additions and 172 deletions

View file

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 91 warnings</span>
<span class="mdl-layout-title">Lint Report: 85 warnings</span>

View file

@ -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());
}

View file

@ -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);
}
}

View file

@ -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);
}
}
}

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Nextcloud Android client application
Copyright (C) 2016 Andy Scherzinger
@ -20,6 +19,7 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/empty_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -28,23 +28,13 @@
android:orientation="vertical"
android:paddingBottom="@dimen/standard_double_margin">
<!-- This can be removed once we switched to view data implementation -->
<LinearLayout
android:id="@+id/empty_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/standard_margin"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/empty_list_icon"
android:layout_width="@dimen/empty_list_icon_layout_width"
android:layout_height="@dimen/empty_list_icon_layout_height"
android:contentDescription="@string/file_list_folder"
android:src="@drawable/ic_list_empty_folder"
android:visibility="gone"/>
android:visibility="gone" />
<ProgressBar
android:id="@+id/empty_list_progress"
@ -60,8 +50,8 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingBottom="@dimen/standard_half_padding"
android:paddingTop="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding"
android:text="@string/file_list_loading"
android:textSize="26sp" />
@ -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" />
<com.google.android.material.button.MaterialButton
android:id="@+id/empty_list_view_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/Button.Primary"
app:cornerRadius="@dimen/button_corner_radius"
android:layout_marginTop="@dimen/standard_half_margin"
android:visibility="gone"/>
</LinearLayout>
android:theme="@style/Button.Primary"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>

View file

@ -65,24 +65,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/standard_margin"
/>
android:layout_margin="@dimen/standard_margin" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/multi_view"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/empty_list"/>
</ScrollView>
</RelativeLayout>
<include layout="@layout/empty_list" />
</ScrollView>
</RelativeLayout>

View file

@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ListItemLayout"
android:layout_width="match_parent"
@ -25,82 +25,76 @@
android:gravity="center_horizontal"
android:orientation="vertical">
<FrameLayout
<com.elyeproj.loaderviewlibrary.LoaderImageView
android:id="@+id/thumbnail_shimmer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
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" />
<com.elyeproj.loaderviewlibrary.LoaderImageView
android:id="@+id/thumbnail_shimmer"
android:layout_width="match_parent"
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" />
<com.owncloud.android.ui.SquareImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:padding="@dimen/grid_image_icon_padding"
android:scaleType="centerCrop"
android:src="@drawable/folder" />
<com.owncloud.android.ui.SquareImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:padding="@dimen/grid_image_icon_padding"
android:scaleType="centerCrop"
android:src="@drawable/folder" />
<ImageView
android:id="@+id/favorite_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="@dimen/standard_quarter_margin"
android:contentDescription="@string/favorite_icon"
android:src="@drawable/favorite" />
<ImageView
android:id="@+id/favorite_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="@dimen/standard_quarter_margin"
android:contentDescription="@string/favorite_icon"
android:src="@drawable/favorite"/>
<ImageView
android:id="@+id/sharedIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:contentDescription="@string/shared_icon_shared_via_link"
android:src="@drawable/shared_via_link" />
<ImageView
android:id="@+id/sharedIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
android:contentDescription="@string/shared_icon_shared_via_link"
android:src="@drawable/shared_via_link" />
<ImageView
android:id="@+id/unreadComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:clickable="true"
android:contentDescription="@string/unread_comments"
android:focusable="true"
android:src="@drawable/ic_comment_grid"
android:visibility="gone" />
<ImageView
android:id="@+id/unreadComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
android:clickable="true"
android:contentDescription="@string/unread_comments"
android:focusable="true"
android:src="@drawable/ic_comment_grid"
android:visibility="gone" />
<ImageView
android:id="@+id/localFileIndicator"
android:layout_width="@dimen/grid_image_local_file_indicator_layout_width"
android:layout_height="@dimen/grid_image_local_file_indicator_layout_height"
android:layout_gravity="bottom|end"
android:layout_marginTop="@dimen/standard_quarter_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginBottom="@dimen/standard_quarter_margin"
android:contentDescription="@string/synced_icon"
android:src="@drawable/ic_synced" />
<ImageView
android:id="@+id/localFileIndicator"
android:layout_width="@dimen/grid_image_local_file_indicator_layout_width"
android:layout_height="@dimen/grid_image_local_file_indicator_layout_height"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/standard_quarter_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginTop="@dimen/standard_quarter_margin"
android:contentDescription="@string/synced_icon"
android:src="@drawable/ic_synced" />
<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|top"
android:layout_marginLeft="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/checkbox"
android:src="@android:drawable/checkbox_off_background" />
</FrameLayout>
</LinearLayout>
<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|top"
android:layout_marginLeft="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/checkbox"
android:src="@android:drawable/checkbox_off_background" />
</FrameLayout>

View file

@ -34,20 +34,11 @@
android:contentDescription="@string/preview_image_description"
android:src="@drawable/image_fail" />
<RelativeLayout
android:id="@+id/multi_view"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/empty_list"/>
</ScrollView>
</RelativeLayout>
<include layout="@layout/empty_list" />
</ScrollView>
</RelativeLayout>

View file

@ -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" />
<RelativeLayout
android:id="@+id/multi_view"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/empty_list" />
</ScrollView>
</RelativeLayout>
<include layout="@layout/empty_list" />
</ScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>