forked from nickbutcher/plaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better Dribbble enter/exit transitions.
– Remove crufty anim code & replace with shiny transitions – Better enter animation with a distance staggered slide – Animate comment entry after loading
- Loading branch information
1 parent
5f7c75b
commit 2048e69
Showing
17 changed files
with
288 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
app/src/main/java/io/plaidapp/ui/transitions/BackgroundFade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.plaidapp.ui.transitions; | ||
|
||
import android.animation.Animator; | ||
import android.animation.ObjectAnimator; | ||
import android.content.Context; | ||
import android.graphics.drawable.Drawable; | ||
import android.support.annotation.Keep; | ||
import android.transition.TransitionValues; | ||
import android.transition.Visibility; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import io.plaidapp.util.ViewUtils; | ||
|
||
/** | ||
* A transition which fades in/out the background {@link Drawable} of a View. | ||
*/ | ||
public class BackgroundFade extends Visibility { | ||
|
||
public BackgroundFade() { | ||
super(); | ||
} | ||
|
||
@Keep | ||
public BackgroundFade(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
@Override | ||
public Animator onAppear(ViewGroup sceneRoot, View view, | ||
TransitionValues startValues, TransitionValues endValues) { | ||
if (view == null || view.getBackground() == null) return null; | ||
Drawable background = view.getBackground(); | ||
background.setAlpha(0); | ||
return ObjectAnimator.ofInt(background, ViewUtils.DRAWABLE_ALPHA, 0, 255); | ||
} | ||
|
||
@Override | ||
public Animator onDisappear(ViewGroup sceneRoot, View view, | ||
TransitionValues startValues, TransitionValues endValues) { | ||
if (view == null || view.getBackground() == null) return null; | ||
return ObjectAnimator.ofInt(view.getBackground(), ViewUtils.DRAWABLE_ALPHA, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.