Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I disable the animation added due to issue #89? #145

Closed
abhijitvalluri opened this issue Sep 26, 2016 · 6 comments
Closed

Can I disable the animation added due to issue #89? #145

abhijitvalluri opened this issue Sep 26, 2016 · 6 comments
Assignees
Milestone

Comments

@abhijitvalluri
Copy link

I noticed you added an animation in release 1.5.8, in response to issue #89, to make the contents of the slide gracefully expand when the next slide does not have a button. This is adding some movement to the text/images in my slides whereas in Release 1.5.5, I had no jumping problem as mentioned in #89. Perhaps because I am using a custom layout for the SimpleSlide. Can I disable the animations so that text/images don't appear to be changing in size when I change to a slide without a button?

@heinrichreimer
Copy link
Owner

You can't disable the animation. This library really focusses on material guidelines and material motion. The button, a sheet if you spoke as in the material docs, can't appear immediately but instead has to be animated in. Before this change the appearance of the button caused a glitch whenever you slide from and to a button slide.
You can fix that problem by optimizing your layout. As the width would never change the only thing to keep in mind is that the height can vary a bit. I can help you with the layout if you want.

@abhijitvalluri
Copy link
Author

Thanks for the response. If you can give me some guidance on how to setup the layout that would be helpful. I am in fact using a custom layout file for each slide, both SimpleSlide's and FragmentSlide's. I can provide the resource file later in the day as I don't have my personal PC with me now.

@heinrichreimer
Copy link
Owner

Yeah that'd come in handy.

@abhijitvalluri
Copy link
Author

I have two layouts, one for portrait and the other for landscape mode. I used the ID's for the views that you used in the library.

Portrait:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:padding="@dimen/activity_padding">

<ImageView
    android:id="@+id/mi_image"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="2"
    android:layout_marginBottom="@dimen/activity_vertical_margin"
    android:gravity="center"
    tools:ignore="ContentDescription"
    tools:src="@android:drawable/sym_action_call"/>

<TextView
    android:id="@+id/mi_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="@style/TextAppearance.AppCompat.Headline"
    android:fontFamily="sans-serif-medium"
    tools:ignore="UnusedAttribute"
    tools:text="Lorem ipsum"/>

<TextView
    android:id="@+id/mi_description"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/activity_vertical_margin"
    android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
    tools:text="Lorem ipsum dolor sit amet, consectetur, adipisci velit, …"/>

<Space
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_gravity="center_horizontal"/>

And the landscape orientation:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:padding="@dimen/activity_padding">

<ImageView
    android:id="@+id/mi_image"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_marginEnd="@dimen/activity_vertical_margin"
    android:gravity="center"
    tools:ignore="ContentDescription"
    tools:src="@android:drawable/sym_action_call"/>

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="2"
    android:orientation="vertical"
    android:gravity="center"
    android:padding="@dimen/activity_padding">
    <TextView
        android:id="@+id/mi_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
        android:fontFamily="sans-serif-medium"
        tools:ignore="UnusedAttribute"
        tools:text="Lorem ipsum"/>

    <TextView
        android:id="@+id/mi_description"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
        tools:text="Lorem ipsum dolor sit amet, consectetur, adipisci velit, …"/>
</LinearLayout>

@heinrichreimer heinrichreimer self-assigned this Oct 7, 2016
@heinrichreimer heinrichreimer added this to the Release 1.5.8 milestone Oct 7, 2016
@heinrichreimer
Copy link
Owner

I don't see any reason why the text would jump in your portrait layout. All TextViews have a wrap_content height, so the only thing that would change size is the ImageView and the Space.
Same goes for the landscape layout.

@abhijitvalluri
Copy link
Author

Ok, I fixed the problem. I was using somewhat large images for the ImageView and as you can see, I had a layout_weight attribute for the ImageView and the Space widget at the end. This caused the image to take up different amount of space depending on whether more space was available when the CTA button gets hidden. That is why there was some change in the position of text from one slide to the next and that caused the motion animation for the text. Now, I made the images smaller and removed the layout_weight attributes. Everything is a fixed size given by wrap_content and now there is no issue.

My only concern is some text may get cut off in really small screen scenarios but that is something else. I wish Android could allow us to specify percentage values in layouts, but I digress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants