Skip to content

Commit

Permalink
+ [android] support the box-shadow attribute on android 4.3 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
misakuo committed Sep 22, 2017
1 parent 4490223 commit b0e072a
Show file tree
Hide file tree
Showing 83 changed files with 1,822 additions and 2,980 deletions.
47 changes: 3 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ language: node_js
node_js: 7.6
rvm: 2.0.0
env:
- TEST_SUITE=ios
- TEST_SUITE=danger
- TEST_SUITE=jsfm
- TEST_SUITE=android
- TEST_SUITE=release
matrix:
fast_finish: true
exclude:
Expand All @@ -25,15 +23,7 @@ matrix:
env: TEST_SUITE=ios
- os: linux
env: TEST_SUITE=android
- os: osx
env: TEST_SUITE=release
- os: linux
env: TEST_SUITE=release
include:
- os: osx
env: TEST_SUITE=release
osx_image: xcode8.1
language: objective-c
- os: osx
env: TEST_SUITE=ios
osx_image: xcode8.1
Expand Down Expand Up @@ -63,50 +53,19 @@ before_script:
nvm install 7.0
npm install
fi
- |
if [[ $TEST_SUITE = "ios" ]]; then
brew update
fi
- |
if [[ $TEST_SUITE = "release" ]]; then
brew update
#manual install android sdk
brew cask install android-sdk
brew install gradle
export ANDROID_HOME=/usr/local/share/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools
echo yes | sdkmanager platform-tools
echo yes | sdkmanager tools #tools
echo yes | sdkmanager "build-tools;25.0.3" #build-tool
echo yes | sdkmanager "platforms;android-25" #compile target
echo yes | sdkmanager "extras;android;m2repository" #support
fi
script:
- |
if [[ $TEST_SUITE = "android" ]]; then
cd android
./gradlew clean assembleDebug :weex_sdk:testDebugUnitTest --info -PdisableCov=true -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.jvmargs="-Xmx512m -XX:+HeapDumpOnOutOfMemoryError" -Dfile.encoding=UTF-8 &&
npm run danger -- run --dangerfile ./dangerfile-android.js
cd $TRAVIS_BUILD_DIR
fi
- |
if [[ $TEST_SUITE = "ios" ]]; then
xcodebuild -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination 'platform=iOS Simulator,name=iPhone 6'
fi
- |
if [[ $TEST_SUITE = "jsfm" ]]; then
npm run build &&
npm run test
npm run danger -- run --dangerfile ./dangerfile-jsfm.js
fi
- |
if [[ $TEST_SUITE = "danger" ]]; then
npm run danger
fi
- |
if [[ $TEST_SUITE = "release" ]]; then
bash scripts/generate_apache_release.sh &&
cd apache_release_temp &&
bash scripts/build_from_source.sh &&
cd $TRAVIS_BUILD_DIR
npm run danger -- run --dangerfile ./dangerfile.js
fi
notifications:
webhooks:
Expand Down
5 changes: 4 additions & 1 deletion POSSIBLE-NOTICES-FOR-BIN-DIST
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,7 @@ This product contains software SDWebImage(https://github.com/rs/SDWebImage) deve
by Olivier Poitrey , licensed under the MIT License.

This product contains software Guava(https://github.com/google/guava) developed
by google , licensed under the Apache License.
by google , licensed under the Apache License.

This product contains shelljs Guava(https://github.com/shelljs/shelljs) developed
by shelljs , licensed under BSD 3-clause "New" or "Revised" License.
2 changes: 0 additions & 2 deletions WeexSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Pod::Spec.new do |s|
s.xcconfig = { "OTHER_LINK_FLAG" => '$(inherited) -ObjC'}

s.frameworks = 'CoreMedia','MediaPlayer','AVFoundation','AVKit','JavaScriptCore', 'GLKit', 'OpenGLES', 'CoreText', 'QuartzCore', 'CoreGraphics'

s.dependency 'SocketRocket'
s.libraries = "stdc++"

end
13 changes: 8 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.3.3'
}
}

plugins {
id "de.undercouch.download" version "3.2.0"
// id "com.github.dcendents.android-maven" version "1.5"
}

repositories {
Expand All @@ -29,7 +30,9 @@ subprojects {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
ext {
Expand All @@ -43,6 +46,6 @@ subprojects {
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
//task clean(type: Delete) {
// delete rootProject.buildDir
//}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ public class BenchmarkTest {
private static List<Long> firstScreenRenderTime = new LinkedList<>();
private static List<Long> flingFrameSeconds = new LinkedList<>();
private static List<Long> scrollFrameSeconds = new LinkedList<>();
private static final String DUMP_START = "Flags,IntendedVsync,Vsync,OldestInputEvent,NewestInputEvent,"
+ "HandleInputStart,AnimationStart,PerformTraversalsStart,DrawStart,"
+ "SyncQueued,SyncStart,IssueDrawCommandsStart,SwapBuffers,FrameCompleted,\n";
private static final String DUMP_START = "QueueBufferDuration,\n";
private static final String DUMP_END = "---PROFILEDATA---";
private static final String DUMP_COMMAND = "dumpsys gfxinfo com.alibaba.weex framestats reset";

Expand Down Expand Up @@ -195,7 +193,7 @@ private List<Long> createList(BufferedReader bufferedReader) throws IOException

private long calcTime() {
BenchmarkActivity benchmarkActivity = mActivityRule.getActivity();
benchmarkActivity.loadWeexPage();
benchmarkActivity.loadWeexPage("http://30.8.53.163:8080/complicated.js");
onView(withClassName(Matchers.is(WXRecyclerView.class.getName()))).perform
(RecyclerViewActions.scrollToPosition(0));
return benchmarkActivity.getWXInstance().getWXPerformance().screenRenderTime;
Expand Down
Binary file modified android/sdk/libs/armeabi/libweexjsc.so
Binary file not shown.
Binary file modified android/sdk/libs/armeabi/libweexjss.so
Binary file not shown.
102 changes: 59 additions & 43 deletions android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.taobao.weex;

import static com.taobao.weex.http.WXHttpUtil.KEY_USER_AGENT;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
Expand All @@ -28,13 +30,14 @@
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.RestrictTo.Scope;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;

import com.alibaba.fastjson.JSONObject;
import com.taobao.weex.adapter.IDrawableLoader;
import com.taobao.weex.adapter.IWXHttpAdapter;
Expand Down Expand Up @@ -68,6 +71,7 @@
import com.taobao.weex.ui.component.WXBasicComponentType;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.ui.component.WXComponentFactory;
import com.taobao.weex.ui.flat.FlatGUIContext;
import com.taobao.weex.ui.view.WXScrollView;
import com.taobao.weex.ui.view.WXScrollView.WXScrollViewListener;
import com.taobao.weex.utils.Trace;
Expand All @@ -76,8 +80,6 @@
import com.taobao.weex.utils.WXLogUtils;
import com.taobao.weex.utils.WXReflectionUtils;
import com.taobao.weex.utils.WXViewUtils;
import com.taobao.weex.WXSDKEngine;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -86,9 +88,6 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import static com.taobao.weex.http.WXHttpUtil.KEY_USER_AGENT;


/**
* Each instance of WXSDKInstance represents an running weex instance.
* It can be a pure weex view, or mixed with native view
Expand Down Expand Up @@ -120,6 +119,8 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext, View.
private boolean mNeedReLoad = false;
private static volatile int mViewPortWidth = 750;
private int mInstanceViewPortWidth = 750;
private @NonNull
FlatGUIContext mFlatGUIContext =new FlatGUIContext();

public long mRenderStartNanos;
public int mExecJSTraceId = WXTracing.nextId();
Expand Down Expand Up @@ -200,6 +201,12 @@ public void enableLayerType(boolean enable) {
enableLayerType = enable;
}

@RestrictTo(Scope.LIBRARY)
public @NonNull
FlatGUIContext getFlatUIContext(){
return mFlatGUIContext;
}

public boolean isNeedValidate() {
return mNeedValidate;
}
Expand Down Expand Up @@ -251,6 +258,7 @@ public WXSDKInstance(Context context) {
/**
* For unittest only.
*/
@RestrictTo(Scope.TESTS)
WXSDKInstance(Context context,String id) {
mInstanceId = id;
init(context);
Expand Down Expand Up @@ -606,21 +614,23 @@ private String assembleFilePath(Uri uri) {
return "";
}

public void reloadPage() {
public void reloadPage(boolean reloadThis) {

WXSDKEngine.reload();

// 可以发送广播吗?
if (mContext != null) {
Intent intent = new Intent();
intent.setAction(IWXDebugProxy.ACTION_INSTANCE_RELOAD);
intent.putExtra("url", mBundleUrl);
mContext.sendBroadcast(intent);
if (reloadThis) {
// 可以发送广播吗?
if (mContext != null) {
Intent intent = new Intent();
intent.setAction(IWXDebugProxy.ACTION_INSTANCE_RELOAD);
intent.putExtra("url", mBundleUrl);
mContext.sendBroadcast(intent);
}
// mRendered = false;
// destroy();
// renderInternal(mPackage, mTemplate, mOptions, mJsonInitData, mFlag);
// refreshInstance("{}");
}
// mRendered = false;
// destroy();
// renderInternal(mPackage, mTemplate, mOptions, mJsonInitData, mFlag);
// refreshInstance("{}");

}
/**
* Refresh instance asynchronously.
Expand Down Expand Up @@ -1249,35 +1259,41 @@ private void destroyView(View rootView) {
}

public synchronized void destroy() {
WXSDKManager.getInstance().destroyInstance(mInstanceId);
WXComponentFactory.removeComponentTypesByInstanceId(getInstanceId());
if(!isDestroy()) {
WXSDKManager.getInstance().destroyInstance(mInstanceId);
WXComponentFactory.removeComponentTypesByInstanceId(getInstanceId());

if(mGlobalEventReceiver!=null){
getContext().unregisterReceiver(mGlobalEventReceiver);
mGlobalEventReceiver=null;
}
if(mRootComp != null ) {
mRootComp.destroy();
destroyView(mRenderContainer);
mRenderContainer = null;
mRootComp = null;
}
if (mGlobalEventReceiver != null) {
getContext().unregisterReceiver(mGlobalEventReceiver);
mGlobalEventReceiver = null;
}
if (mRootComp != null) {
mRootComp.destroy();
destroyView(mRenderContainer);
mRootComp = null;
}

if(mGlobalEvents!=null){
mGlobalEvents.clear();
}
if (mGlobalEvents != null) {
mGlobalEvents.clear();
}

if(mComponentObserver != null){
if (mComponentObserver != null) {
mComponentObserver = null;
}
}

mNestedInstanceInterceptor = null;
mUserTrackAdapter = null;
mScrollView = null;
mContext = null;
mRenderListener = null;
isDestroy = true;
mStatisticsListener = null;
getFlatUIContext().destroy();
mFlatGUIContext = null;

mWXScrollListeners = null;
mRenderContainer = null;
mNestedInstanceInterceptor = null;
mUserTrackAdapter = null;
mScrollView = null;
mContext = null;
mRenderListener = null;
isDestroy = true;
mStatisticsListener = null;
}
}

public boolean isDestroy(){
Expand Down Expand Up @@ -1484,7 +1500,7 @@ public void fireModuleEvent(String eventName, WXModule module,Map<String, Object
* Check whether the current module registered the event
* @param eventName EventName register in weex
* @param module Events occur in this Module
* @return register->true
* @return boolean true
*/
public boolean checkModuleEventRegistered(String eventName,WXModule module) {
if (module != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* Created by moxun on 17/1/3.
* @link {https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent">CloseEvent</a>
*/

public enum WebSocketCloseCodes {
Expand Down
Loading

0 comments on commit b0e072a

Please sign in to comment.