-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from alibaba/develop
Add transition animation support.
- Loading branch information
Showing
10 changed files
with
183 additions
and
23 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
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
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,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate | ||
android:duration="2000" | ||
android:fromYDelta="100%p" | ||
android:toYDelta="0"/> | ||
<alpha | ||
android:duration="2000" | ||
android:fromAlpha="0.0" | ||
android:toAlpha="1.0"/> | ||
</set> |
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,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate | ||
android:duration="2000" | ||
android:fromYDelta="0%p" | ||
android:toYDelta="100%p"/> | ||
<alpha | ||
android:duration="2000" | ||
android:fromAlpha="1.0" | ||
android:toAlpha="0.0"/> | ||
</set> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
import android.os.Parcelable; | ||
import android.support.annotation.IntDef; | ||
import android.support.annotation.Nullable; | ||
import android.support.annotation.RequiresApi; | ||
import android.support.v4.app.ActivityOptionsCompat; | ||
import android.util.SparseArray; | ||
|
||
import com.alibaba.android.arouter.facade.callback.NavigationCallback; | ||
|
@@ -25,17 +27,35 @@ | |
* A container that contains the roadmap. | ||
* | ||
* @author Alex <a href="mailto:[email protected]">Contact me.</a> | ||
* @version 1.0 | ||
* @version 1.1.0 | ||
* @since 16/8/22 19:16 | ||
*/ | ||
public final class Postcard extends RouteMeta { | ||
// Base | ||
private Uri uri; | ||
private Object tag; // A tag prepare for some thing wrong. | ||
private Bundle mBundle; // Data to tranform | ||
private Bundle mBundle; // Data to transform | ||
private int flags = -1; // Flags of route | ||
private int timeout = 300; // Navigation timeout, TimeUnit.Second ! | ||
private int timeout = 300; // Navigation timeout, TimeUnit.Second | ||
private IProvider provider; // It will be set value, if this postcard was provider. | ||
private boolean greenChannal; | ||
private boolean greenChannel; | ||
|
||
// Animation | ||
private Bundle optionsCompat; // The transition animation of activity | ||
private int enterAnim; | ||
private int exitAnim; | ||
|
||
public Bundle getOptionsBundle() { | ||
return optionsCompat; | ||
} | ||
|
||
public int getEnterAnim() { | ||
return enterAnim; | ||
} | ||
|
||
public int getExitAnim() { | ||
return exitAnim; | ||
} | ||
|
||
public IProvider getProvider() { | ||
return provider; | ||
|
@@ -61,8 +81,8 @@ public Postcard(String path, String group, Uri uri, Bundle bundle) { | |
this.mBundle = (null == bundle ? new Bundle() : bundle); | ||
} | ||
|
||
public boolean isGreenChannal() { | ||
return greenChannal; | ||
public boolean isGreenChannel() { | ||
return greenChannel; | ||
} | ||
|
||
public Object getTag() { | ||
|
@@ -149,12 +169,12 @@ public void navigation(Activity mContext, int requestCode, NavigationCallback ca | |
} | ||
|
||
/** | ||
* Green channal, it will skip all of interceptors. | ||
* Green channel, it will skip all of interceptors. | ||
* | ||
* @return this | ||
*/ | ||
public Postcard greenChannel() { | ||
this.greenChannal = true; | ||
this.greenChannel = true; | ||
return this; | ||
} | ||
|
||
|
@@ -540,8 +560,47 @@ public Postcard withBundle(@Nullable String key, @Nullable Bundle value) { | |
return this; | ||
} | ||
|
||
/** | ||
* Set normal transition anim | ||
* | ||
* @param enterAnim enter | ||
* @param exitAnim exit | ||
* @return current | ||
*/ | ||
public Postcard withTransition(int enterAnim, int exitAnim) { | ||
this.enterAnim = enterAnim; | ||
this.exitAnim = exitAnim; | ||
return this; | ||
} | ||
|
||
/** | ||
* Set options compat | ||
* | ||
* @param compat compat | ||
* @return this | ||
*/ | ||
@RequiresApi(16) | ||
public Postcard withOptionsCompat(ActivityOptionsCompat compat) { | ||
if (null != compat) { | ||
this.optionsCompat = compat.toBundle(); | ||
} | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Postcard " + super.toString(); | ||
return "Postcard{" + | ||
"uri=" + uri + | ||
", tag=" + tag + | ||
", mBundle=" + mBundle + | ||
", flags=" + flags + | ||
", timeout=" + timeout + | ||
", provider=" + provider + | ||
", greenChannel=" + greenChannel + | ||
", optionsCompat=" + optionsCompat + | ||
", enterAnim=" + enterAnim + | ||
", exitAnim=" + exitAnim + | ||
"}\n" + | ||
super.toString(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
* @version 1.0 | ||
* @since 16/8/24 10:15 | ||
*/ | ||
@Deprecated | ||
public interface IPolicy { | ||
int getFlag(); | ||
} |
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