You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2018/04/28 06:54:02 UTC
[34/48] incubator-weex git commit: * [android] Merge WeexCore-master
to master.
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/AnimationAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/AnimationAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/AnimationAction.java
deleted file mode 100644
index a0d689f..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/AnimationAction.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ArgbEvaluator;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.graphics.drawable.ColorDrawable;
-import android.os.Build;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.view.animation.PathInterpolatorCompat;
-import android.text.TextUtils;
-import android.util.Pair;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.view.animation.LinearInterpolator;
-import com.alibaba.fastjson.JSONObject;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.WXSDKManager;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.ui.animation.BackgroundColorProperty;
-import com.taobao.weex.ui.animation.HeightProperty;
-import com.taobao.weex.ui.animation.WXAnimationBean;
-import com.taobao.weex.ui.animation.WXAnimationModule;
-import com.taobao.weex.ui.animation.WidthProperty;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.ui.view.border.BorderDrawable;
-import com.taobao.weex.utils.SingleFunctionParser;
-import com.taobao.weex.utils.WXExceptionUtils;
-import com.taobao.weex.utils.WXLogUtils;
-import com.taobao.weex.utils.WXResourceUtils;
-import com.taobao.weex.utils.WXUtils;
-import com.taobao.weex.utils.WXViewUtils;
-import java.util.HashMap;
-import java.util.List;
-
-import static com.taobao.weex.common.Constants.TimeFunction.CUBIC_BEZIER;
-import static com.taobao.weex.common.Constants.TimeFunction.EASE;
-import static com.taobao.weex.common.Constants.TimeFunction.EASE_IN;
-import static com.taobao.weex.common.Constants.TimeFunction.EASE_IN_OUT;
-import static com.taobao.weex.common.Constants.TimeFunction.EASE_OUT;
-import static com.taobao.weex.common.Constants.TimeFunction.LINEAR;
-
-
-class AnimationAction implements DOMAction, RenderAction {
-
- private final static String TAG = "AnimationAction";
- @NonNull
- private final String ref;
-
- @Nullable
- private
- final JSONObject animation;
-
- @Nullable
- private
- final String callback;
-
- @Nullable
- private
- WXAnimationBean mAnimationBean;
-
- AnimationAction(@NonNull final String ref, @Nullable JSONObject animation,
- @Nullable final String callBack) {
- this.ref = ref;
- this.animation = animation;
- this.callback = callBack;
- }
-
- AnimationAction(@NonNull String ref, @NonNull WXAnimationBean animationBean) {
- this(ref, animationBean, null);
- }
-
- AnimationAction(@NonNull String ref, @NonNull WXAnimationBean animationBean,
- @Nullable final String callBack) {
- this.ref = ref;
- this.mAnimationBean = animationBean;
- this.callback = callBack;
- this.animation = null;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- try {
- WXDomObject domObject;
- if (!context.isDestory() &&
- animation != null &&
- (domObject = context.getDomByRef(ref)) != null) {
- WXAnimationBean animationBean = JSONObject.toJavaObject(animation, WXAnimationBean.class);
- if (animationBean != null && animationBean.styles != null) {
- int width = (int) domObject.getLayoutWidth();
- int height = (int) domObject.getLayoutHeight();
- animationBean.styles.init(animationBean.styles.transformOrigin,
- animationBean.styles.transform, width, height,
- context.getInstance().getInstanceViewPortWidth());
- mAnimationBean = animationBean;
- context.postRenderTask(this);
- }
- }
- } catch (RuntimeException e) {
- WXExceptionUtils.commitCriticalExceptionRT(context.getInstance().getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_ANIMATION,
- "animationAction",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_ANIMATION.getErrorMsg() + WXLogUtils.getStackTrace(e),null);
- WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
- }
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXSDKInstance instance;
- if (mAnimationBean != null && (instance = context.getInstance()) != null) {
- startAnimation(instance, context.getComponent(ref));
- }
- }
-
- private void startAnimation(@NonNull WXSDKInstance instance, @Nullable WXComponent component) {
- if (component != null) {
- if (mAnimationBean != null) {
- component.setNeedLayoutOnAnimation(mAnimationBean.needLayout);
- }
- if (component.getHostView() == null) {
- WXAnimationModule.AnimationHolder holder = new WXAnimationModule.AnimationHolder(mAnimationBean, callback);
- component.postAnimation(holder);
- } else {
- try {
- Animator animator = createAnimator(component.getHostView(), instance
- .getInstanceViewPortWidth());
- if (animator != null) {
- Animator.AnimatorListener animatorCallback = createAnimatorListener(instance, callback);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2 && component
- .isLayerTypeEnabled() ) {
- component.getHostView().setLayerType(View.LAYER_TYPE_HARDWARE, null);
- }
- Interpolator interpolator = createTimeInterpolator();
- if (animatorCallback != null) {
- animator.addListener(animatorCallback);
- }
- if (interpolator != null) {
- animator.setInterpolator(interpolator);
- }
- component.getHostView().setCameraDistance(mAnimationBean.styles.getCameraDistance());
- animator.setDuration(mAnimationBean.duration);
- animator.start();
- }
- } catch (RuntimeException e) {
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_ANIMATION,
- "animationAction",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_ANIMATION.getErrorMsg() + WXLogUtils.getStackTrace(e),null);
- WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e)); }
- }
- }
- }
-
- private
- @Nullable
- ObjectAnimator createAnimator(final View target, final int viewPortWidth) {
- if (target == null) {
- return null;
- }
- WXAnimationBean.Style style = mAnimationBean.styles;
- if (style != null) {
- ObjectAnimator animator;
- List<PropertyValuesHolder> holders = style.getHolders();
- if (!TextUtils.isEmpty(style.backgroundColor)) {
- BorderDrawable borderDrawable;
- if ((borderDrawable = WXViewUtils.getBorderDrawable(target)) != null) {
- holders.add(PropertyValuesHolder.ofObject(
- new BackgroundColorProperty(), new ArgbEvaluator(),
- borderDrawable.getColor(),
- WXResourceUtils.getColor(style.backgroundColor)));
- } else if (target.getBackground() instanceof ColorDrawable) {
- holders.add(PropertyValuesHolder.ofObject(
- new BackgroundColorProperty(), new ArgbEvaluator(),
- ((ColorDrawable) target.getBackground()).getColor(),
- WXResourceUtils.getColor(style.backgroundColor)));
- }
- }
-
- if (target.getLayoutParams() != null &&
- (!TextUtils.isEmpty(style.width) || !TextUtils.isEmpty(style.height))) {
- ViewGroup.LayoutParams layoutParams = target.getLayoutParams();
- if (!TextUtils.isEmpty(style.width)) {
- holders.add(PropertyValuesHolder.ofInt(new WidthProperty(), layoutParams.width,
- (int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.width), viewPortWidth)));
- }
- if (!TextUtils.isEmpty(style.height)) {
- holders.add(PropertyValuesHolder.ofInt(new HeightProperty(), layoutParams.height,
- (int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.height), viewPortWidth)));
- }
- }
-
- if (style.getPivot() != null) {
- Pair<Float, Float> pair = style.getPivot();
- target.setPivotX(pair.first);
- target.setPivotY(pair.second);
- }
- animator = ObjectAnimator.ofPropertyValuesHolder(
- target, holders.toArray(new PropertyValuesHolder[holders.size()]));
- animator.setStartDelay(mAnimationBean.delay);
- return animator;
- } else {
- return null;
- }
- }
-
- private
- @Nullable
- Animator.AnimatorListener createAnimatorListener(final WXSDKInstance instance, @Nullable final String callBack) {
- if (!TextUtils.isEmpty(callBack)) {
- return new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (instance == null || instance.isDestroy()) {
- WXLogUtils.e("RenderActionContextImpl-onAnimationEnd WXSDKInstance == null NPE or instance is destroyed");
- } else {
- WXSDKManager.getInstance().callback(instance.getInstanceId(),
- callBack,
- new HashMap<String, Object>());
- }
- }
- };
- } else {
- return null;
- }
- }
-
- private
- @Nullable
- Interpolator createTimeInterpolator() {
- String interpolator = mAnimationBean.timingFunction;
- if (!TextUtils.isEmpty(interpolator)) {
- switch (interpolator) {
- case EASE_IN:
- return PathInterpolatorCompat.create(0.42f,0f, 1f,1f);
- case EASE_OUT:
- return PathInterpolatorCompat.create(0f,0f, 0.58f,1f);
- case EASE_IN_OUT:
- return PathInterpolatorCompat.create(0.42f,0f, 0.58f,1f);
- case EASE:
- return PathInterpolatorCompat.create(0.25f,0.1f, 0.25f,1f);
- case LINEAR:
- return PathInterpolatorCompat.create(0.0f,0f, 1f,1f);
- default:
- //Parse cubic-bezier
- try {
- SingleFunctionParser<Float> parser = new SingleFunctionParser<>(
- mAnimationBean.timingFunction,
- new SingleFunctionParser.FlatMapper<Float>() {
- @Override
- public Float map(String raw) {
- return Float.parseFloat(raw);
- }
- });
- List<Float> params = parser.parse(CUBIC_BEZIER);
- if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) {
- return PathInterpolatorCompat.create(
- params.get(0), params.get(1), params.get(2), params.get(3));
- } else {
- return null;
- }
- } catch (RuntimeException e) {
- return null;
- }
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateBodyAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateBodyAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateBodyAction.java
deleted file mode 100644
index b72e6d1..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateBodyAction.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.widget.ScrollView;
-
-import com.alibaba.fastjson.JSONObject;
-import com.taobao.weex.WXEnvironment;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.WXSDKManager;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.common.WXRenderStrategy;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.tracing.Stopwatch;
-import com.taobao.weex.tracing.WXTracing;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.ui.component.WXScroller;
-import com.taobao.weex.utils.WXLogUtils;
-import com.taobao.weex.utils.WXViewUtils;
-
-/**
- * Created by sospartan on 14/02/2017.
- */
-
-class CreateBodyAction extends AbstractAddElementAction {
- private final JSONObject mData;
- private StringBuilder mErrMsg = new StringBuilder("CreateBodyAction Error:");
-
- CreateBodyAction(JSONObject data) {
- mData = data;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (WXTracing.isAvailable()) {
- if (context != null && context.getInstance() != null) {
- WXTracing.TraceEvent execJsEndEvent = WXTracing.newEvent("executeBundleJS", context.getInstanceId(), -1);
- execJsEndEvent.traceId = context.getInstance().mExecJSTraceId;
- execJsEndEvent.ph = "E";
- execJsEndEvent.submit();
- }
- }
- addDomInternal(context, mData);
- }
-
- @Override
- protected WXComponent createComponent(DOMActionContext context, WXDomObject domObject) {
- return generateComponentTree(context, domObject, null);
- }
-
- @Override
- protected void appendDomToTree(DOMActionContext context, WXDomObject domObject) {
- long startNanos = System.nanoTime();
- String instanceId = context.getInstanceId();
- WXDomObject.prepareRoot(domObject,
- WXViewUtils.getWebPxByWidth(WXViewUtils.getWeexHeight(instanceId), WXSDKManager.getInstanceViewPortWidth(instanceId)),
- WXViewUtils.getWebPxByWidth(WXViewUtils.getWeexWidth(instanceId), WXSDKManager.getInstanceViewPortWidth(instanceId)));
- domObject.mDomThreadNanos += (System.nanoTime() - startNanos);
- }
-
- @Override
- protected WXErrorCode getErrorCode() {
- return WXErrorCode.WX_KEY_EXCEPTION_DOM_CREATE_BODY;
- }
-
- @Override
- protected String getErrorMsg() {
- return mErrMsg.toString();
- }
-
- @Override
- protected String getStatementName() {
- return "createBody";
- }
-
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent component = context.getComponent(WXDomObject.ROOT);
- WXSDKInstance instance = context.getInstance();
- if (instance == null || instance.getContext() == null) {
- WXLogUtils.e("instance is null or instance is destroy!");
- mErrMsg.append("instance is null or instance is destroy!");
- return;
- }
- try {
- Stopwatch.tick();
- long start = System.currentTimeMillis();
- component.createView();
- if (WXEnvironment.isApkDebugable()) {
- WXLogUtils.renderPerformanceLog("createView", (System.currentTimeMillis() - start));
- submitPerformance("createView", "X", instance.getInstanceId(), Stopwatch.tackAndTick(), start, true);
- }
- start = System.currentTimeMillis();
- component.applyLayoutAndEvent(component);
- if (WXTracing.isAvailable()) {
- submitPerformance("applyLayoutAndEvent", "X", instance.getInstanceId(), Stopwatch.tackAndTick(), start, true);
- }
- start = System.currentTimeMillis();
- component.bindData(component);
-
- if (WXEnvironment.isApkDebugable()) {
- WXLogUtils.renderPerformanceLog("bind", (System.currentTimeMillis() - start));
- submitPerformance("bindData", "X", instance.getInstanceId(), Stopwatch.tack(), start, true);
- }
-
- if (component instanceof WXScroller) {
- WXScroller scroller = (WXScroller) component;
- if (scroller.getInnerView() instanceof ScrollView) {
- instance.setRootScrollView((ScrollView) scroller.getInnerView());
- }
- }
- instance.onRootCreated(component);
- if (instance.getRenderStrategy() != WXRenderStrategy.APPEND_ONCE) {
- instance.onCreateFinish();
- }
- component.mTraceInfo.uiQueueTime = mUIQueueTime;
- component.onRenderFinish(WXComponent.STATE_ALL_FINISH);
- } catch (Exception e) {
- WXLogUtils.e("create body failed.", e);
- mErrMsg.append("create body failed.").append(WXLogUtils.getStackTrace(e)).toString();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateFinishAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateFinishAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateFinishAction.java
deleted file mode 100644
index e581c4e..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/CreateFinishAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.LayoutFinishListener;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.WXSDKManager;
-import com.taobao.weex.common.WXRenderStrategy;
-import com.taobao.weex.common.WXThread;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.tracing.Stopwatch;
-import com.taobao.weex.tracing.WXTracing;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-
-final class CreateFinishAction extends AbstractLayoutFinishAction {
-
- @Override
- public void executeDom(DOMActionContext context) {
- super.executeDom(context);
- final WXSDKInstance instance = context.getInstance();
- final LayoutFinishListener listener;
- if(instance != null && (listener = instance.getLayoutFinishListener()) != null) {
- WXSDKManager.getInstance().getWXRenderManager().postOnUiThread(WXThread.secure(new Runnable() {
- @Override
- public void run() {
- listener.onLayoutFinish(instance);
- }
- }),0);
- }
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXSDKInstance instance = context.getInstance();
- if (instance.getRenderStrategy() == WXRenderStrategy.APPEND_ONCE) {
- instance.onCreateFinish();
- }
- instance.onRenderSuccess(mLayoutWidth, mLayoutHeight);
- if (WXTracing.isAvailable()) {
- double renderTime = Stopwatch.millisUntilNow(context.getInstance().mRenderStartNanos);
- submitPerformance("renderFinish", "X", instance.getInstanceId(), renderTime, System.currentTimeMillis());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/ExecutableRenderAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/ExecutableRenderAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/ExecutableRenderAction.java
deleted file mode 100644
index 0e78088..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/ExecutableRenderAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-
-class ExecutableRenderAction implements DOMAction, RenderAction {
-
- private Runnable mRunnable;
-
- ExecutableRenderAction(Runnable runnable) {
- this.mRunnable = runnable;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- if (mRunnable != null) {
- mRunnable.run();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
deleted file mode 100644
index cf8e224..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.graphics.Rect;
-import android.support.annotation.NonNull;
-import android.text.TextUtils;
-import android.view.View;
-
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.bridge.JSCallback;
-import com.taobao.weex.bridge.SimpleJSCallback;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.utils.WXViewUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-class GetComponentRectAction implements RenderAction {
- private final String mRef;
- private final String mCallback;
-
-
- GetComponentRectAction(String ref, String callback) {
- this.mRef = ref;
- this.mCallback = callback;
- }
- @Override
- public void executeRender(RenderActionContext context) {
- WXSDKInstance instance = context.getInstance();
- JSCallback jsCallback = new SimpleJSCallback(context.getInstance().getInstanceId(), mCallback);
- if (instance == null ||instance.isDestroy()) {
- //do nothing
- }else if (TextUtils.isEmpty(mRef)) {
- Map<String, Object> options = new HashMap<>();
- options.put("result", false);
- options.put("errMsg", "Illegal parameter");
- jsCallback.invoke(options);
- } else if ("viewport".equalsIgnoreCase(mRef)) {
- callbackViewport(context, jsCallback);
- } else {
- WXComponent component = context.getComponent(mRef);
- Map<String, Object> options = new HashMap<>();
- if (component != null) {
- int viewPort = instance.getInstanceViewPortWidth();
- Map<String, Float> size = new HashMap<>();
- Rect sizes = component.getComponentSize();
- size.put("width", getWebPxValue(sizes.width(),viewPort));
- size.put("height", getWebPxValue(sizes.height(),viewPort));
- size.put("bottom", getWebPxValue(sizes.bottom,viewPort));
- size.put("left", getWebPxValue(sizes.left,viewPort));
- size.put("right", getWebPxValue(sizes.right,viewPort));
- size.put("top", getWebPxValue(sizes.top,viewPort));
- options.put("size", size);
- options.put("result", true);
- } else {
- options.put("errMsg", "Component does not exist");
- }
- jsCallback.invoke(options);
- }
- }
-
- private void callbackViewport(RenderActionContext context, JSCallback jsCallback) {
- WXSDKInstance instance = context.getInstance();
- View container;
- if ((container = instance.getContainerView()) != null) {
- Map<String, Object> options = new HashMap<>();
- Map<String, Float> sizes = new HashMap<>();
- int[] location = new int[2];
- instance.getContainerView().getLocationOnScreen(location);
- int viewport = instance.getInstanceViewPortWidth();
- sizes.put("left", 0f);
- sizes.put("top", 0f);
- sizes.put("right", getWebPxValue(container.getWidth(),viewport));
- sizes.put("bottom", getWebPxValue(container.getHeight(),viewport));
- sizes.put("width", getWebPxValue(container.getWidth(),viewport));
- sizes.put("height", getWebPxValue(container.getHeight(),viewport));
- options.put("size", sizes);
- options.put("result", true);
- jsCallback.invoke(options);
- } else {
- Map<String, Object> options = new HashMap<>();
- options.put("result", false);
- options.put("errMsg", "Component does not exist");
- jsCallback.invoke(options);
- }
- }
-
- @NonNull
- private float getWebPxValue(int value,int viewport) {
- return WXViewUtils.getWebPxByWidth(value, viewport);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/InvokeMethodAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/InvokeMethodAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/InvokeMethodAction.java
deleted file mode 100644
index 5661b92..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/InvokeMethodAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.alibaba.fastjson.JSONArray;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.utils.WXLogUtils;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-final class InvokeMethodAction implements DOMAction {
- private final String mRef;
- private final String mMethod;
- private final JSONArray mArgs;
-
- InvokeMethodAction(String ref, String method, JSONArray args) {
- this.mRef = ref;
- this.mMethod = method;
- this.mArgs = args;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- WXComponent comp = context.getCompByRef(mRef);
- if(comp == null){
- WXLogUtils.e("DOMAction","target component not found.");
- return;
- }
- comp.invoke(mMethod,mArgs);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/ModuleInvocationAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/ModuleInvocationAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/ModuleInvocationAction.java
deleted file mode 100644
index 327f9a3..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/ModuleInvocationAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.support.annotation.NonNull;
-
-import com.alibaba.fastjson.JSONArray;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.bridge.Invoker;
-import com.taobao.weex.bridge.NativeInvokeHelper;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.common.WXModule;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.utils.WXExceptionUtils;
-import com.taobao.weex.utils.WXLogUtils;
-
-class ModuleInvocationAction implements DOMAction, RenderAction {
-
- private WXModule mWXModule;
- private JSONArray mArgs;
- private Invoker mInvoker;
-
- ModuleInvocationAction(@NonNull WXModule wxModule, @NonNull JSONArray args, @NonNull Invoker invoker) {
- this.mWXModule = wxModule;
- this.mArgs = args;
- this.mInvoker = invoker;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXSDKInstance instance;
- if(context == null || (instance = context.getInstance()) == null) {
- return;
- }
- NativeInvokeHelper helper = instance.getNativeInvokeHelper();
- try {
- helper.invoke(mWXModule,mInvoker,mArgs);
- } catch (Exception e) {
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_MODULEINVO,
- "updateAttr",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_MODULEINVO.getErrorMsg() + "callModuleMethod >>> invoke module:"
- + mWXModule.getClass().getSimpleName() + " failed. " + WXLogUtils.getStackTrace(e),null);
-
- WXLogUtils.e("callModuleMethod >>> invoke module:" + mWXModule.getClass().getSimpleName()
- + " failed. ", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/MoveElementAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/MoveElementAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/MoveElementAction.java
deleted file mode 100644
index a103858..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/MoveElementAction.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.ui.component.WXVContainer;
-import com.taobao.weex.utils.WXExceptionUtils;
-
-/**
- * Created by sospartan on 01/03/2017.
- */
-final class MoveElementAction implements DOMAction, RenderAction {
- private final String mRef;
- private final String mParentRef;
- private final int mIndex;
-
- private int mNewIndex;
-
- MoveElementAction(String ref, String parentRef, int index) {
- mRef = ref;
- mParentRef = parentRef;
- mIndex = index;
- mNewIndex = index;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- WXSDKInstance instance = context.getInstance();
- WXDomObject domObject = context.getDomByRef(mRef);
- WXDomObject parentObject = context.getDomByRef(mParentRef);
- if (domObject == null || domObject.parent == null
- || parentObject == null || parentObject.hasNewLayout()) {
- if (instance != null) {
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_MOVE_ELEMENT,
- "moveElement",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_MOVE_ELEMENT.getErrorMsg() +
- "domObject = " + domObject
- + "domObject.parent= " + domObject.parent
- + "parentObject = " + parentObject
- + "parentObject.hasNewLayout() =" + parentObject.hasNewLayout(),null);
- }
- return;
- }
- int index = mIndex;
- if (domObject.parent.equals(parentObject)) {
- if(parentObject.index(domObject) == index) {
- return;
- } else if(domObject.parent.index(domObject)< index){
- index = index -1;
- }
- }
-
- mNewIndex = index;
- domObject.parent.remove(domObject);
- parentObject.add(domObject, mNewIndex);
-
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent component = context.getComponent(mRef);
- WXComponent newParent = context.getComponent(mParentRef);
- if (component == null || component.getParent() == null
- || newParent == null || !(newParent instanceof WXVContainer)) {
- return;
- }
- WXVContainer oldParent = component.getParent();
- oldParent.remove(component,false);
- ((WXVContainer) newParent).addChild(component, mNewIndex);
- if(!component.isVirtualComponent()){
- ((WXVContainer) newParent).addSubView(component.getHostView(), mNewIndex);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/RefreshFinishAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/RefreshFinishAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/RefreshFinishAction.java
deleted file mode 100644
index 2d87d11..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/RefreshFinishAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.tracing.WXTracing;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-
-class RefreshFinishAction extends AbstractLayoutFinishAction {
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXSDKInstance instance = context.getInstance();
- instance.onRefreshSuccess(mLayoutWidth, mLayoutHeight);
- if (WXTracing.isAvailable()) {
- submitPerformance("refreshFinish", "I", context.getInstance().getInstanceId(), 0, 0);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/ReloadPageAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/ReloadPageAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/ReloadPageAction.java
deleted file mode 100644
index 791a5f2..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/ReloadPageAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.util.Log;
-
-import com.taobao.weex.WXEnvironment;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-
-final class ReloadPageAction implements DOMAction, RenderAction {
- private final String TAG = "ReloadPageAction";
- private String mInstanceId;
- private boolean mReloadThis;
-
- ReloadPageAction(String instanceId, boolean reloadThis) {
- mInstanceId = instanceId;
- mReloadThis = reloadThis;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- // context.postRenderTask(this);
-
- WXSDKInstance instance = context.getInstance();
- if (instance != null) {
- // instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_SUCCESS);
- instance.reloadPage(mReloadThis);
- } else {
- Log.e(TAG, "ReloadPageAction executeDom reloadPage instance is null");
- }
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- // context.getInstance().onReloadPage();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveElementAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveElementAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveElementAction.java
deleted file mode 100644
index 144d3ec..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveElementAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.ui.component.WXVContainer;
-import com.taobao.weex.utils.WXExceptionUtils;
-
-/**
- * Created by sospartan on 27/02/2017.
- */
-final class RemoveElementAction implements DOMAction, RenderAction {
- private final String mRef;
-
- RemoveElementAction(String ref) {
- mRef = ref;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- WXSDKInstance instance = context.getInstance();
- WXDomObject domObject = context.getDomByRef(mRef);
- if (domObject == null) {
- if (instance != null) {
-// instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT);
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_REMOVE_ELEMENT,
- "removeElement",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_REMOVE_ELEMENT.getErrorMsg() + "domObject is null",null);
- }
- return;
- }
- WXDomObject parent = domObject.parent;
- if (parent == null) {
- if (instance != null) {
-// instance.commitUTStab(IWXUserTrackAdapter.DOM_MODULE, WXErrorCode.WX_ERR_DOM_REMOVEELEMENT);
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_REMOVE_ELEMENT,
- "removeElement",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_REMOVE_ELEMENT.getErrorMsg() + "parent is null",null);
- }
- return;
- }
- domObject.traverseTree(context.getRemoveElementConsumer());
- parent.remove(domObject);
- context.unregisterDOMObject(mRef);
-
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent component = context.getComponent(mRef);
- if (component == null || component.getParent() == null) {
- return;
- }
- WXVContainer parent = component.getParent();
- clearRegistryForComponent(context, component);
- parent.remove(component, true);
- context.unregisterComponent(mRef);
- WXSDKInstance instance = context.getInstance();
- if (null != instance){
- instance.onElementChange();
- }
- }
-
- private void clearRegistryForComponent(RenderActionContext context, WXComponent component) {
- WXComponent removedComponent = context.unregisterComponent(component.getDomObject().getRef());
- if (removedComponent != null) {
- removedComponent.removeAllEvent();
- removedComponent.removeStickyStyle();
- }
- if (component instanceof WXVContainer) {
- WXVContainer container = (WXVContainer) component;
- int count = container.childCount();
- for (int i = count - 1; i >= 0; --i) {
- clearRegistryForComponent(context, container.getChild(i));
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveEventAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveEventAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveEventAction.java
deleted file mode 100644
index 79f55af..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/RemoveEventAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.WXSDKManager;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.dom.WXEvent;
-import com.taobao.weex.ui.IWXRenderTask;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.utils.WXExceptionUtils;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-class RemoveEventAction implements DOMAction, RenderAction {
- private final String mRef;
- private final String mEvent;
-
- private WXDomObject mUpdatedDomObject;
-
- RemoveEventAction(String ref, Object event) {
- this.mRef = ref;
- this.mEvent = WXEvent.getEventName(event);
- }
-
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- WXSDKInstance instance = context.getInstance();
- WXDomObject domObject = context.getDomByRef(mRef);
- if (domObject == null) {
- if (instance != null) {
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_REMOVE_EVENT,
- "updateAttr",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_REMOVE_EVENT.getErrorMsg() + "domObject is null",null);
- }
- return;
- }
- domObject.removeEvent(mEvent);
- mUpdatedDomObject = domObject;
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent comp = context.getComponent(mRef);
- if(comp != null){
- //sync dom change to component
- comp.updateDom(mUpdatedDomObject);
- comp.removeEvent(mEvent);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/ScrollToElementAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/ScrollToElementAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/ScrollToElementAction.java
deleted file mode 100644
index e0cb8ea..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/ScrollToElementAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.alibaba.fastjson.JSONObject;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.WXSDKManager;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.ui.IWXRenderTask;
-import com.taobao.weex.ui.component.Scrollable;
-import com.taobao.weex.ui.component.WXComponent;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-final class ScrollToElementAction implements DOMAction, RenderAction {
- private final JSONObject mOptions;
- private final String mRef;
-
- public ScrollToElementAction(String ref, JSONObject options) {
- this.mRef = ref;
- this.mOptions = options;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent component = context.getComponent(mRef);
- if (component == null) {
- return;
- }
-
- Scrollable scroller = component.getParentScroller();
- if (scroller == null) {
- return;
- }
- scroller.scrollTo(component,mOptions);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/TraceableAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/TraceableAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/TraceableAction.java
deleted file mode 100644
index c4cc59a..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/TraceableAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.tracing.Stopwatch;
-import com.taobao.weex.tracing.WXTracing;
-
-/**
- * Created by moxun on 2017/6/30.
- */
-
-public class TraceableAction {
- public int mTracingEventId;
- public long mStartMillis;
- public long mDomQueueTime;
- public long mUIQueueTime;
- public long mParseJsonNanos = -1;
- protected WXTracing.TraceEvent mBeginEvent;
-
- {
- if (WXTracing.isAvailable()) {
- mTracingEventId = WXTracing.nextId();
- mStartMillis = System.currentTimeMillis();
- }
- }
-
- protected WXTracing.TraceEvent submitPerformance(String fname, String ph, String instanceId, double duration, long ts, boolean... isSegment) {
- if (WXTracing.isAvailable()) {
- WXTracing.TraceEvent event = WXTracing.newEvent(fname, instanceId, mTracingEventId);
- event.ts = ts;
- event.ph = ph;
- event.duration = duration;
-
- if (isSegment != null && isSegment.length == 1) {
- event.isSegment = isSegment[0];
- }
-
- event.submit();
- return event;
- }
- return new WXTracing.TraceEvent();
- }
-
- public void onStartDomExecute(String instanceId, String fname, String ref, String type, String payload) {
- if (WXTracing.isAvailable()) {
- mBeginEvent = WXTracing.newEvent(fname, instanceId, -1);
- mBeginEvent.traceId = mTracingEventId;
- mBeginEvent.ts = mStartMillis;
- mBeginEvent.ph = "B";
- mBeginEvent.ref = ref;
- mBeginEvent.name = type;
- mBeginEvent.payload = payload;
- mBeginEvent.parseJsonTime = Stopwatch.nanosToMillis(mParseJsonNanos);
- mBeginEvent.tname = "JSThread";
- mBeginEvent.submit();
- }
- }
-
- public void onFinishUIExecute() {
- if (WXTracing.isAvailable() && mBeginEvent != null) {
- WXTracing.TraceEvent endEvent = WXTracing.newEvent(getClass().getSimpleName(), mBeginEvent.iid, -1);
- endEvent.traceId = mBeginEvent.traceId;
- endEvent.ph = "E";
- endEvent.submit();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateAttributeAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateAttributeAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateAttributeAction.java
deleted file mode 100644
index 92d8513..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateAttributeAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.alibaba.fastjson.JSONObject;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.utils.WXExceptionUtils;
-
-/**
- * Created by sospartan on 28/02/2017.
- */
-
-class UpdateAttributeAction extends TraceableAction implements DOMAction, RenderAction {
- private final String mRef;
- private final JSONObject mData;
-
-
- UpdateAttributeAction(String ref, JSONObject data) {
- mRef = ref;
- mData = data;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- if(mData == null){
- return;
- }
-
- WXSDKInstance instance = context.getInstance();
- final WXDomObject domObject = context.getDomByRef(mRef);
- if (domObject == null) {
- if (instance != null) {
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_UPDATE_ATTRS,
- "updateAttr",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_UPDATE_ATTRS.getErrorMsg() + "domObject is null",null);
- }
- return;
- }
- domObject.getAttrs().filterBindingStatement(mData);
- domObject.updateAttr(mData);
- if(mData.size() > 0) {
- context.postRenderTask(this);
- }
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent comp = context.getComponent(mRef);
- if (comp == null) {
- return;
- }
-
- comp.updateProperties(mData);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateComponentDataAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateComponentDataAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateComponentDataAction.java
deleted file mode 100644
index 347c886..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateComponentDataAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.text.TextUtils;
-
-import com.alibaba.fastjson.JSONObject;
-import com.taobao.weex.bridge.SimpleJSCallback;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.ui.component.list.template.CellDataManager;
-import com.taobao.weex.ui.component.list.template.WXRecyclerTemplateList;
-import com.taobao.weex.utils.WXLogUtils;
-
-
-/**
- * Created by furture on 2018/1/23.
- */
-
-public class UpdateComponentDataAction implements RenderAction {
-
- private String virtualComponentId;
- private JSONObject data;
- private String callback;
-
- public UpdateComponentDataAction(String virtualComponentId,
- JSONObject data, String callback) {
- this.virtualComponentId = virtualComponentId;
- this.data = data;
- this.callback = callback;
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- String ref = CellDataManager.getListRef(virtualComponentId);
- if(TextUtils.isEmpty(ref)){
- WXLogUtils.e("wrong virtualComponentId split error " + virtualComponentId);
- return;
- }
- WXComponent component = context.getComponent(ref);
- if(component instanceof WXRecyclerTemplateList){
- WXRecyclerTemplateList templateList = (WXRecyclerTemplateList) component;
- templateList.getCellDataManager().updateVirtualComponentData(virtualComponentId, data);
- templateList.notifyUpdateList();
- SimpleJSCallback jsCallback = new SimpleJSCallback(component.getInstanceId(), callback);
- jsCallback.invoke(true);
- }else{
- WXLogUtils.e("recycler-list wrong virtualComponentId " + virtualComponentId);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateFinishAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateFinishAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateFinishAction.java
deleted file mode 100644
index d9d5648..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateFinishAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-
-/**
- * Created by sospartan on 02/03/2017.
- */
-
-final class UpdateFinishAction implements DOMAction, RenderAction {
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory()) {
- return;
- }
- context.postRenderTask(this);
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- context.getInstance().onUpdateFinish();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateStyleAction.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateStyleAction.java b/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateStyleAction.java
deleted file mode 100644
index a289bca..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/action/UpdateStyleAction.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.taobao.weex.dom.action;
-
-import android.support.v4.util.ArrayMap;
-
-import com.alibaba.fastjson.JSONObject;
-import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.adapter.IWXUserTrackAdapter;
-import com.taobao.weex.common.Constants;
-import com.taobao.weex.common.WXErrorCode;
-import com.taobao.weex.dom.DOMAction;
-import com.taobao.weex.dom.DOMActionContext;
-import com.taobao.weex.dom.RenderAction;
-import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.dom.WXDomObject;
-import com.taobao.weex.dom.flex.Spacing;
-import com.taobao.weex.ui.component.WXComponent;
-import com.taobao.weex.utils.WXExceptionUtils;
-
-import java.util.Map;
-
-/**
- * Created by sospartan on 28/02/2017.
- */
-
-class UpdateStyleAction extends TraceableAction implements DOMAction, RenderAction {
- private final String mRef;
- private final JSONObject mData;
- private final boolean mIsCausedByPesudo;
-
- private Spacing mPadding;
- private Spacing mBorder;
-
- UpdateStyleAction(String ref, JSONObject data) {
- this(ref, data, false);
- }
-
- UpdateStyleAction(String ref, JSONObject data, boolean byPesudo) {
- this.mRef = ref;
- this.mData = data;
- this.mIsCausedByPesudo = byPesudo;
- }
-
- @Override
- public void executeDom(DOMActionContext context) {
- if (context.isDestory() || mData == null) {
- return;
- }
- WXSDKInstance instance = context.getInstance();
- WXDomObject domObject = context.getDomByRef(mRef);
- if (domObject == null) {
- if (instance != null) {
- WXExceptionUtils.commitCriticalExceptionRT(instance.getInstanceId(),
- WXErrorCode.WX_KEY_EXCEPTION_DOM_UPDATE_STYLE,
- "updateStyle",
- WXErrorCode.WX_KEY_EXCEPTION_DOM_UPDATE_STYLE.getErrorMsg() + "domObject is null",null);
- }
- return;
- }
- mPadding = domObject.getPadding();
- mBorder = domObject.getBorder();
-
- if(mData.get(WXDomObject.TRANSFORM) != null || mData.get(WXDomObject.TRANSFORM_ORIGIN) != null){
- if(domObject.getTransition() == null) {
- Map<String, Object> animationMap = new ArrayMap<>(2);
- animationMap.put(WXDomObject.TRANSFORM, mData.get(WXDomObject.TRANSFORM));
- animationMap.put(WXDomObject.TRANSFORM_ORIGIN, mData.get(WXDomObject.TRANSFORM_ORIGIN));
- context.addAnimationForElement(mRef, animationMap);
- }
- }
-
-
- if (!mData.isEmpty()) {
- domObject.updateStyle(mData, mIsCausedByPesudo);
- domObject.applyStyle(mData);
- if(!mData.isEmpty()) {
- context.postRenderTask(this);
- }
- }
- }
-
- @Override
- public void executeRender(RenderActionContext context) {
- WXComponent component = context.getComponent(mRef);
- if (component == null) {
- return;
- }
- component.updateProperties(mData);
-
- if (mData.containsKey(Constants.Name.PADDING) ||
- mData.containsKey(Constants.Name.PADDING_TOP) ||
- mData.containsKey(Constants.Name.PADDING_LEFT) ||
- mData.containsKey(Constants.Name.PADDING_RIGHT) ||
- mData.containsKey(Constants.Name.PADDING_BOTTOM) ||
- mData.containsKey(Constants.Name.BORDER_WIDTH)) {
- Spacing padding = mPadding;
- Spacing border = mBorder;
- component.setPadding(padding, border);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSAlign.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSAlign.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSAlign.java
deleted file mode 100755
index 48cd13e..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSAlign.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-public enum CSSAlign {
- AUTO,
- FLEX_START,
- CENTER,
- FLEX_END,
- STRETCH,
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSConstants.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSConstants.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSConstants.java
deleted file mode 100755
index 911e5d6..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSConstants.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-public class CSSConstants {
-
- public static final float UNDEFINED = Float.NaN;
-
- public static boolean isUndefined(float value) {
- return Float.compare(value, UNDEFINED) == 0;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSDirection.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSDirection.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSDirection.java
deleted file mode 100755
index 863e509..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSDirection.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-public enum CSSDirection {
- INHERIT,
- LTR,
- RTL,
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSFlexDirection.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSFlexDirection.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSFlexDirection.java
deleted file mode 100755
index 0452665..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSFlexDirection.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-public enum CSSFlexDirection {
- COLUMN,
- COLUMN_REVERSE,
- ROW,
- ROW_REVERSE
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSJustify.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSJustify.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSJustify.java
deleted file mode 100755
index 6d997f5..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSJustify.java
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-public enum CSSJustify {
- FLEX_START,
- CENTER,
- FLEX_END,
- SPACE_BETWEEN,
- SPACE_AROUND,
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayout.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayout.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayout.java
deleted file mode 100755
index 0e055cd..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayout.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-import java.util.Arrays;
-
-/**
- * Where the output of {@link LayoutEngine#layoutNode(CSSLayoutContext, CSSNode, float,
- * CSSDirection)} will go in the CSSNode.
- */
-public class CSSLayout {
-
- public static final int POSITION_LEFT = 0;
- public static final int POSITION_TOP = 1;
- public static final int POSITION_RIGHT = 2;
- public static final int POSITION_BOTTOM = 3;
-
- public static final int DIMENSION_WIDTH = 0;
- public static final int DIMENSION_HEIGHT = 1;
-
- public float[] position = new float[4];
- public float[] dimensions = new float[2];
- public CSSDirection direction = CSSDirection.LTR;
-
- /**
- * This should always get called before calling {@link LayoutEngine#layoutNode(CSSLayoutContext,
- * CSSNode, float, CSSDirection)}
- */
- public void resetResult() {
- Arrays.fill(position, 0);
- Arrays.fill(dimensions, CSSConstants.UNDEFINED);
- direction = CSSDirection.LTR;
- }
-
- public void copy(CSSLayout layout) {
- position[POSITION_LEFT] = layout.position[POSITION_LEFT];
- position[POSITION_TOP] = layout.position[POSITION_TOP];
- position[POSITION_RIGHT] = layout.position[POSITION_RIGHT];
- position[POSITION_BOTTOM] = layout.position[POSITION_BOTTOM];
- dimensions[DIMENSION_WIDTH] = layout.dimensions[DIMENSION_WIDTH];
- dimensions[DIMENSION_HEIGHT] = layout.dimensions[DIMENSION_HEIGHT];
- direction = layout.direction;
- }
-
- @Override
- public String toString() {
- return "layout: {" +
- "left: " + position[POSITION_LEFT] + ", " +
- "top: " + position[POSITION_TOP] + ", " +
- "width: " + dimensions[DIMENSION_WIDTH] + ", " +
- "height: " + dimensions[DIMENSION_HEIGHT] + ", " +
- "direction: " + direction +
- "}";
- }
-
- @Override
- public boolean equals(Object o) {
- if(this == o){
- return true;
- }
- if(o instanceof CSSLayout){
- CSSLayout cl = (CSSLayout)o;
- return FloatUtil.floatsEqual(cl.position[POSITION_LEFT],this.position[POSITION_LEFT]) &&
- FloatUtil.floatsEqual(cl.position[POSITION_TOP],this.position[POSITION_TOP]) &&
- FloatUtil.floatsEqual(cl.position[POSITION_RIGHT],this.position[POSITION_RIGHT]) &&
- FloatUtil.floatsEqual(cl.position[POSITION_BOTTOM],this.position[POSITION_BOTTOM]) &&
- FloatUtil.floatsEqual(cl.dimensions[DIMENSION_HEIGHT],this.dimensions[DIMENSION_HEIGHT]) &&
- FloatUtil.floatsEqual(cl.dimensions[DIMENSION_WIDTH],this.dimensions[DIMENSION_WIDTH]);
-
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2f8caedb/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayoutContext.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayoutContext.java b/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayoutContext.java
deleted file mode 100755
index 9eee51a..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/dom/flex/CSSLayoutContext.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Copyright (c) 2014, Facebook, Inc. All rights reserved. <p/> This source code is licensed under
- * the BSD-style license found in the LICENSE file in the root directory of this source tree. An
- * additional grant of patent rights can be found in the PATENTS file in the same directory.
- */
-package com.taobao.weex.dom.flex;
-
-/**
- * A context for holding values local to a given instance of layout computation.
- *
- * This is necessary for making layout thread-safe. A separate instance should
- * be used when {@link CSSNode#calculateLayout} is called concurrently on
- * different node hierarchies.
- */
-public class CSSLayoutContext {
-
- /*package*/ final MeasureOutput measureOutput = new MeasureOutput();
-}