loupe icon indicating copy to clipboard operation
loupe copied to clipboard

fix: Loupe shouldn't crash when container ViewGroup has no background

Open eddiemuc opened this issue 2 years ago • 0 comments

Currently Loupe crashes if the container viewgroup for the "loupenized" image has no background set.

To reproduce this:

  • Go to layout file item_image.xml in loupe sample (https://github.com/igreenwood/loupe/blob/master/loupe-sample/src/main/res/layout/item_image.xml)
  • Remove line android:background="@color/black_alpha_87" in container ViewGroup (see below)
  • Start sample app and click on any image
  • -> app will crash

This PR will fix this issue

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/black_alpha_87"  <!-- REMOVE THIS LINE TO REPRODUCE THE BUG IN LOUPE-SAMPLE--> 
        >
        <ImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </FrameLayout>
</layout>

eddiemuc avatar May 01 '22 09:05 eddiemuc