Java Code Examples for android.widget.ImageView#setAnimation()

The following examples show how to use android.widget.ImageView#setAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SplashActivity.java    From Rucky with GNU General Public License v3.0 6 votes vote down vote up
private void splash() {
    final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    View view = getWindow().getDecorView();
    view.setSystemUiVisibility(flags);
    setContentView(R.layout.activity_splash);
    ImageView i1 = findViewById(R.id.imageViewBG);
    i1.setImageDrawable(ContextCompat.getDrawable(this,SettingsActivity.darkTheme ? R.drawable.splash_background_dark : R.drawable.splash_background_light));
    FrameLayout l2= findViewById(R.id.splashTextView);
    i1.setAnimation(AnimationUtils.loadAnimation(this,R.anim.rotate));
    l2.setAnimation(AnimationUtils.loadAnimation(this,R.anim.downtoup));
    new Handler().postDelayed(this::launchNext, 5000);
    getSignature();
}
 
Example 2
Source File: MonsterFaceRecyclerAdapter.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
/**
 * 显示进度动画
 */
public void showProgressAnimation(ImageView view) {
    if (view == null) return;

    view.setVisibility(View.VISIBLE);
    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    LinearInterpolator lin = new LinearInterpolator();
    rotate.setInterpolator(lin);
    rotate.setDuration(2000);
    rotate.setRepeatCount(-1);
    rotate.setFillAfter(true);

    view.setAnimation(rotate);

}
 
Example 3
Source File: StickerRecyclerAdapter.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
/**
 * 显示进度动画
 */
public void showProgressAnimation(ImageView view) {
    if (view == null) return;

    view.setVisibility(View.VISIBLE);
    RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    LinearInterpolator lin = new LinearInterpolator();
    rotate.setInterpolator(lin);
    rotate.setDuration(2000);
    rotate.setRepeatCount(-1);
    rotate.setFillAfter(true);

    view.setAnimation(rotate);

}
 
Example 4
Source File: ImageFetcher.java    From Yahala-Messenger with MIT License 6 votes vote down vote up
/**
 * Once the image is downloaded, associates it to the imageView
 */
@Override
protected void onPostExecute(Bitmap bitmap) {
    if (isCancelled()) {
        bitmap = null;
    }
    addBitmapToCache(position, bitmap);
    if (imageViewReference != null) {
        ImageView imageView = imageViewReference.get();
        BitmapFetcherTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
        if (this == bitmapDownloaderTask) {
            imageView.setImageBitmap(bitmap);
            Animation anim = AnimationUtils.loadAnimation(imageView.getContext(), android.R.anim.fade_in);
            imageView.setAnimation(anim);
            anim.start();
        }
    } else {
        setInvisible();
    }
}
 
Example 5
Source File: EliminateMainActivity.java    From android-tv-launcher with MIT License 6 votes vote down vote up
public void Init() {
GetSurplusMemory();
Round_img=(ImageView)findViewById(R.id.eliminate_roundimg);
Start_kill=(Button)findViewById(R.id.start_killtask);
release_memory=(TextView)findViewById(R.id.relase_memory);
increase_speed=(TextView)findViewById(R.id.increase_speed);
Allpercent=(TextView)findViewById(R.id.all_percent);
clear_endlayout=(LinearLayout)findViewById(R.id.clear_endlayout);
Clearing_layout=(RelativeLayout)findViewById(R.id.clearing_layout);
Animation animation=AnimationUtils.loadAnimation(EliminateMainActivity.this, R.anim.eliminatedialog_anmiation);
TotalMemory=GetTotalMemory();
Round_img.setAnimation(animation);
Start_kill.setClickable(false);
Start_kill.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
	finish();	
	}
});
}
 
Example 6
Source File: MiniGame.java    From SchoolQuest with GNU General Public License v3.0 5 votes vote down vote up
void setUpTextBoxArrowAnimation(ImageView textboxArrow) {
    TranslateAnimation textBoxArrowAnimation = new TranslateAnimation(
            TranslateAnimation.ABSOLUTE, 0f,
            TranslateAnimation.ABSOLUTE, 0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0.01f);
    textBoxArrowAnimation.setDuration(500);
    textBoxArrowAnimation.setRepeatCount(-1);
    textBoxArrowAnimation.setRepeatMode(Animation.RESTART);
    textBoxArrowAnimation.setInterpolator(new LinearInterpolator());
    textBoxArrowAnimation.setFillAfter(true);

    textboxArrow.setAnimation(textBoxArrowAnimation);
}
 
Example 7
Source File: GameActivity.java    From SchoolQuest with GNU General Public License v3.0 5 votes vote down vote up
private void setUpTextBoxArrowAnimation() {
    ImageView textBoxArrow = findViewById(R.id.textbox_box_arrow);
    TranslateAnimation textBoxArrowAnimation = new TranslateAnimation(TranslateAnimation.ABSOLUTE, 0f,
            TranslateAnimation.ABSOLUTE, 0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0.01f);
    textBoxArrowAnimation.setDuration(500);
    textBoxArrowAnimation.setRepeatCount(-1);
    textBoxArrowAnimation.setRepeatMode(Animation.RESTART);
    textBoxArrowAnimation.setInterpolator(new LinearInterpolator());
    textBoxArrowAnimation.setFillAfter(true);

    textBoxArrow.setAnimation(textBoxArrowAnimation);
}
 
Example 8
Source File: OrdersAdapter.java    From Pharmacy-Android with GNU General Public License v3.0 5 votes vote down vote up
private void startHangingAnimation(ImageView imageView) {
    // Clear animation before starting another
    clearAnimation(imageView);

    RotateAnimation rotate = new RotateAnimation(-10, 50, Animation.RELATIVE_TO_SELF, 0.2f, Animation.RELATIVE_TO_SELF, 0f);
    rotate.setRepeatCount(Animation.INFINITE);
    rotate.setRepeatMode(Animation.REVERSE);
    rotate.setDuration(1500);
    imageView.setAnimation(rotate);
    rotate.start();

}
 
