本文整理匯總了Java中android.support.v4.view.ViewCompat.postOnAnimationDelayed方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewCompat.postOnAnimationDelayed方法的具體用法?Java ViewCompat.postOnAnimationDelayed怎麽用?Java ViewCompat.postOnAnimationDelayed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.postOnAnimationDelayed方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runMoveAnimation
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void runMoveAnimation(boolean removalsPending, boolean movesPending) {
if (movesPending) {
final ArrayList<MoveInfo> moves = new ArrayList<>();
moves.addAll(mPendingMoves);
mMovesList.add(moves);
mPendingMoves.clear();
Runnable mover = new Runnable() {
@Override
public void run() {
for (MoveInfo moveInfo : moves) {
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
moveInfo.toX, moveInfo.toY);
}
moves.clear();
mMovesList.remove(moves);
}
};
if (removalsPending) {
View view = moves.get(0).holder.itemView;
ViewCompat.postOnAnimationDelayed(view, mover, getRemoveDuration());
} else {
mover.run();
}
}
}
示例2: runChangeAnimation
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void runChangeAnimation(boolean removalsPending, boolean changesPending) {
// Change animation to run in parallel with move animations
if (changesPending) {
final ArrayList<ChangeInfo> changes = new ArrayList<>();
changes.addAll(mPendingChanges);
mChangesList.add(changes);
mPendingChanges.clear();
Runnable changer = new Runnable() {
@Override
public void run() {
for (ChangeInfo change : changes) {
animateChangeImpl(change);
}
changes.clear();
mChangesList.remove(changes);
}
};
if (removalsPending) {
ViewHolder holder = changes.get(0).oldHolder;
ViewCompat.postOnAnimationDelayed(holder.itemView, changer, getRemoveDuration());
} else {
changer.run();
}
}
}
示例3: runAddAnimation
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void runAddAnimation(boolean removalsPending, boolean changesPending,
boolean movesPending, boolean additionsPending) {
if (additionsPending) {
final ArrayList<ViewHolder> additions = new ArrayList<>();
// Sorting addition animations based on it's original layout position
Collections.sort(mPendingAdditions, new Comparator<ViewHolder>() {
@Override
public int compare(ViewHolder vh1, ViewHolder vh2) {
return vh1.getLayoutPosition() - vh2.getLayoutPosition();
}
});
additions.addAll(mPendingAdditions);
mAdditionsList.add(additions);
mPendingAdditions.clear();
Runnable adder = new Runnable() {
public void run() {
int index = 0;
for (ViewHolder holder : additions) {
doAnimateAdd(holder, index++);
}
additions.clear();
mAdditionsList.remove(additions);
}
};
if (removalsPending || movesPending || changesPending) {
long removeDuration = removalsPending ? getRemoveDuration() : 0;
long moveDuration = movesPending ? getMoveDuration() : 0;
long changeDuration = changesPending ? getChangeDuration() : 0;
long totalDelay = removeDuration + Math.max(moveDuration, changeDuration);
View view = additions.get(0).itemView;
ViewCompat.postOnAnimationDelayed(view, adder, totalDelay);
} else {
adder.run();
}
}
}
示例4: startDelayed
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
@Override
public void startDelayed(long delayMillis) {
View v = viewRef.get();
if (v != null) {
ViewCompat.postOnAnimationDelayed(v, this, delayMillis);
}
}
示例5: startAnimating
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private void startAnimating() {
if (this.mRunnable == null) {
this.mRunnable = new ScrollAnimationRunnable();
}
this.mAnimating = true;
this.mNeedsReset = true;
if (this.mAlreadyDelayed || this.mActivationDelay <= 0) {
this.mRunnable.run();
} else {
ViewCompat.postOnAnimationDelayed(this.mTarget, this.mRunnable, (long) this.mActivationDelay);
}
this.mAlreadyDelayed = true;
}