Browse Source

add loading shimmer for preview image

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
pull/6757/head
Andy Scherzinger 6 months ago
parent
commit
a2f0d81c21
No known key found for this signature in database GPG Key ID: 6CADC7E3523C308B
  1. 1
      drawable_resources/ic_image-outline.svg
  2. 11
      src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
  3. 8
      src/main/res/drawable/ic_image_outline.xml
  4. 81
      src/main/res/layout/preview_image_fragment.xml

1
drawable_resources/ic_image-outline.svg

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>

11
src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java

@ -46,6 +46,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -117,6 +118,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
private TextView mMultiListMessage;
private TextView mMultiListHeadline;
private ImageView mMultiListIcon;
private FrameLayout mMultiListProgress;
private Boolean showResizedImage;
@ -216,6 +218,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
multiListMessage = binding.emptyList.emptyListViewText;
multiListHeadline = binding.emptyList.emptyListViewHeadline;
multiListIcon = binding.emptyList.emptyListIcon;
mMultiListProgress = view.findViewById(R.id.empty_list_progress);
}
/**
@ -699,11 +702,12 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
}
private void setMultiListLoadingMessage() {
if (multiListContainer != null) {
multiListHeadline.setText(R.string.file_list_loading);
multiListMessage.setText("");
if (mMultiListContainer != null) {
mMultiListHeadline.setText("");
mMultiListMessage.setText("");
mMultiListIcon.setVisibility(View.GONE);
mMultiListProgress.setVisibility(View.VISIBLE);
}
}
@ -719,6 +723,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
mMultiListMessage.setVisibility(View.VISIBLE);
mMultiListIcon.setVisibility(View.VISIBLE);
mMultiListProgress.setVisibility(View.GONE);
}
}

8
src/main/res/drawable/ic_image_outline.xml

@ -0,0 +1,8 @@
<!-- drawable/image_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" />
</vector>

81
src/main/res/layout/preview_image_fragment.xml

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
ownCloud Android client application
Copyright (C) 2015 ownCloud Inc.
@ -19,6 +18,7 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -33,7 +33,78 @@
android:contentDescription="@string/preview_image_description"
android:src="@drawable/image_fail" />
<include
android:id="@+id/emptyList"
layout="@layout/empty_list" />
<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"
android:paddingBottom="@dimen/standard_double_margin">
<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" />
<FrameLayout
android:id="@+id/empty_list_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone">
<com.elyeproj.loaderviewlibrary.LoaderImageView
android:layout_width="@dimen/empty_list_icon_layout_width"
android:layout_height="@dimen/empty_list_icon_layout_width"
android:layout_gravity="center_horizontal"
android:contentDescription="@null"
app:corners="24" />
<ImageView
android:layout_width="@dimen/empty_list_icon_layout_width"
android:layout_height="@dimen/empty_list_icon_layout_height"
android:contentDescription="@null"
android:src="@drawable/ic_image_outline"
app:tint="@color/fg_inverse" />
</FrameLayout>
<TextView
android:id="@+id/empty_list_view_headline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingTop="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding"
android:text="@string/file_list_loading"
android:textSize="26sp" />
<TextView
android:id="@+id/empty_list_view_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:gravity="center"
android:paddingTop="@dimen/standard_half_padding"
android:paddingBottom="@dimen/standard_half_padding"
android:text="@string/file_list_empty"
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:layout_marginTop="@dimen/standard_half_margin"
android:theme="@style/Button.Primary"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>
</RelativeLayout>
Loading…
Cancel
Save