Custom Visibility Converter - Android - Release (MvvmCross)

I have developed an android app using MvvmCross. There is a part where it should show either ImageView or MvxImageView. When I test it in debug mode it works fine, but when I change it to release mode the visibility converter seems to stop working. All other converters work as they should, only those converters stop working.

summary from my xml:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="vertical">
    <ImageView
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:scaleType="fitCenter"
        local:MvxBind="Visibility MyObject, Converter=ByteInverseVisibility; AssetImagePath MyObject, Converter=AttachmentTypeToSource" />
    <Mvx.MvxImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:maxHeight="150dp"
        android:adjustViewBounds="true"
        local:MvxBind="Visibility MyObject, Converter=ByteVisibility; Bitmap MyObject.Attachment, Converter=InMemoryImage" />
</LinearLayout>

      

Converters:

public class ByteVisibilityConverter : MvxBaseVisibilityValueConverter<MyObjectClass>
{
    protected override MvxVisibility Convert(MyObjectClass value, object parameter, CultureInfo culture)
    {
        if (value.AttachType == AttachmentType.Photo && value.Attachment != null)
        {
            return MvxVisibility.Visible;
        }

        return MvxVisibility.Collapsed;
    }
}

public class ByteInverseVisibilityConverter : MvxBaseVisibilityValueConverter<MyObjectClass>
{
    protected override MvxVisibility Convert(MyObjectClassvalue, object parameter, CultureInfo culture)
    {
        if (value.AttachType != AttachmentType.Photo || value.Attachment == null)
        {
            return MvxVisibility.Visible;
        }

        return MvxVisibility.Collapsed;
    }
}

      

+3


source to share


1 answer


The reason is that the Visibility property is not included in the package.

You should add something like:



public void Include(ImageView imageView)
    {
        imageView.Visibility = imageView.imageView;
    }

      

In the LinkerPleaseInclude.cs file.

+4


source







All Articles