Exemplo n.º 1
0
 /**
  * Scroll view to the center of the list
  *
  * @param view
  * @param parent
  */
 public static void scrollViewToCenter(View view, ListView parent) {
   ListAdapter items = parent.getAdapter();
   int viewY = view.getTop() + view.getHeight() / 2 - parent.getHeight() / 2;
   if (viewY < 0 && parent.getFirstVisiblePosition() == 0) {
     parent.smoothScrollToPosition(0);
   } else if (viewY > 0 && parent.getLastVisiblePosition() == items.getCount() - 1) {
     parent.smoothScrollToPosition(items.getCount() - 1);
   } else {
     Command.invoke(SCROLL_LIST_FOR_DISTANCE_IN_ANY_MILLIS)
         .args(parent, viewY, 300)
         .only()
         .sendDelayed(100);
   }
 }
Exemplo n.º 2
0
 static {
   // Register Async Operation
   com.dummi.common.command.Command.register(U.class);
 }