在(odoo8)POS模块中,有一个函数 export_as_JSON
public class CustomScrollView extends ScrollView {
float touchX = 0;
float touchY = 0;
ViewPager parentPager;
public void setParentPager(ViewPager parentPager) {
this.parentPager = parentPager;
}
public CustomScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomScrollView(Context context) {
super(context);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getActionMasked()){
case MotionEvent.ACTION_DOWN:
touchX = ev.getX();
touchY = ev.getY();
return super.onTouchEvent(ev);
case MotionEvent.ACTION_MOVE:
if(Math.abs(touchX-ev.getX())<40){
return super.onTouchEvent(ev);
}else{
if (parentPager==null) {
return false;
} else {
return parentPager.onTouchEvent(ev);
}
}
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
touchX=0;
touchY=0;
break;
}
return super.onTouchEvent(ev);
}
}
。如何扩展此特定功能。我试过了:
module.Orderline = Backbone.Model.extend
无济于事。任何帮助推动我正确方向的人都会受到赞赏。
答案 0 :(得分:2)
请尝试以下操作:
var _initialize_orderline_ = module.Orderline.prototype;
module.Orderline = module.Orderline.extend({
export_as_JSON: function() {
export_as_JSON_dict=_initialize_orderline_.export_as_JSON.call(this);
<<your code goes here>>
return export_as_JSON_dict;
},
});