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

Commit

Permalink
* [Android] Update 0 zero column report as column is not used when mL…
Browse files Browse the repository at this point in the history
…ayoutType == TYPE_LINEAR_LAYOUT (#1785)
  • Loading branch information
YorkShen committed Nov 20, 2018
1 parent 8949b2d commit a49f83a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package com.taobao.weex.ui.component.list;

import static com.taobao.weex.ui.view.listview.WXRecyclerView.TYPE_LINEAR_LAYOUT;

import android.content.Context;
import android.support.v4.util.ArrayMap;
import android.support.v7.widget.PagerSnapHelper;
Expand Down Expand Up @@ -171,13 +173,15 @@ public void run() {

private void updateRecyclerAttr() {
mColumnCount = WXUtils.parseInt(getAttrs().get(Constants.Name.COLUMN_COUNT));
if (mColumnCount <= 0) {
if (mColumnCount <= 0 && mLayoutType != TYPE_LINEAR_LAYOUT) {
Map<String, String> ext = new ArrayMap<>();
ext.put("componentType", getComponentType());
WXExceptionUtils.commitCriticalExceptionRT(getInstanceId(),
WXErrorCode.WX_RENDER_ERR_LIST_INVALID_COLUMN_COUNT, "columnCount",
String.format(Locale.ENGLISH,
"You are trying to set the list/recycler/vlist/waterfall's column to %d, which is illegal. The column count should be a positive integer",
mColumnCount),
new ArrayMap<String, String>());
ext);
mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
}
mColumnGap = WXUtils.parseFloat(getAttrs().get(Constants.Name.COLUMN_GAP));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package com.taobao.weex.ui.component.list.template;

import static com.taobao.weex.common.Constants.Name.LOADMOREOFFSET;
import static com.taobao.weex.ui.view.listview.WXRecyclerView.TYPE_LINEAR_LAYOUT;

import android.annotation.TargetApi;
import android.content.Context;
Expand Down Expand Up @@ -110,7 +111,7 @@ public class WXRecyclerTemplateList extends WXVContainer<BounceRecyclerView> imp

// TODO
// private WXRecyclerDomObject mDomObject;
protected int mLayoutType = WXRecyclerView.TYPE_LINEAR_LAYOUT;
protected int mLayoutType = TYPE_LINEAR_LAYOUT;
protected int mColumnCount = 1;
protected float mColumnGap = 0;
protected float mColumnWidth = 0;
Expand Down Expand Up @@ -929,13 +930,15 @@ public void setOffsetAccuracy(int accuracy) {
private void updateRecyclerAttr(){
mLayoutType = getAttrs().getLayoutType();
mColumnCount = getAttrs().getColumnCount();
if (mColumnCount <= 0) {
if (mColumnCount <= 0 && mLayoutType != TYPE_LINEAR_LAYOUT) {
Map<String, String> ext = new ArrayMap<>();
ext.put("componentType", getComponentType());
WXExceptionUtils.commitCriticalExceptionRT(getInstanceId(),
WXErrorCode.WX_RENDER_ERR_LIST_INVALID_COLUMN_COUNT, "columnCount",
String.format(Locale.ENGLISH,
"You are trying to set the list/recycler/vlist/waterfall's column to %d, which is illegal. The column count should be a positive integer",
mColumnCount),
new ArrayMap<String, String>());
ext);
mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
}
mColumnGap = getAttrs().getColumnGap();
Expand Down

0 comments on commit a49f83a

Please sign in to comment.