Skip to content

Commit

Permalink
add transition animation support
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed Aug 30, 2017
1 parent 3b85f96 commit dbd39b4
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 6 deletions.
Binary file modified RePluginDemo/app/src/main/assets/plugins/plugina.jar
Binary file not shown.
Binary file modified RePluginDemo/app/src/main/assets/plugins/usercenter.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.lzh.compiler.parceler.Parceler;
import com.lzh.nonview.router.Router;
import com.lzh.nonview.router.anno.RouterRule;
import com.lzh.nonview.router.route.IActivityRoute;
import com.lzh.nonview.router.route.IBaseRoute;
import com.lzh.replugindemo.pojo.User;

// 因为指定了baseUrl。 所以这里会使用baseUrl做组合。
Expand All @@ -21,10 +24,10 @@ protected void onCreate(Bundle savedInstanceState) {
}

public void onClick(View v) {
Button btn = (Button) v;
Router.create(btn.getText().toString())
.getActivityRoute()
.setAnim(0, 0)
.open(this);
IBaseRoute baseRoute = Router.create(((TextView)v).getText().toString()).getBaseRoute();
if (baseRoute instanceof IActivityRoute) {
((IActivityRoute) baseRoute).setAnim(R.anim.anim_fade_in, R.anim.anim_fade_out);
}
baseRoute.open(this);
}
}
9 changes: 9 additions & 0 deletions RePluginDemo/app/src/main/res/anim/anim_fade_in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

<alpha
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0" />

</set>
9 changes: 9 additions & 0 deletions RePluginDemo/app/src/main/res/anim/anim_fade_out.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

<alpha
android:duration="500"
android:fromAlpha="1.0"
android:toAlpha="0.0" />

</set>
2 changes: 2 additions & 0 deletions RePluginDemo/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
echo "build successful"
rm ./app/src/main/assets/plugins/plugina.jar
rm ./app/src/main/assets/plugins/usercenter.jar
rm ./mocked/apk/remote.apk
echo "delete last build apk successful"
cp ./plugina/build/outputs/apk/plugina-debug.apk ./app/src/main/assets/plugins/plugina.jar
cp ./usercenter/build/outputs/apk/usercenter-debug.apk ./app/src/main/assets/plugins/usercenter.jar
cp ./remote/build/outputs/apk/remote-debug.apk ./mocked/apk/remote.apk
echo "all successful"
Binary file modified RePluginDemo/mocked/apk/remote.apk
Binary file not shown.
2 changes: 2 additions & 0 deletions RePluginDemo/plugina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ dependencies {
annotationProcessor "com.github.yjfnypeu.Router:router-compiler:${ROUTER_VERSION}"
annotationProcessor "com.jakewharton:butterknife-compiler:${ButterKnife_version}"
compile "com.jakewharton:butterknife:${ButterKnife_version}"

compile 'com.android.support:support-v4:25.3.1'// 提供用于兼容ActivityLauncher编写
testCompile 'junit:junit:4.12'
}

Expand Down
11 changes: 10 additions & 1 deletion RePluginDemo/plugina/src/main/java/com/lzh/plugina/PluginA.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.lzh.nonview.router.Router;
import com.lzh.nonview.router.anno.RouterRule;
import com.lzh.nonview.router.route.IActivityRoute;
import com.lzh.nonview.router.route.IBaseRoute;

import butterknife.ButterKnife;
import butterknife.OnClick;
Expand All @@ -23,7 +26,13 @@ protected void onCreate(Bundle savedInstanceState) {

@OnClick({R.id.toHost, R.id.toLogin, R.id.triggerActionHost, R.id.triggerActionPluginA, R.id.triggerActionUserCenter})
void click(Button v) {
Router.create(v.getText().toString()).open(this);
String url = v.getText().toString();

IBaseRoute baseRoute = Router.create(url).getBaseRoute();
if (baseRoute instanceof IActivityRoute) {
((IActivityRoute) baseRoute).setAnim(R.anim.anim_fade_in, R.anim.anim_fade_out);
}
baseRoute.open(this);
}

}
9 changes: 9 additions & 0 deletions RePluginDemo/plugina/src/main/res/anim/anim_fade_in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

<alpha
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0" />

</set>
9 changes: 9 additions & 0 deletions RePluginDemo/plugina/src/main/res/anim/anim_fade_out.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

<alpha
android:duration="500"
android:fromAlpha="1.0"
android:toAlpha="0.0" />

</set>
11 changes: 11 additions & 0 deletions RePluginDemo/plugina/src/main/res/anim/anim_marquee_in.xml
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="300"
android:fromYDelta="100%p"
android:toYDelta="0"/>
<alpha
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0"/>
</set>
11 changes: 11 additions & 0 deletions RePluginDemo/plugina/src/main/res/anim/anim_marquee_out.xml
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="400"
android:fromYDelta="0"
android:toYDelta="-100%p"/>
<alpha
android:duration="500"
android:fromAlpha="1.0"
android:toAlpha="0.0"/>
</set>

0 comments on commit dbd39b4

Please sign in to comment.