public DragEventAssert hasUnsuccessfulResult() { isNotNull(); assertThat(actual.getResult()) // .overridingErrorMessage("Expected unsuccessful result but was successful") // .isFalse(); return this; }
public DragEventAssert hasSuccessfulResult() { isNotNull(); assertThat(actual.getResult()) // .overridingErrorMessage("Expected successful result but was unsuccessful") // .isTrue(); return this; }
@Override public void run() { // Signals to a View that the drag and drop operation has concluded. // If event result is set, this means the dragged view was dropped in target if (event.getResult()) { KissApplication.getApplication(mainActivity).getDataHandler().setFavoritePosition(mainActivity, draggedApp.id, leftSide ? pos - 1 : pos); mainActivity.onFavoriteChange(); } else { draggedView.setVisibility(View.VISIBLE); } } });
public DragEventAssert hasSuccessfulResult() { isNotNull(); assertThat(actual.getResult()) // .overridingErrorMessage("Expected successful result but was unsuccessful") // .isTrue(); return this; }
public DragEventAssert hasUnsuccessfulResult() { isNotNull(); assertThat(actual.getResult()) // .overridingErrorMessage("Expected unsuccessful result but was successful") // .isFalse(); return this; }
@Override public boolean onDrag(View v, DragEvent event) { int action = event.getAction(); float xCoord; float yCoord; if(action == DragEvent.ACTION_DRAG_LOCATION) { xCoord = event.getX(); yCoord = event.getY(); } return event.getResult(); //returns true for valid drop or false for invalid drop }
public boolean onDrag(View v, DragEvent event) { final int action = event.getAction(); switch (action) { case DragEvent.ACTION_DRAG_STARTED: { // Bring up a fourth draggable dot on the fly. Note that it // is properly notified about the ongoing drag, and lights up // to indicate that it can handle the current content. mHiddenDot.setVisibility(View.VISIBLE); } break; case DragEvent.ACTION_DRAG_ENDED: { // Hide the surprise again mHiddenDot.setVisibility(View.INVISIBLE); // Report the drop/no-drop result to the user final boolean dropped = event.getResult(); mResultText.setText(dropped ? "Dropped!" : "No drop"); } break; } return false; } });
public boolean onDrag(View v, DragEvent event) { final int action = event.getAction(); switch (action) { case DragEvent.ACTION_DRAG_STARTED: { // Bring up a fourth draggable dot on the fly. Note that it // is properly notified about the ongoing drag, and lights up // to indicate that it can handle the current content. mHiddenDot.setVisibility(View.VISIBLE); } break; case DragEvent.ACTION_DRAG_ENDED: { // Hide the surprise again mHiddenDot.setVisibility(View.INVISIBLE); // Report the drop/no-drop result to the user final boolean dropped = event.getResult(); mResultText.setText(dropped ? "Dropped!" : "No drop"); } break; } return false; } });
@Override public boolean onDrag(final View v, final DragEvent event) { final boolean fromMe = (Integer) event.getLocalState() == 0; if (event.getAction() == DragEvent.ACTION_DRAG_STARTED && fromMe) { if (BuildConfig.DEBUG) { final String card = event.getClipDescription().getLabel().toString(); Log.d(GameActivity.TAG, "Drag W: Started of " + card); } return true; } else if (event.getAction() == DragEvent.ACTION_DRAG_ENDED && !event.getResult() && fromMe) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) System.gc(); handler.post(new Runnable() { @Override public void run() { gameState.attemptAutoMoveFromWasteToFoundation(); } }); return true; } return false; } });
Log.d(TAG, "FIELD ACTION_DRAG_ENDED"); v.invalidate(); if (event.getResult() & treePresentInMyView) { Log.d(TAG, "(x,y) = ("+positionX+", "+positionY+")"); int subSubPlot = 0;
if( event != null && event.getResult())
if (event.getResult())
if (event.getResult()) { Toast.makeText(this, "The drop was handled.", Toast.LENGTH_LONG);
if (event.getResult()) { Toast.makeText(this, "The drop was handled.", Toast.LENGTH_LONG);
if (event.getResult()) { commentMsg += v.getTag() + " : ACTION_DRAG_ENDED - success.\n";