Calabash-Android dragging button with Drag Shadow -
i'm using simple app on drag listener drag button 1 half of screen other. able drag element fine, on emulator or device, , using drag function implemented monkey runner. when seek utilize calabash drag element across screen using "performaction('drag',50,30,25,75,15)" (and drag_coordinates), drag shadow appears , dragging motion stopped (see picture).
any other drag (not on draggable element) works, including open drawers or "move" rectangles drawn on canvas. i've tried create drag shadow empty, in case interfering dragging. broken drag animation prevents other interactions calabash, unless interact device cancel drag.
has else noticed similar issue dragging element/object across screen , having freeze when drag begins? realize calabash uses robotium @ core if either of test frameworks apply this. using recent calabash-android-0.4.21 , tried beta 0.5 version.
mainactivity code: `package com.example.dragndrop;
import android.os.bundle; import android.app.activity; import android.content.clipdata; import android.view.dragevent; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.widget.button; import android.widget.linearlayout; import android.widget.textview; public class mainactivity extends activity { button drag; linearlayout drop; textview text,sucess; int total , failure = 0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); drag = (button)findviewbyid(r.id.one); drop = (linearlayout)findviewbyid(r.id.toplinear); text = (textview)findviewbyid(r.id.total); sucess = (textview)findviewbyid(r.id.sucess); sucess.settext("sucessful drops :"+(total - failure)); text.settext("total drops: "+total); drag.setondraglistener(new view.ondraglistener() { @override public boolean ondrag(view v, dragevent event) { // todo auto-generated method stub final int action = event.getaction(); switch(action) { case dragevent.action_drag_started: break; case dragevent.action_drag_exited: break; case dragevent.action_drag_entered: break; case dragevent.action_drop:{ failure = failure+1; return(true); } case dragevent.action_drag_ended:{ total = total +1; int suc = total - failure; sucess.settext("sucessful drops :"+suc); text.settext("total drops: "+total); return(true); } default: break; } homecoming true; }}); drag.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent arg1) { // todo auto-generated method stub clipdata info = clipdata.newplaintext("", ""); view.dragshadowbuilder shadow = new view.dragshadowbuilder(drag); v.startdrag(data, shadow, null, 0); homecoming false; } }); } }`
try next solution:
performaction('drag',50,30,25,75,1)
or one:
%x{#{default_device.adb_command} shell input swipe 50 30 25 75 15}
android drag-and-drop drag robotium calabash
No comments:
Post a Comment