You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/03/14 08:15:49 UTC
[1/8] incubator-weex git commit: * [android] update modify nullpoint
Repository: incubator-weex
Updated Branches:
refs/heads/0.12-dev 1b3cd3f2a -> 6057668f8
* [android] update modify nullpoint
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/74f31a67
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/74f31a67
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/74f31a67
Branch: refs/heads/0.12-dev
Commit: 74f31a67de3880947d222fa1ab7923712a30bdb8
Parents: 9fb9fbf
Author: xkli <56...@qq.com>
Authored: Mon Mar 13 17:35:56 2017 +0800
Committer: xkli <56...@qq.com>
Committed: Mon Mar 13 17:35:56 2017 +0800
----------------------------------------------------------------------
.../java/com/alibaba/weex/WXPageActivity.java | 2 +-
.../extend/module/location/DefaultLocation.java | 110 ++++++++++---------
2 files changed, 61 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/74f31a67/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java
----------------------------------------------------------------------
diff --git a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java
index af74bd7..f8c9b96 100755
--- a/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java
+++ b/android/playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java
@@ -358,7 +358,7 @@ public class WXPageActivity extends WXBaseActivity implements IWXRenderListener,
Rect outRect = new Rect();
ctx.getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect);
mConfigMap.put("bundleUrl", mUri.toString());
- String path = mUri.getScheme().equals("file") ? assembleFilePath(mUri) : mUri.toString();
+ String path = "file".equals(mUri.getScheme()) ? assembleFilePath(mUri) : mUri.toString();
mInstance.render(TAG, WXFileUtils.loadAsset(path, WXPageActivity.this),
mConfigMap, null,
WXRenderStrategy.APPEND_ASYNC);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/74f31a67/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java
----------------------------------------------------------------------
diff --git a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java
index 807d0fc..d1ad55b 100644
--- a/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java
+++ b/android/playground/app/src/main/java/com/alibaba/weex/extend/module/location/DefaultLocation.java
@@ -219,12 +219,12 @@ import android.os.Message;
import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
-import com.taobao.weex.WXEnvironment;
import com.taobao.weex.WXSDKInstance;
-import com.taobao.weex.WXSDKManager;
+import com.taobao.weex.bridge.SimpleJSCallback;
import com.taobao.weex.utils.WXLogUtils;
import org.json.JSONException;
+import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collection;
@@ -233,9 +233,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-/**
- * Created by lixinke on 16/9/10.
- */
public class DefaultLocation implements ILocatable {
private static final String TAG = "DefaultLocation";
@@ -261,12 +258,10 @@ public class DefaultLocation implements ILocatable {
@Override
public void getCurrentPosition(final String successCallback, final String errorCallback, final String params) {
- if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "into--[getCurrentPosition] successCallback:" + successCallback + " \nerrorCallback:" + errorCallback + " \nparams:" + params);
- }
+ WXLogUtils.d(TAG, "into--[getCurrentPosition] successCallback:" + successCallback + " \nerrorCallback:" + errorCallback + " \nparams:" + params);
if (!TextUtils.isEmpty(params)) {
try {
- org.json.JSONObject jsObj = new org.json.JSONObject(params);
+ JSONObject jsObj = new JSONObject(params);
boolean enableHighAccuracy = jsObj.optBoolean("enableHighAccuracy");
boolean enableAddress = jsObj.optBoolean("address");
WXLocationListener listener = findLocation(null, successCallback, errorCallback, enableHighAccuracy, enableAddress);
@@ -281,11 +276,13 @@ public class DefaultLocation implements ILocatable {
Map<String, Object> options = new HashMap<>();
options.put(ERROR_CODE, ErrorCode.PARAMS_ERROR);
options.put(ERROR_MSG, ErrorMsg.PARAMS_ERROR);
- WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), errorCallback, options);
+ if (mWXSDKInstance != null) {
+ new SimpleJSCallback(mWXSDKInstance.getInstanceId(), errorCallback).invoke(options);
+ }
}
private WXLocationListener findLocation(String watchId, String sucCallback, String errorCallback, boolean enableHighAccuracy, boolean enableAddress) {
-// WXLogUtils.d(TAG, "into--[findLocation] mWatchId:" + watchId + "\nsuccessCallback:" + sucCallback + "\nerrorCallback:" + errorCallback + "\nenableHighAccuracy:" + enableHighAccuracy + "\nmEnableAddress:" + enableAddress);
+ WXLogUtils.d(TAG, "into--[findLocation] mWatchId:" + watchId + "\nsuccessCallback:" + sucCallback + "\nerrorCallback:" + errorCallback + "\nenableHighAccuracy:" + enableHighAccuracy + "\nmEnableAddress:" + enableAddress);
if (mLocationManager == null) {
mLocationManager = (LocationManager) mWXSDKInstance.getContext().getSystemService(Context.LOCATION_SERVICE);
@@ -297,14 +294,20 @@ public class DefaultLocation implements ILocatable {
//String provider = locationManager.getBestProvider(criteria, false);
if (ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
WXLocationListener WXLocationListener = new WXLocationListener(mLocationManager, mWXSDKInstance, watchId, sucCallback, errorCallback, enableAddress);
- mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME, MIN_DISTANCE, WXLocationListener);
- mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME, MIN_DISTANCE, WXLocationListener);
+ if (mLocationManager.getAllProviders().contains(LocationManager.GPS_PROVIDER)) {
+ mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME, MIN_DISTANCE, WXLocationListener);
+ }
+ if (mLocationManager.getAllProviders().contains(LocationManager.NETWORK_PROVIDER)) {
+ mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME, MIN_DISTANCE, WXLocationListener);
+ }
return WXLocationListener;
} else {
Map<String, Object> options = new HashMap<>();
options.put(ERROR_CODE, ErrorCode.NO_PERMISSION_ERROR);
options.put(ERROR_MSG, ErrorMsg.NO_PERMISSION_ERROR);
- WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), errorCallback, options);
+ if (mWXSDKInstance != null) {
+ new SimpleJSCallback(mWXSDKInstance.getInstanceId(), errorCallback).invoke(options);
+ }
}
return null;
}
@@ -314,7 +317,7 @@ public class DefaultLocation implements ILocatable {
WXLogUtils.d("into--[watchPosition] successCallback:" + successCallback + " errorCallback:" + errorCallback + "\nparams:" + params);
if (!TextUtils.isEmpty(params)) {
try {
- org.json.JSONObject jsObj = new org.json.JSONObject(params);
+ JSONObject jsObj = new JSONObject(params);
boolean enableHighAccuracy = jsObj.optBoolean("enableHighAccuracy");
boolean enableAddress = jsObj.optBoolean("address");
@@ -331,7 +334,9 @@ public class DefaultLocation implements ILocatable {
Map<String, Object> options = new HashMap<>();
options.put(ERROR_CODE, ErrorCode.PARAMS_ERROR);
options.put(ERROR_MSG, ErrorMsg.PARAMS_ERROR);
- WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), errorCallback, options);
+ if (mWXSDKInstance != null) {
+ new SimpleJSCallback(mWXSDKInstance.getInstanceId(), errorCallback).invoke(options);
+ }
}
@Override
@@ -383,39 +388,31 @@ public class DefaultLocation implements ILocatable {
static class WXLocationListener implements LocationListener, Handler.Callback {
- private WXSDKInstance mWXSDKInstance;
+ private Context mContext = null;
private String mWatchId;
- private String mSucCallback;
- private String mErrorCallback;
+ private SimpleJSCallback mSucCallback = null;
+ private SimpleJSCallback mErrorCallback = null;
private boolean mEnableAddress;
private Handler mHandler;
private LocationManager mLocationManager;
private WXLocationListener(LocationManager locationManager, WXSDKInstance instance, String watchId, String sucCallback, String errorCallback, boolean enableAddress) {
- mWXSDKInstance = instance;
this.mWatchId = watchId;
- this.mSucCallback = sucCallback;
- this.mErrorCallback = errorCallback;
+ if (instance != null) {
+ this.mSucCallback = new SimpleJSCallback(instance.getInstanceId(), sucCallback);
+ this.mErrorCallback = new SimpleJSCallback(instance.getInstanceId(), errorCallback);
+ mContext = instance.getContext();
+ }
this.mEnableAddress = enableAddress;
mHandler = new Handler(this);
mLocationManager = locationManager;
-// WVThreadPool.getInstance().execute(new Runnable() {
-// public void run() {
- mHandler.sendEmptyMessageDelayed(TIME_OUT_WHAT, GPS_TIMEOUT);
-// }
-// });
+ mHandler.sendEmptyMessageDelayed(TIME_OUT_WHAT, GPS_TIMEOUT);
}
@Override
public void onLocationChanged(Location location) {
mHandler.removeMessages(TIME_OUT_WHAT);
- if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "into--[onLocationChanged] location:" + location == null ? "Location is NULL!" : location.toString());
- }
-
- if (mWXSDKInstance == null || mWXSDKInstance.isDestroy()) {
- return;
- }
+ WXLogUtils.d(TAG, "into--[onLocationChanged] location:" + location == null ? "Location is NULL!" : location.toString());
if (location != null) {
Map<String, Object> result = new HashMap<>();
@@ -457,7 +454,15 @@ public class DefaultLocation implements ILocatable {
if (!TextUtils.isEmpty(mWatchId)) {
result.put(WATCH_ID, mWatchId);
}
- WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), mSucCallback, result, TextUtils.isEmpty(mWatchId) ? false : true);
+
+ if (mSucCallback != null) {
+ boolean isKeepAlive = TextUtils.isEmpty(mWatchId) ? false : true;
+ if (isKeepAlive) {
+ mSucCallback.invokeAndKeepAlive(result);
+ } else {
+ mSucCallback.invoke(result);
+ }
+ }
} else {
Map<String, Object> options = new HashMap<>();
options.put(ERROR_CODE, ErrorCode.LOCATION_ERROR);
@@ -465,10 +470,17 @@ public class DefaultLocation implements ILocatable {
if (!TextUtils.isEmpty(mWatchId)) {
options.put(WATCH_ID, mWatchId);
}
- WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), mErrorCallback, options, TextUtils.isEmpty(mWatchId) ? false : true);
+ if (mErrorCallback != null) {
+ boolean isKeepAlive = TextUtils.isEmpty(mWatchId) ? false : true;
+ if (isKeepAlive) {
+ mErrorCallback.invokeAndKeepAlive(options);
+ } else {
+ mErrorCallback.invoke(options);
+ }
+ }
}
- if (TextUtils.isEmpty(mWatchId)) {
- if (mLocationManager != null && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
+ if (TextUtils.isEmpty(mWatchId) && mContext != null) {
+ if (mLocationManager != null && ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
destroy();
mLocationManager.removeUpdates(this);
}
@@ -493,13 +505,11 @@ public class DefaultLocation implements ILocatable {
@Override
public boolean handleMessage(Message msg) {
if (msg.what == TIME_OUT_WHAT) {
- if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "into--[handleMessage] Location Time Out!");
- }
- if (mWXSDKInstance == null || mWXSDKInstance.isDestroy() || mLocationManager == null) {
+ WXLogUtils.d(TAG, "into--[handleMessage] Location Time Out!");
+ if (mContext == null || mLocationManager == null) {
return false;
}
- if (ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
+ if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
mLocationManager.removeUpdates(this);
}
Map<String, Object> options = new HashMap<>();
@@ -508,7 +518,9 @@ public class DefaultLocation implements ILocatable {
if (!TextUtils.isEmpty(mWatchId)) {
options.put(WATCH_ID, mWatchId);
}
- WXSDKManager.getInstance().callback(mWXSDKInstance.getInstanceId(), mErrorCallback, options);
+ if (mErrorCallback != null) {
+ mErrorCallback.invoke(options);
+ }
return true;
}
return false;
@@ -518,14 +530,12 @@ public class DefaultLocation implements ILocatable {
* get address info
*/
private Address getAddress(double latitude, double longitude) {
- if(WXEnvironment.isApkDebugable()) {
- WXLogUtils.d(TAG, "into--[getAddress] latitude:" + latitude + " longitude:" + longitude);
- }
+ WXLogUtils.d(TAG, "into--[getAddress] latitude:" + latitude + " longitude:" + longitude);
try {
- if (mWXSDKInstance == null || mWXSDKInstance.isDestroy()) {
+ if (mContext == null) {
return null;
}
- Geocoder gc = new Geocoder(mWXSDKInstance.getContext());
+ Geocoder gc = new Geocoder(mContext);
List<Address> list = gc.getFromLocation(latitude, longitude, 1);
if (list != null && list.size() > 0) {
return list.get(0);
@@ -539,7 +549,7 @@ public class DefaultLocation implements ILocatable {
public void destroy() {
if (mHandler != null) {
mHandler.removeMessages(TIME_OUT_WHAT);
- mWXSDKInstance=null;
+ mContext = null;
}
}
}
[8/8] incubator-weex git commit: Merge branch '0.11-dev' into 0.12-dev
Posted by so...@apache.org.
Merge branch '0.11-dev' into 0.12-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6057668f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6057668f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6057668f
Branch: refs/heads/0.12-dev
Commit: 6057668f89a7ad2c0636281ff9a4555851b0777a
Parents: 1b3cd3f 9453a48
Author: sospartan <so...@gmail.com>
Authored: Tue Mar 14 16:15:35 2017 +0800
Committer: sospartan <so...@gmail.com>
Committed: Tue Mar 14 16:15:35 2017 +0800
----------------------------------------------------------------------
.../java/com/alibaba/weex/WXPageActivity.java | 2 +-
.../extend/module/location/DefaultLocation.java | 110 ++++++++++---------
.../taobao/weex/ui/component/WXComponent.java | 5 +-
.../adapter/WXRecyclerViewOnScrollListener.java | 28 +++--
4 files changed, 84 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
[7/8] incubator-weex git commit: Merge branch '0.11-dev-bugfix' of
github.com:zshshr/incubator-weex into 0.11-dev This closes #101
Posted by so...@apache.org.
Merge branch '0.11-dev-bugfix' of github.com:zshshr/incubator-weex into 0.11-dev
This closes #101
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9453a487
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9453a487
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9453a487
Branch: refs/heads/0.12-dev
Commit: 9453a487741dbfb222e6fd08019e04d3b32c5619
Parents: 26c025b f71ea6f
Author: sospartan <so...@gmail.com>
Authored: Tue Mar 14 16:14:43 2017 +0800
Committer: sospartan <so...@gmail.com>
Committed: Tue Mar 14 16:14:43 2017 +0800
----------------------------------------------------------------------
.../taobao/weex/ui/component/WXComponent.java | 5 +++-
.../adapter/WXRecyclerViewOnScrollListener.java | 28 +++++++++++++-------
2 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9453a487/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
[6/8] incubator-weex git commit: Merge branch '0.11-dev' of
github.com:xkli/incubator-weex into 0.11-dev This closes #102
Posted by so...@apache.org.
Merge branch '0.11-dev' of github.com:xkli/incubator-weex into 0.11-dev
This closes #102
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/26c025b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/26c025b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/26c025b2
Branch: refs/heads/0.12-dev
Commit: 26c025b25c03fb5fb78d1c2398a308e12faf776d
Parents: de623be 74f31a6
Author: sospartan <so...@gmail.com>
Authored: Tue Mar 14 16:14:16 2017 +0800
Committer: sospartan <so...@gmail.com>
Committed: Tue Mar 14 16:14:16 2017 +0800
----------------------------------------------------------------------
.../java/com/alibaba/weex/WXPageActivity.java | 2 +-
.../extend/module/location/DefaultLocation.java | 110 ++++++++++---------
2 files changed, 61 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
[2/8] incubator-weex git commit: * [android] fix crash of
RuntimeException
Posted by so...@apache.org.
* [android] fix crash of RuntimeException
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f7977e35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f7977e35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f7977e35
Branch: refs/heads/0.12-dev
Commit: f7977e35bfd6cd1fd8c93bdd495903a663181c8f
Parents: ae7b081
Author: zshshr <zh...@gmail.com>
Authored: Tue Mar 14 11:48:06 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Tue Mar 14 11:48:06 2017 +0800
----------------------------------------------------------------------
.../main/java/com/taobao/weex/ui/component/WXComponent.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f7977e35/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index 5e7adc8..ffd32f6 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -145,6 +145,7 @@ import android.text.TextUtils;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
import android.widget.FrameLayout;
import com.alibaba.fastjson.JSONArray;
@@ -1069,7 +1070,11 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
}
if(mHost != null) {
mHost.setOnFocusChangeListener(null);
- mHost.setOnClickListener(null);
+ if(mHost instanceof AdapterView){
+ ((AdapterView)mHost).setOnItemClickListener(null);
+ }else {
+ mHost.setOnClickListener(null);
+ }
}
}
[3/8] incubator-weex git commit: Merge branch '0.11-dev' of
http://gitlab.alibaba-inc.com/weex/weex into 0.11-dev
Posted by so...@apache.org.
Merge branch '0.11-dev' of http://gitlab.alibaba-inc.com/weex/weex into 0.11-dev
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f759a8ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f759a8ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f759a8ce
Branch: refs/heads/0.12-dev
Commit: f759a8cea6b9c0f3a66cfb5b2be4cd8eebe6f72f
Parents: f7977e3 d876e67
Author: zshshr <zh...@gmail.com>
Authored: Tue Mar 14 11:48:26 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Tue Mar 14 11:48:26 2017 +0800
----------------------------------------------------------------------
android/sdk/assets/main.js | 14 +++++++-------
.../src/main/java/com/taobao/weex/WXSDKInstance.java | 4 ++++
.../weex/ui/component/AbstractEditComponent.java | 6 ++++++
.../com/taobao/weex/ui/component/WXComponent.java | 12 +++++++++++-
.../taobao/weex/ui/component/pesudo/PesudoStatus.java | 2 +-
.../main/java/com/taobao/weex/utils/WXViewUtils.java | 2 +-
ios/sdk/WeexSDK/Resources/main.js | 14 +++++++-------
7 files changed, 37 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f759a8ce/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
[4/8] incubator-weex git commit: * [android] protect NPE for
support-v7
Posted by so...@apache.org.
* [android] protect NPE for support-v7
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/23d8e9df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/23d8e9df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/23d8e9df
Branch: refs/heads/0.12-dev
Commit: 23d8e9df996d0d96e0f920bb3e0056f40b6c9569
Parents: f759a8c
Author: zshshr <zh...@gmail.com>
Authored: Tue Mar 14 14:22:07 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Tue Mar 14 14:22:07 2017 +0800
----------------------------------------------------------------------
.../adapter/WXRecyclerViewOnScrollListener.java | 24 ++++++++++++--------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23d8e9df/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
index 4a0d69a..597c1cb 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
@@ -312,15 +312,21 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
if (mFirstPositions == null || newSpanCount != mFirstPositions.length) {
mFirstPositions = new int[newSpanCount];
}
- staggeredGridLayoutManager.findFirstVisibleItemPositions(mFirstPositions);
- mFirstVisibleItemPosition = findMin(mFirstPositions);
- staggeredGridLayoutManager.findLastVisibleItemPositions(mLastPositions);
- mLastVisibleItemPosition = findMax(mLastPositions);
- iOnLoadMoreListener.notifyAppearStateChange(
- mFirstVisibleItemPosition
- , mLastVisibleItemPosition
- , dx
- , dy);
+ try{
+ staggeredGridLayoutManager.findFirstVisibleItemPositions(mFirstPositions);
+ mFirstVisibleItemPosition = findMin(mFirstPositions);
+ staggeredGridLayoutManager.findLastVisibleItemPositions(mLastPositions);
+ mLastVisibleItemPosition = findMax(mLastPositions);
+ iOnLoadMoreListener.notifyAppearStateChange(
+ mFirstVisibleItemPosition
+ , mLastVisibleItemPosition
+ , dx
+ , dy);
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
} else {
throw new RuntimeException(
"Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager");
[5/8] incubator-weex git commit: * [android] clear hostView
clickListener if need
Posted by so...@apache.org.
* [android] clear hostView clickListener if need
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/f71ea6f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/f71ea6f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/f71ea6f9
Branch: refs/heads/0.12-dev
Commit: f71ea6f9f84be8a30bfa22aea570837f1d9d1f07
Parents: 23d8e9d
Author: zshshr <zh...@gmail.com>
Authored: Tue Mar 14 15:32:46 2017 +0800
Committer: zshshr <zh...@gmail.com>
Committed: Tue Mar 14 15:32:46 2017 +0800
----------------------------------------------------------------------
.../main/java/com/taobao/weex/ui/component/WXComponent.java | 6 ++----
.../view/listview/adapter/WXRecyclerViewOnScrollListener.java | 4 ++++
2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f71ea6f9/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index 7ce5b88..fb3eb1b 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -145,7 +145,6 @@ import android.text.TextUtils;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
import android.widget.FrameLayout;
import com.alibaba.fastjson.JSONArray;
@@ -1071,9 +1070,8 @@ public abstract class WXComponent<T extends View> implements IWXObject, IWXActi
}
if(mHost != null) {
mHost.setOnFocusChangeListener(null);
- if(mHost instanceof AdapterView){
- ((AdapterView)mHost).setOnItemClickListener(null);
- }else {
+ if (mHostClickListeners != null && mHostClickListeners.size() > 0) {
+ mHostClickListeners.clear();
mHost.setOnClickListener(null);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/f71ea6f9/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
index 597c1cb..ef8d149 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
@@ -209,6 +209,8 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
+import com.taobao.weex.utils.WXLogUtils;
+
import java.lang.ref.WeakReference;
@@ -312,6 +314,7 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
if (mFirstPositions == null || newSpanCount != mFirstPositions.length) {
mFirstPositions = new int[newSpanCount];
}
+ //avoid crash of support-v7 original bug
try{
staggeredGridLayoutManager.findFirstVisibleItemPositions(mFirstPositions);
mFirstVisibleItemPosition = findMin(mFirstPositions);
@@ -325,6 +328,7 @@ public class WXRecyclerViewOnScrollListener extends RecyclerView.OnScrollListene
}catch(Exception e){
e.printStackTrace();
+ WXLogUtils.e(e.toString());
}
} else {