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

Commit 15662fa

Browse files
committed
Monitor usage of template.
1 parent a0b166b commit 15662fa

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
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.8
48+
VERSION_NAME=1.4.9
4949
PACKAGING_TYPE=aar
5050
systemProp.compileSdkVersion=26
5151
systemProp.targetSdkVersion=26

virtualview/src/main/java/com/tmall/wireless/vaf/framework/VafContext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import com.tmall.wireless.vaf.virtualview.event.ClickProcessorManager;
4545
import com.tmall.wireless.vaf.virtualview.event.EventData;
4646
import com.tmall.wireless.vaf.virtualview.event.EventManager;
47+
import com.tmall.wireless.vaf.virtualview.listener.MonitorListener;
4748
import com.tmall.wireless.vaf.virtualview.loader.StringLoader;
4849

4950
/**
@@ -73,6 +74,8 @@ public class VafContext {
7374

7475
protected Activity mCurActivity;
7576

77+
public static MonitorListener monitorListener;
78+
7679
public ComContainerTypeMap getComContainerTypeMap() {
7780
return mComContainerTypeMap;
7881
}

virtualview/src/main/java/com/tmall/wireless/vaf/framework/cm/ContainerService.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public View getContainer(String viewType, int containerType, boolean createParam
146146
if (null == vb) {
147147
vb = mVM.getDefaultImage();
148148
vb.setViewType(viewType);
149-
if (mAppContext.getService(MonitorListener.class) != null) {
150-
mAppContext.getService(MonitorListener.class).onTemplateNotFound(viewType);
149+
if (VafContext.monitorListener != null) {
150+
VafContext.monitorListener.onTemplateNotFound(viewType);
151151
}
152152
}
153153

@@ -162,6 +162,10 @@ public View getContainer(String viewType, int containerType, boolean createParam
162162
}
163163
}
164164

165+
if (VafContext.monitorListener != null){
166+
VafContext.monitorListener.monitorUsage(viewType);
167+
}
168+
165169
if (null != container) {
166170
container.setVirtualView(vb);
167171
if (createParam) {

virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/listener/MonitorListener.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22

33
public interface MonitorListener {
44
void onTemplateNotFound(String type);
5+
6+
/**
7+
* When a template be used, would invoke this method.
8+
*
9+
* @param type template name
10+
*/
11+
void monitorUsage(String type);
512
}

0 commit comments

Comments
 (0)