コード例 #1
0
 /**
  * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)} is
  * called.
  *
  * @param view
  * @param position
  */
 protected void onPreTransform(View view, float position) {
   final float width = view.getWidth();
   if (mCustomAnimationInterface != null) {
     if (h.containsKey(view) == false || h.get(view).size() == 1) {
       if (position > -1 && position < 1) {
         if (h.get(view) == null) {
           h.put(view, new ArrayList<Float>());
         }
         h.get(view).add(position);
         if (h.get(view).size() == 2) {
           float zero = h.get(view).get(0);
           float cha = h.get(view).get(1) - h.get(view).get(0);
           if (zero > 0) {
             if (cha > -1 && cha < 0) {
               // in
               mCustomAnimationInterface.onPrepareNextItemShowInScreen(view);
             } else {
               // out
               mCustomAnimationInterface.onPrepareCurrentItemLeaveScreen(view);
             }
           } else {
             if (cha > -1 && cha < 0) {
               // out
               mCustomAnimationInterface.onPrepareCurrentItemLeaveScreen(view);
             } else {
               // in
               mCustomAnimationInterface.onPrepareNextItemShowInScreen(view);
             }
           }
         }
       }
     }
   }
 }
コード例 #2
0
 /**
  * Called each {@link #transformPage(View, float)} call after {@link #onTransform(View, float)} is
  * finished.
  *
  * @param view
  * @param position
  */
 protected void onPostTransform(View view, float position) {
   if (mCustomAnimationInterface != null) {
     if (position == -1 || position == 1) {
       mCustomAnimationInterface.onCurrentItemDisappear(view);
       isApp = true;
     } else if (position == 0) {
       mCustomAnimationInterface.onNextItemAppear(view);
       isDis = true;
     }
     if (isApp && isDis) {
       h.clear();
       isApp = false;
       isDis = false;
     }
   }
 }