Example 9
Source File: WelcomeActivity.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	 super.onCreate(savedInstanceState);
        setContentView(R.layout.welcome);
        imageView = (ImageView)findViewById(R.id.welcome_image_view);  
        alphaAnimation = AnimationUtils.loadAnimation(this, R.anim.welcome_alpha);  
        alphaAnimation.setFillEnabled(true); //启动Fill保持  
        alphaAnimation.setFillAfter(true);  //设置动画的最后一帧是保持在View上面  
        imageView.setAnimation(alphaAnimation);  
        alphaAnimation.setAnimationListener(this);  //为动画设置监听 
        doInitWork();
}
 
Example 10
Source File: AndroidVsIosHeaderView.java    From youqu_master with Apache License 2.0 4 votes vote down vote up
public AndroidVsIosHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    inflate(context, R.layout.layout_irecyclerview_bat_vs_supper_refresh_header_view, this);
    ivBatMan = (ImageView) findViewById(R.id.ivBatMan);
    ivSuperMan = (ImageView) findViewById(R.id.ivSuperMan);
    ivVs = (ImageView) findViewById(R.id.imageView);

    PropertyValuesHolder translationX1 = PropertyValuesHolder.ofFloat("translationX",0.0f,100.0f,0.0f);
    PropertyValuesHolder rotate = PropertyValuesHolder.ofFloat("rotationY",0.0f,380.0f,0.0f);
    PropertyValuesHolder translationX2 = PropertyValuesHolder.ofFloat("translationX",0.0f,-100.0f,0.0f);

    ObjectAnimator objectAnimator1 = ObjectAnimator.ofPropertyValuesHolder(ivBatMan,  translationX1);
    objectAnimator1.setRepeatCount(ValueAnimator.INFINITE);
    objectAnimator1.setRepeatMode(ValueAnimator.INFINITE);

    ObjectAnimator objectAnimator2 = ObjectAnimator.ofPropertyValuesHolder(ivSuperMan,translationX2);
    objectAnimator2.setRepeatCount(ValueAnimator.INFINITE);
    objectAnimator2.setRepeatMode(ValueAnimator.INFINITE);

    ObjectAnimator objectAnimator3 = ObjectAnimator.ofPropertyValuesHolder(ivVs,  rotate);
    objectAnimator3.setRepeatCount(ValueAnimator.INFINITE);
    objectAnimator3.setRepeatMode(ValueAnimator.INFINITE);

     Animation animation =new RotateAnimation(0f,360f, Animation.RELATIVE_TO_SELF,
            0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    Animation animation1 =new RotateAnimation(0f,-360f, Animation.RELATIVE_TO_SELF,
            0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    animation.setFillAfter(true);
    animation.setDuration(2000);
    animation.setRepeatCount(ValueAnimator.INFINITE);
    animation.setRepeatMode(ValueAnimator.INFINITE);
    animation1.setFillAfter(true);
    animation1.setDuration(2000);
    animation1.setRepeatCount(ValueAnimator.INFINITE);
    animation1.setRepeatMode(ValueAnimator.INFINITE);
    ivBatMan.setAnimation(animation);
    ivSuperMan.setAnimation(animation1);

    btnSexAnimatorSet = new AnimatorSet();
    btnSexAnimatorSet.playTogether(objectAnimator1, objectAnimator2,objectAnimator3);
    btnSexAnimatorSet.setDuration(2000);
    btnSexAnimatorSet.start();

}
 
Example 11
Source File: ContentAdapter.java    From droid-stealth with GNU General Public License v2.0 4 votes vote down vote up
private void styleFileView(IndexedFile file, View view) {

		String mime = FileUtils.getMimeType(file.getExtension());
		if (FileUtils.isImageOrVideo(mime)
				&& file.getThumbFile().exists()
				&& GeneralSettingsManager.isThumbnailsShown()) {
			if (file.getThumbnail() == null) {
				// there is no thumbnail yet to set. it still has to be created or retrieved.
				// so for now show the normal view
				styleFiletypeView(file, view);
			}
			styleThumbView(file, view);
		} else {
			styleFiletypeView(file, view);
		}

		ImageView statusImage = (ImageView) view.findViewById(R.id.file_status);
		ImageView statusImageBG = (ImageView) view.findViewById(R.id.file_status_background);
		View statusBar = view.findViewById(R.id.content_item_status_line);

		if (file.isUnlocked()) {
			statusImage.clearAnimation();
			statusImage.setImageResource(R.drawable.ic_status_unlocked);
			statusImageBG.setBackgroundColor(Utils.color(R.color.unlocked));
			view.findViewById(R.id.content_item_status_line).setBackgroundColor(Utils.color(R.color.unlocked));
		}
		else if (file.isLocked()) {
			statusImage.clearAnimation();
			statusImage.setImageResource(R.drawable.ic_status_locked);
			statusImageBG.setBackgroundColor(Utils.color(R.color.locked));
			statusBar.setBackgroundColor(Utils.color(R.color.locked));
		}
		else {
			statusImage.setImageResource(R.drawable.ic_status_processing);
			statusImageBG.setBackgroundColor(Utils.color(R.color.processing));
			statusBar.setBackgroundColor(Utils.color(R.color.processing));
			if (view.getContext() != null) {
				statusImage.setAnimation(AnimationUtils.loadAnimation(view.getContext(), R.anim.rotate));
			}
		}
	}