Skip to content
This repository was archived by the owner on Jul 14, 2021. It is now read-only.

Commit a17ea67

Browse files
committed
Log on debug status only. Use BuildConfig.DEBUG to open it.
1 parent 9f42225 commit a17ea67

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ org.gradle.jvmargs=-Xmx2048m
4545
GROUP=com.alibaba.android
4646
ARTIFACT=virtualview
4747
VERSION=1
48-
VERSION_NAME=1.4.4
48+
VERSION_NAME=1.4.5
4949
PACKAGING_TYPE=aar
5050
systemProp.compileSdkVersion=26
5151
systemProp.targetSdkVersion=26

virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/ViewFactory.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import android.util.DisplayMetrics;
3636
import android.util.Log;
3737
import android.util.SparseArray;
38+
3839
import com.libra.TextUtils;
3940
import com.libra.virtualview.common.Common;
4041
import com.tmall.wireless.vaf.framework.VafContext;
@@ -76,6 +77,7 @@
7677
import com.tmall.wireless.vaf.virtualview.view.text.NativeText;
7778
import com.tmall.wireless.vaf.virtualview.view.text.VirtualText;
7879
import com.tmall.wireless.vaf.virtualview.view.vh.VH;
80+
import com.tmall.wireless.virtualview.BuildConfig;
7981

8082
/**
8183
* Created by gujicheng on 16/8/16.
@@ -99,6 +101,7 @@ public class ViewFactory {
99101
mLoader.setUiCodeManager(mUiCodeLoader);
100102
mLoader.setExprCodeManager(mExprCodeLoader);
101103
}
104+
102105
private SparseArray<ViewBase.IBuilder> mBuilders = new SparseArray<>();
103106

104107
private VafContext mAppContext;
@@ -199,7 +202,9 @@ public void loadBinBufferAsync(String type, byte[] buf) {
199202
public void loadBinBufferAsync(String type, byte[] buf, boolean override) {
200203
if (!TextUtils.isEmpty(type) && buf != null) {
201204
if (mTmplWorker.isRunning()) {
202-
Log.d(TAG, "load " + type + " start ");
205+
if (BuildConfig.DEBUG) {
206+
Log.d(TAG, "load " + type + " start ");
207+
}
203208
mTmplWorker.offerTask(new TmplTask(type, buf, override));
204209
}
205210
}
@@ -298,7 +303,7 @@ public ViewBase newView(String type, SparseArray<ViewBase> uuidContainers) {
298303
if (null != view) {
299304
Layout.Params p;
300305
if (null != curView) {
301-
p = ((Layout)curView).generateParams();
306+
p = ((Layout) curView).generateParams();
302307
mComArr.push(curView);
303308
} else {
304309
p = new Layout.Params();
@@ -417,7 +422,7 @@ public ViewBase newView(String type, SparseArray<ViewBase> uuidContainers) {
417422
ret = curView;
418423
cr.seek(Common.TAG.length() + 4);
419424
int version = cr.readShort();
420-
ret.setVersion(version );
425+
ret.setVersion(version);
421426
}
422427
} else {
423428
Log.e(TAG, "can not find component type:" + type);

virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/loader/BinaryLoader.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import com.libra.virtualview.common.Common;
3131
import com.tmall.wireless.vaf.framework.VafContext;
32+
import com.tmall.wireless.virtualview.BuildConfig;
3233

3334
import java.io.FileInputStream;
3435
import java.io.FileNotFoundException;
@@ -158,7 +159,9 @@ public int loadFromBuffer(byte[] buf, boolean override) {
158159
Log.e(TAG, "mStringManager is null");
159160
}
160161
} else {
161-
Log.e(TAG, "string pos error:" + strStartPos + " read pos:" + reader.getPos());
162+
if (BuildConfig.DEBUG) {
163+
Log.e(TAG, "string pos error:" + strStartPos + " read pos:" + reader.getPos());
164+
}
162165
}
163166

164167
// parse expr
@@ -169,13 +172,17 @@ public int loadFromBuffer(byte[] buf, boolean override) {
169172
Log.e(TAG, "mExprCodeStore is null");
170173
}
171174
} else {
172-
Log.e(TAG, "expr pos error:" + exprCodeStartPos + " read pos:" + reader.getPos());
175+
if (BuildConfig.DEBUG) {
176+
Log.e(TAG, "expr pos error:" + exprCodeStartPos + " read pos:" + reader.getPos());
177+
}
173178
}
174179

175180
// load extra data
176181
if (reader.getPos() == extraStartPos) {
177182
} else {
178-
Log.e(TAG, "extra pos error:" + extraStartPos + " read pos:" + reader.getPos());
183+
if (BuildConfig.DEBUG) {
184+
Log.e(TAG, "extra pos error:" + extraStartPos + " read pos:" + reader.getPos());
185+
}
179186
}
180187

181188
if (result) {

virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/loader/StringLoader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
import java.util.concurrent.ConcurrentHashMap;
2929

3030
import android.util.Log;
31+
3132
import com.libra.TextUtils;
3233
import com.libra.expr.common.StringSupport;
3334
import com.libra.virtualview.common.StringBase;
35+
import com.tmall.wireless.virtualview.BuildConfig;
3436

3537
/**
3638
* Created by gujicheng on 16/8/3.
@@ -108,7 +110,9 @@ public String getString(int id) {
108110
if (mIndex2String.containsKey(id)) {
109111
return mIndex2String.get(id);
110112
}
111-
Log.e(TAG, "getString null:" + id);
113+
if (BuildConfig.DEBUG) {
114+
Log.e(TAG, "getString null:" + id);
115+
}
112116
return null;
113117
}
114118

0 commit comments

Comments
 (0)