use of com.tmall.wireless.virtualviewdemo.custom.ClickProcessorImpl in project Virtualview-Android by alibaba.
the class LocalPreviewActivity method initForPreview.
private void initForPreview() {
if (mVafContext == null) {
mVafContext = new VafContext(this);
mVafContext.setImageLoaderAdapter(new IImageLoaderAdapter() {
private List<ImageTarget> cache = new ArrayList<ImageTarget>();
@Override
public void bindImage(String uri, final ImageBase imageBase, int reqWidth, int reqHeight) {
RequestCreator requestCreator = Picasso.with(LocalPreviewActivity.this).load(uri);
Log.d("LocalPreviewActivity", "bindImage request width height " + reqHeight + " " + reqWidth);
if (reqHeight > 0 || reqWidth > 0) {
requestCreator.resize(reqWidth, reqHeight);
}
ImageTarget imageTarget = new ImageTarget(imageBase);
cache.add(imageTarget);
requestCreator.into(imageTarget);
}
@Override
public void getBitmap(String uri, int reqWidth, int reqHeight, final Listener lis) {
RequestCreator requestCreator = Picasso.with(LocalPreviewActivity.this).load(uri);
Log.d("LocalPreviewActivity", "getBitmap request width height " + reqHeight + " " + reqWidth);
if (reqHeight > 0 || reqWidth > 0) {
requestCreator.resize(reqWidth, reqHeight);
}
ImageTarget imageTarget = new ImageTarget(lis);
cache.add(imageTarget);
requestCreator.into(imageTarget);
}
});
mViewManager = mVafContext.getViewManager();
mViewManager.init(this.getApplicationContext());
mVafContext.getEventManager().register(EventManager.TYPE_Click, new ClickProcessorImpl());
mVafContext.getEventManager().register(EventManager.TYPE_Exposure, new ExposureProcessorImpl());
}
}
use of com.tmall.wireless.virtualviewdemo.custom.ClickProcessorImpl in project Virtualview-Android by alibaba.
the class VirtualViewApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
if (sVafContext == null) {
// VVFeatureConfig.setSliderCompat(true);
Picasso.setSingletonInstance(new Picasso.Builder(this).loggingEnabled(true).build());
sVafContext = new VafContext(this.getApplicationContext());
sVafContext.setImageLoaderAdapter(new IImageLoaderAdapter() {
private List<ImageTarget> cache = new ArrayList<ImageTarget>();
@Override
public void bindImage(String uri, final ImageBase imageBase, int reqWidth, int reqHeight) {
RequestCreator requestCreator = Picasso.with(VirtualViewApplication.this).load(uri);
Log.d("VirtualViewApplication", "bindImage request width height " + reqHeight + " " + reqWidth);
if (reqHeight > 0 || reqWidth > 0) {
requestCreator.resize(reqWidth, reqHeight);
}
ImageTarget imageTarget = new ImageTarget(imageBase);
cache.add(imageTarget);
requestCreator.into(imageTarget);
}
@Override
public void getBitmap(String uri, int reqWidth, int reqHeight, final Listener lis) {
RequestCreator requestCreator = Picasso.with(VirtualViewApplication.this).load(uri);
Log.d("VirtualViewApplication", "getBitmap request width height " + reqHeight + " " + reqWidth);
if (reqHeight > 0 || reqWidth > 0) {
requestCreator.resize(reqWidth, reqHeight);
}
ImageTarget imageTarget = new ImageTarget(lis);
cache.add(imageTarget);
requestCreator.into(imageTarget);
}
});
sViewManager = sVafContext.getViewManager();
sViewManager.init(this.getApplicationContext());
sViewManager.loadBinBufferSync(NTEXT.BIN);
sViewManager.loadBinBufferSync(VTEXT.BIN);
sViewManager.loadBinBufferSync(NIMAGE.BIN);
sViewManager.loadBinBufferSync(VIMAGE.BIN);
sViewManager.loadBinBufferSync(VLINE.BIN);
sViewManager.loadBinBufferSync(NLINE.BIN);
sViewManager.loadBinBufferSync(PROGRESS.BIN);
sViewManager.loadBinBufferSync(VGRAPH.BIN);
sViewManager.loadBinBufferSync(PAGE.BIN);
sViewManager.loadBinBufferSync(PAGEITEM.BIN);
sViewManager.loadBinBufferSync(PAGESCROLLSCRIPT.BIN);
sViewManager.loadBinBufferSync(SLIDER.BIN);
sViewManager.loadBinBufferSync(SLIDERITEM.BIN);
sViewManager.loadBinBufferSync(FRAMELAYOUT.BIN);
sViewManager.loadBinBufferSync(RATIOLAYOUT.BIN);
sViewManager.loadBinBufferSync(GRIDLAYOUT.BIN);
sViewManager.loadBinBufferSync(GRID.BIN);
sViewManager.loadBinBufferSync(GRIDITEM.BIN);
sViewManager.loadBinBufferSync(VHLAYOUT.BIN);
sViewManager.loadBinBufferSync(VH2LAYOUT.BIN);
sViewManager.loadBinBufferSync(VH.BIN);
sViewManager.loadBinBufferSync(SCROLLERVL.BIN);
sViewManager.loadBinBufferSync(SCROLLERVS.BIN);
sViewManager.loadBinBufferSync(SCROLLERH.BIN);
sViewManager.loadBinBufferSync(TOTALCONTAINER.BIN);
sViewManager.loadBinBufferSync(NFRAMELAYOUT.BIN);
sViewManager.loadBinBufferSync(NGRIDLAYOUT.BIN);
sViewManager.loadBinBufferSync(NRATIOLAYOUT.BIN);
sViewManager.loadBinBufferSync(NVHLAYOUT.BIN);
sViewManager.loadBinBufferSync(NVH2LAYOUT.BIN);
sViewManager.loadBinBufferSync(CLICKSCRIPT.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT1.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT2.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT3.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT4.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT5.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT6.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT7.BIN);
sViewManager.loadBinBufferSync(TMALLCOMPONENT8.BIN);
sViewManager.loadBinBufferSync(PICASSO.BIN);
sViewManager.getViewFactory().registerBuilder(BizCommon.TM_TOTAL_CONTAINER, new TotalContainer.Builder());
sViewManager.getViewFactory().registerBuilder(1014, new PicassoImage.Builder());
sVafContext.getCompactNativeManager().register("TMTags", TMReminderTagsView.class);
sVafContext.getEventManager().register(EventManager.TYPE_Click, new ClickProcessorImpl());
sVafContext.getEventManager().register(EventManager.TYPE_Exposure, new ExposureProcessorImpl());
}
}
Aggregations