Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
* [Android] Fix duplication of animation initialization due to transf…
Browse files Browse the repository at this point in the history
  • Loading branch information
YorkShen committed Jun 27, 2018
1 parent 7490d74 commit 709d780
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class GraphicActionAnimation extends BasicGraphicAction {

private final static String TAG = "GraphicActionAnimation";

private final boolean styleNeedInit;

@Nullable
private
final String callback;
Expand All @@ -71,13 +73,15 @@ public class GraphicActionAnimation extends BasicGraphicAction {

public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @NonNull WXAnimationBean animationBean) {
super(pageId, ref);
this.styleNeedInit = false;
this.callback = null;
this.mAnimationBean = animationBean;
}

public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @Nullable String animation,
@Nullable final String callBack) {
super(pageId, ref);
this.styleNeedInit = true;
this.callback = callBack;
if (!TextUtils.isEmpty(animation)) {
this.mAnimationBean = JSONObject.parseObject(animation, WXAnimationBean.class);
Expand All @@ -86,6 +90,7 @@ public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @Null
public GraphicActionAnimation(@NonNull String pageId, @NonNull String ref, @NonNull WXAnimationBean animationBean,
@Nullable final String callBack) {
super(pageId, ref);
this.styleNeedInit = false;
this.mAnimationBean = animationBean;
this.callback = callBack;
}
Expand All @@ -107,9 +112,12 @@ public void executeAction() {
}

if (null != mAnimationBean.styles) {
mAnimationBean.styles.init(mAnimationBean.styles.transformOrigin,
mAnimationBean.styles.transform, (int) component.getLayoutWidth(), (int) component.getLayoutHeight(),
instance.getInstanceViewPortWidth());
if(styleNeedInit) {
mAnimationBean.styles.init(mAnimationBean.styles.transformOrigin,
mAnimationBean.styles.transform, (int) component.getLayoutWidth(),
(int) component.getLayoutHeight(),
instance.getInstanceViewPortWidth());
}
startAnimation(instance, component);
}
}
Expand Down

0 comments on commit 709d780

Please sign in to comment.