Tabnine Logo
DragDropListView
Code IndexAdd Tabnine to your IDE (free)

How to use
DragDropListView
in
cc.solart.dragdrop

Best Java code snippets using cc.solart.dragdrop.DragDropListView (Showing top 10 results out of 315)

origin: Solartisan/DragDropListView

/**
 * Find the view under the pointer.
 */
private View getViewAtPosition(int x, int y) {
  final int count = getChildCount();
  View child;
  for (int childIdx = 0; childIdx < count; childIdx++) {
    child = getChildAt(childIdx);
    if (y >= child.getTop() && y <= child.getBottom() && x >= child.getLeft()
        && x <= child.getRight()) {
      return child;
    }
  }
  return null;
}
origin: Solartisan/DragDropListView

private void ensureScrollHandler() {
  if (mScrollHandler == null) {
    mScrollHandler = getHandler();
  }
}
origin: Solartisan/DragDropListView

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_simple);
  mSimpleTileAdapter = new SimpleTileAdapter(this, this,
      new TileView.OnSelectedListener() {
        @Override
        public void onTileSelected(IDragEntity entity) {
          Toast.makeText(SimpleActivity.this, ((SimpleDragEntity) entity).getName(), Toast.LENGTH_SHORT).show();
        }
      });
  //TODO :set data source
  mSimpleTileAdapter.setData(obtainData());
  mListView = (DragDropListView) findViewById(R.id.list_view);
  mListView.setVerticalScrollBarEnabled(false);
  mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
  mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
  mListView.getDragDropController().addOnDragDropListener(mSimpleTileAdapter);
  final ImageView dragShadowOverlay =
      (ImageView) findViewById(R.id.tile_drag_shadow_overlay);
  mListView.setDragShadowOverlay(dragShadowOverlay);
  final LayoutAnimationController controller = new LayoutAnimationController(
      AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
  controller.setDelay(0);
  mListView.setLayoutAnimation(controller);
  mListView.setAdapter(mSimpleTileAdapter);
}
origin: Solartisan/DragDropListView

      (Math.abs(mLastDragY - mTouchDownForDragStartY) >= 4 * mTouchSlop)) {
    mIsDragScrollerRunning = true;
    ensureScrollHandler();
    mScrollHandler.postDelayed(mDragScroller, SCROLL_HANDLER_DELAY_MILLIS);
  final int boundGap = (int) (getHeight() * BOUND_GAP_RATIO);
  mTopScrollBound = (getTop() + boundGap);
  mBottomScrollBound = (getBottom() - boundGap);
  break;
case DragEvent.ACTION_DRAG_EXITED:
case DragEvent.ACTION_DRAG_ENDED:
case DragEvent.ACTION_DROP:
  ensureScrollHandler();
  mScrollHandler.removeCallbacks(mDragScroller);
  mIsDragScrollerRunning = false;
origin: Solartisan/DragDropListView

  private void saveOffsets() {
    final int firstVisiblePosition = mDragDropListener.getDragDropListView().getFirstVisiblePosition();
    for (int i = 0; i < mDragDropListener.getDragDropListView().getChildCount(); i++) {
      final View child = mDragDropListener.getDragDropListView().getChildAt(i);
      final int position = firstVisiblePosition + i;

      if (!isIndexInBound(position)) {
        continue;
      }
      final long itemId = getItemId(position);

//            Log.d(TAG, "Saving itemId: " + itemId + " for listview child " + i + " Top: "
//                    + child.getTop() + " Left: "
//                    + child.getLeft());

      mItemIdTopMap.put(itemId, child.getTop());
      mItemIdLeftMap.put(itemId, child.getLeft());
    }
  }

origin: Solartisan/DragDropListView

@Override
protected void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  mTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
}
origin: Solartisan/DragDropListView

