Skip to content

Commit 43466a4

Browse files
authored
Merge pull request #3644 from owncloud/fix/corrupt_picture
Corrupt picture error controlled
2 parents 29fb60e + 70d804d commit 43466a4

5 files changed

Lines changed: 70 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Summary
1212
* Bugfix - Crash when changing orientation in Details view: [#3571](https://github.com/owncloud/android/issues/3571)
1313
* Bugfix - Lock displays shown again: [#3591](https://github.com/owncloud/android/issues/3591)
1414
* Bugfix - Prevented signed in user in the list of users to be shared: [#1419](https://github.com/owncloud/android/issues/1419)
15+
* Bugfix - Corrupt picture error controlled: [#3441](https://github.com/owncloud/android/issues/3441)
1516
* Enhancement - First steps in Android Enterprise integration: [#3415](https://github.com/owncloud/android/issues/3415)
1617
* Enhancement - Lock delay enforced: [#3440](https://github.com/owncloud/android/issues/3440)
1718
* Enhancement - Provide app feedback to MDM admins: [#3420](https://github.com/owncloud/android/issues/3420)
@@ -64,6 +65,14 @@ Details
6465
https://github.com/owncloud/android/issues/1419
6566
https://github.com/owncloud/android/pull/3643
6667

68+
* Bugfix - Corrupt picture error controlled: [#3441](https://github.com/owncloud/android/issues/3441)
69+
70+
Previously, If a file is not correct or is damaged, it is downloaded but not previewed. An
71+
infinite spinner on a black window is shown instead. Now, an error appears warning to the user.
72+
73+
https://github.com/owncloud/android/issues/3441
74+
https://github.com/owncloud/android/pull/3644
75+
6776
* Enhancement - First steps in Android Enterprise integration: [#3415](https://github.com/owncloud/android/issues/3415)
6877

6978
Two parameters (server url and server url input visibility) can be now managed via MDM. These

changelog/unreleased/3644

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Bugfix: Corrupt picture error controlled
2+
3+
Previously, If a file is not correct or is damaged,
4+
it is downloaded but not previewed.
5+
An infinite spinner on a black window is shown instead.
6+
Now, an error appears warning to the user.
7+
8+
https://github.com/owncloud/android/issues/3441
9+
https://github.com/owncloud/android/pull/3644

owncloudApp/src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ class PreviewImageFragment : FileFragment() {
320320
override fun onLoadFailed(
321321
e: GlideException?, model: Any, target: Target<Drawable?>, isFirstResource: Boolean
322322
): Boolean {
323+
binding.errorGroup.isVisible = true
323324
Timber.e(e, "Error loading image")
324325
return false
325326
}

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

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,80 @@
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
1818
-->
19-
20-
<!--
21-
ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
22-
android:id="@+id/fdScrollView"
23-
android:layout_width="fill_parent"
24-
android:layout_height="fill_parent"
25-
android:background="@color/background_color"
26-
android:gravity="center_horizontal"
27-
-->
28-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
19+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
20+
xmlns:app="http://schemas.android.com/apk/res-auto"
2921
xmlns:tools="http://schemas.android.com/tools"
3022
android:id="@+id/top"
3123
android:layout_width="match_parent"
3224
android:layout_height="match_parent"
3325
android:background="#000000"
34-
tools:context=".ui.preview.PreviewImageFragment"
3526
android:filterTouchesWhenObscured="true"
36-
>
27+
tools:context=".ui.preview.PreviewImageFragment">
3728

3829
<ProgressBar
3930
android:id="@+id/progressWheel"
4031
android:layout_width="wrap_content"
4132
android:layout_height="wrap_content"
4233
android:indeterminate="true"
4334
android:indeterminateOnly="true"
44-
android:layout_centerInParent="true"
45-
/>
35+
app:layout_constraintBottom_toBottomOf="parent"
36+
app:layout_constraintLeft_toLeftOf="parent"
37+
app:layout_constraintRight_toRightOf="parent"
38+
app:layout_constraintTop_toTopOf="parent" />
39+
40+
<ImageView
41+
android:id="@+id/error_image"
42+
android:layout_width="wrap_content"
43+
android:layout_height="wrap_content"
44+
android:contentDescription="@string/downloader_preview_failed_ticker"
45+
android:src="@drawable/image_fail"
46+
app:layout_constraintLeft_toLeftOf="parent"
47+
app:layout_constraintRight_toRightOf="parent"
48+
app:layout_constraintTop_toTopOf="parent"
49+
app:layout_constraintBottom_toBottomOf="parent"/>
50+
51+
<TextView
52+
android:id="@+id/errorText"
53+
android:layout_width="0dp"
54+
android:layout_height="wrap_content"
55+
android:layout_margin="40dp"
56+
android:gravity="center"
57+
android:text="@string/downloader_preview_failed_ticker"
58+
android:textColor="@color/dark_background_text_color"
59+
app:layout_constraintLeft_toLeftOf="parent"
60+
app:layout_constraintRight_toRightOf="parent"
61+
app:layout_constraintTop_toBottomOf="@id/error_image" />
4662

4763
<com.github.chrisbanes.photoview.PhotoView
4864
android:id="@+id/photo_view"
49-
android:layout_width="match_parent"
50-
android:layout_height="match_parent" />
65+
android:layout_width="0dp"
66+
android:layout_height="0dp"
67+
app:layout_constraintBottom_toBottomOf="parent"
68+
app:layout_constraintLeft_toLeftOf="parent"
69+
app:layout_constraintRight_toRightOf="parent"
70+
app:layout_constraintTop_toTopOf="parent" />
5171

5272
<TextView
5373
android:id="@+id/message"
54-
android:layout_width="wrap_content"
74+
android:layout_width="0dp"
5575
android:layout_height="wrap_content"
56-
android:layout_centerHorizontal="true"
57-
android:layout_alignParentBottom="true"
5876
android:layout_margin="40dp"
77+
android:gravity="center"
5978
android:text="@string/placeholder_sentence"
6079
android:textColor="@color/owncloud_blue_bright"
61-
/>
80+
app:layout_constraintBottom_toBottomOf="parent"
81+
app:layout_constraintLeft_toLeftOf="parent"
82+
app:layout_constraintRight_toRightOf="parent" />
6283

6384
<!-- last to draw, will be top in Z axis -->
6485
<include layout="@layout/top_progress_bar" />
6586

66-
</RelativeLayout>
87+
<androidx.constraintlayout.widget.Group
88+
tools:visibility="visible"
89+
android:id="@+id/error_group"
90+
android:layout_width="wrap_content"
91+
android:layout_height="wrap_content"
92+
android:visibility="gone"
93+
app:constraint_referenced_ids="error_image,errorText" />
94+
95+
</androidx.constraintlayout.widget.ConstraintLayout>

owncloudApp/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@
241241
<string name="downloader_download_succeeded_ticker">Download succeeded</string>
242242
<string name="downloader_download_succeeded_content">%1$s downloaded</string>
243243
<string name="downloader_download_failed_ticker">Download failed</string>
244+
<string name="downloader_preview_failed_ticker">Unable to display the file</string>
244245
<string name="downloader_download_failed_content">Download of %1$s could not be completed</string>
245246
<string name="downloader_not_downloaded_yet">Not downloaded yet</string>
246247
<string name="downloader_download_failed_credentials_error">Download failed, you need to log in again</string>

0 commit comments

Comments
 (0)