SHARE
TWEET

Untitled

a guest Jun 16th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. override fun onTouch(v: View?, event: MotionEvent?): Boolean {
  2.     val item = ClipData.Item(v!!.tag.toString())
  3.     val mimeTypes = arrayOf(ClipDescription.MIMETYPE_TEXT_PLAIN)
  4.  
  5.     val data = ClipData(v.tag.toString(), mimeTypes, item)
  6.  
  7.     val mShadow = View.DragShadowBuilder(v)
  8.  
  9.     when (v.id) {
  10.         R.id.wordTV ->
  11.             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
  12.                 v.startDragAndDrop(data, mShadow, v, DRAG_FLAG_OPAQUE)
  13.             } else {
  14.                 v.startDrag(data, mShadow, v, DRAG_FLAG_OPAQUE)
  15.             }
  16.     }
  17.  
  18.     return false
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top