use of android.view.animation.TranslateAnimation in project KJFrameForAndroid by kymjs.
the class KJScrollView method boundBack.
/**
* 将内容布局移动到原位置 可以在UP事件中调用, 也可以在其他需要的地方调用, 如手指移动到当前ScrollView外时
*/
private void boundBack() {
if (!isMoved) {
// 如果没有移动布局, 则跳过执行
return;
}
// 开启动画
TranslateAnimation anim = new TranslateAnimation(0, 0, contentView.getTop(), originalRect.top);
anim.setDuration(ANIM_TIME);
contentView.startAnimation(anim);
// 设置回到正常的布局位置
contentView.layout(originalRect.left, originalRect.top, originalRect.right, originalRect.bottom);
// 将标志位设回false
canPullDown = false;
canPullUp = false;
isMoved = false;
}
use of android.view.animation.TranslateAnimation in project weiciyuan by qii.
the class UserInfoFragment method displayCoverPicture.
private void displayCoverPicture() {
if (cover.getDrawable() != null) {
return;
}
// final int height = viewPager.getHeight();
final int height = Utility.dip2px(200);
final int width = Utility.getMaxLeftWidthOrHeightImageViewCanRead(height);
final String picPath = userBean.getCover_image();
blur.setAlpha(0f);
blur.setOriImageUrl(picPath);
ArrayList<ImageView> imageViewArrayList = new ArrayList<ImageView>();
imageViewArrayList.add(cover);
imageViewArrayList.add(blur);
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -100f, Animation.RELATIVE_TO_SELF, 0f);
animation.setDuration(3000);
animation.setInterpolator(new DecelerateInterpolator());
ArrayList<Animation> animationArray = new ArrayList<Animation>();
animationArray.add(animation);
TimeLineBitmapDownloader.getInstance().display(imageViewArrayList, width, height, picPath, FileLocationMethod.cover, animationArray);
}
use of android.view.animation.TranslateAnimation in project smartmodule by carozhu.
the class OptAnimationLoader method createAnimationFromXml.
private static Animation createAnimationFromXml(Context c, XmlPullParser parser, AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException {
Animation anim = null;
// Make sure we are on a start tag.
int type;
int depth = parser.getDepth();
while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {
if (type != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if (name.equals("set")) {
anim = new AnimationSet(c, attrs);
createAnimationFromXml(c, parser, (AnimationSet) anim, attrs);
} else if (name.equals("alpha")) {
anim = new AlphaAnimation(c, attrs);
} else if (name.equals("scale")) {
anim = new ScaleAnimation(c, attrs);
} else if (name.equals("rotate")) {
anim = new RotateAnimation(c, attrs);
} else if (name.equals("translate")) {
anim = new TranslateAnimation(c, attrs);
} else {
try {
anim = (Animation) Class.forName(name).getConstructor(Context.class, AttributeSet.class).newInstance(c, attrs);
} catch (Exception te) {
throw new RuntimeException("Unknown animation name: " + parser.getName() + " error:" + te.getMessage());
}
}
if (parent != null) {
parent.addAnimation(anim);
}
}
return anim;
}
use of android.view.animation.TranslateAnimation in project smartmodule by carozhu.
the class AnimationController method slideOut.
public void slideOut(View view, long durationMillis, long delayMillis) {
TranslateAnimation animation = new TranslateAnimation(rela2, 0, rela2, -1, rela2, 0, rela2, 0);
baseOut(view, animation, durationMillis, delayMillis);
}
use of android.view.animation.TranslateAnimation in project smartmodule by carozhu.
the class AnimationController method slideFadeOut.
public void slideFadeOut(View view, long durationMillis, long delayMillis) {
TranslateAnimation animation1 = new TranslateAnimation(rela2, 0, rela2, -1, rela2, 0, rela2, 0);
AlphaAnimation animation2 = new AlphaAnimation(1, 0);
AnimationSet animation = new AnimationSet(false);
animation.addAnimation(animation1);
animation.addAnimation(animation2);
baseOut(view, animation, durationMillis, delayMillis);
}
Aggregations