public void handleMessage(Message msg) { if (!doTask) return; /** * currentPosView = getChildAt(dragCurPos - getFirstVisiblePosition()); if (currentPosView * != null) currentPosView.setBackgroundDrawable(null); /* */ int position; if (!downing) { position = getFirstVisiblePosition(); if (position == 0) { doTask = false; } else { position -= 5; } } else { position = getLastVisiblePosition(); if (position == getCount() - 1) { doTask = false; } else { position += 5; } } if (SDK8 && method != null) try { method.invoke(DDGridView.this, position); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block FileManager.error( "IllegalArgumentException: " + e.getLocalizedMessage() + "\n" + e.getMessage()); method = null; setSelection(position); } catch (IllegalAccessException e) { // TODO Auto-generated catch block FileManager.error( "IllegalAccessException: " + e.getLocalizedMessage() + "\n" + e.getMessage()); method = null; setSelection(position); } catch (InvocationTargetException e) { // TODO Auto-generated catch block FileManager.error( "InvocationTargetException: " + e.getLocalizedMessage() + "\n" + e.getMessage()); method = null; setSelection(position); } else setSelection(position); if (!doTask) ha.removeMessages(0); }
private void init(Context context) { this.context = context; fileManager = (FileManager) context; initDragWindowParams(); this.setSmoothScrollbarEnabled(true); if (SDK8) { try { Class c = this.getClass(); method = c.getMethod("smoothScrollToPosition", int.class); } catch (SecurityException e) { // TODO Auto-generated catch block FileManager.error("SecurityException:\n" + e.getLocalizedMessage()); method = null; } catch (NoSuchMethodException e) { // TODO Auto-generated catch block FileManager.error("NoSuchMethodException:\n" + e.getLocalizedMessage()); method = null; } } // ROLL_HEIGHT = ROLL_HEIGHT_DP * (int)fileManager.getDensity(); }