openaphid/android-flip

Compression of FlipView layouts during flipping animation

weepctxb opened this issue · 2 comments

I'm encountering problems with a filtered version of the FlipView layout compressing into half when flipping. My layout consists of a toolbar and the FlipView. (I am only using vertical flipping animation)
The structure of my xml layout file is this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/flipview"
    tools:context=".MainActivity" >

    <android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:elevation="4dp"
        android:background="@color/color_primary"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        tools:ignore="UnusedAttribute" />

    <com.aphidmobile.flip.FlipViewController
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/flipview"
        android:layout_below="@id/toolbar" />

    <!-- Empty View -->
    <TextView
        android:id="@+id/empty"
        ...
         />
</RelativeLayout>

I have added a search filter to the FlipView by adapting the code largely based on this tutorial (http://www.survivingwithandroid.com/2012/10/android-listview-custom-filter-and.html).
When the FlipView is not filtered the flipping works fine, the compression only happens when the FlipView is filtered (though not all the time). After a few instances of flipping back and forth the problem disappears.

The normal behaviour would be that the cards will flip at an axis halfway along the FlipView container (excluding the toolbar).
The exact problem is this:

  1. The list of items in the FlipView is filtered (correctly) using the Android search widget in the toolbar menu. (Unlike the demos given, my adapter for the FlipView is separated into an adapter class which contains the filtering operation as well.)
  2. On touching the screen, the FlipView layout is compressed to half the height of the app screen (i.e. the height of the FlipView + the height of the toolbar), and the flipping occurs at an axis halfway along the compressed area's height.
  3. After dragging halfway, the next card's flipping animation comes into view (this animation of the next card works correctly, i.e. axis is halfway along FlipView and height of animation is also half of the FlipView).

I have tested my app on multiple devices (Galaxy S3 to S6) and realised that this problem only occurs for devices using Android API level >=22 (i.e. Android version 5.1.1), no issue for devices using older Android API levels.
My initial suspicion was the usage of the elevation attribute in the toolbar widget (as it was only introduced from API level 21 onwards), but removing the code does not resolve the problem.

Is there anything that I may have missed out or can fix in the activity layout or the library source code (or anywhere else)?

It appears that the issue might have been resolved by setting a loading view for the WebView (currently its height and width are set to match parent), because I only did that and somehow I can no longer reproduce the error. Will close if it no longer appears after a week or two.

Closed issue on 19 Feb 2016, resolve the titled problem using the above-mentioned steps.