@Override
public void onDragStarted(int x, int y, View tileView) {
  if (mDragShadowOverlay == null) {
    return;
  }
  mDragShadowOverlay.clearAnimation();
  mDragShadowBitmap = createDraggedChildBitmap(tileView);
  if (mDragShadowBitmap == null) {
    return;
  }
  tileView.getLocationOnScreen(mLocationOnScreen);
  mDragShadowLeft = mLocationOnScreen[0];
  mDragShadowTop = mLocationOnScreen[1];
  // To offset the drag shadow position, this looks under finger.
  mTouchOffsetToChildLeft = x - mDragShadowLeft;
  mTouchOffsetToChildTop = y - mDragShadowTop;
  mDragShadowParent.getLocationOnScreen(mLocationOnScreen);
  mDragShadowLeft -= mLocationOnScreen[0];
  mDragShadowTop -= mLocationOnScreen[1];
  mDragShadowOverlay.setImageBitmap(mDragShadowBitmap);
  mDragShadowOverlay.setVisibility(VISIBLE);
  mDragShadowOverlay.setAlpha(DRAG_SHADOW_ALPHA);
  mDragShadowOverlay.setX(mDragShadowLeft);
  mDragShadowOverlay.setY(mDragShadowTop);
}
origin: Solartisan/DragDropListView

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_thumbtack);
  mThumbtackTileAdapter = new ThumbtackTileAdapter(this, this,
      new TileView.OnSelectedListener() {
        @Override
        public void onTileSelected(IDragEntity entity) {
          Toast.makeText(ThumbtackActivity.this, ((SimpleDragEntity) entity).getName(), Toast.LENGTH_SHORT).show();
        }
      });
  //TODO :set data source
  mThumbtackTileAdapter.setData(obtainData());
  mListView = (DragDropListView) findViewById(R.id.list_view);
  mListView.setVerticalScrollBarEnabled(false);
  mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
  mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
  mListView.getDragDropController().addOnDragDropListener(mThumbtackTileAdapter);
  final ImageView dragShadowOverlay =
      (ImageView) findViewById(R.id.tile_drag_shadow_overlay);
  mListView.setDragShadowOverlay(dragShadowOverlay);
  final LayoutAnimationController controller = new LayoutAnimationController(
      AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
  controller.setDelay(0);
  mListView.setLayoutAnimation(controller);
  mListView.setAdapter(mThumbtackTileAdapter);
}
origin: Solartisan/DragDropListView

public boolean onPreDraw() {
  observer.removeOnPreDrawListener(this);
  final int firstVisiblePosition = mDragDropListener.getDragDropListView().getFirstVisiblePosition();
  for (int i = 0; i < mDragDropListener.getDragDropListView().getChildCount(); i++) {
    final View child = mDragDropListener.getDragDropListView().getChildAt(i);
    int position = firstVisiblePosition + i;
origin: Solartisan/DragDropListView

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_single_row);
  mSimpleTileAdapter = new SimpleTileAdapter(this, this,
      new TileView.OnSelectedListener() {
        @Override
        public void onTileSelected(IDragEntity entity) {
          Toast.makeText(SingleRowActivity.this, ((SimpleDragEntity) entity).getName(), Toast.LENGTH_SHORT).show();
        }
      });
  //TODO :set data source
  mSimpleTileAdapter.setData(obtainData());
  mListView = (DragDropListView) findViewById(R.id.list_view);
  mListView.setVerticalScrollBarEnabled(false);
  mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
  mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
  mListView.getDragDropController().addOnDragDropListener(mSimpleTileAdapter);
  final ImageView dragShadowOverlay =
      (ImageView) findViewById(R.id.tile_drag_shadow_overlay);
  mListView.setDragShadowOverlay(dragShadowOverlay);
  final LayoutAnimationController controller = new LayoutAnimationController(
      AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
  controller.setDelay(0);
  mListView.setLayoutAnimation(controller);
  mListView.setAdapter(mSimpleTileAdapter);
}
cc.solart.dragdropDragDropListView

Most used methods

  • createDraggedChildBitmap
  • ensureScrollHandler
  • getBottom
  • getChildAt
  • getChildCount
  • getContext
  • getDragDropController
  • getFirstVisiblePosition
  • getHandler
  • getHeight
  • getLocationOnScreen
  • getTop
  • getLocationOnScreen,
  • getTop,
  • getViewAtPosition,
  • getViewTreeObserver,
  • setAdapter,
  • setDragShadowOverlay,
  • setLayoutAnimation,
  • setScrollBarStyle,
  • setVerticalScrollBarEnabled,
  • setVerticalScrollbarPosition

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • onCreateOptionsMenu (Activity)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Permission (java.security)
    Legacy security code; do not use.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now