本文整理汇总了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;
}