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

The following examples show how to use android.widget.ImageView#clearAnimation() . 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: DrawerSubMenuBase.java    From edslite with GNU General Public License v2.0 6 votes vote down vote up
public void rotateIcon(View view)
{
    final ImageView icon = (ImageView) view.findViewById(android.R.id.icon); //getIconImageView();
    if(icon!=null)
    {
        icon.clearAnimation();
        ObjectAnimator anim = ObjectAnimator.ofFloat(icon, View.ROTATION, isExpanded() ? 0 : 180);
        anim.setDuration(200);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
            icon.setHasTransientState(true);
        anim.addListener(new AnimatorListenerAdapter()
        {
            @Override
            public void onAnimationEnd(Animator animation)
            {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
                    icon.setHasTransientState(false);
            }
        });
        anim.start();
    }
}
 
Example 2
Source File: Anim.java    From lifecycle-component with Apache License 2.0 5 votes vote down vote up
public static void cleanAnim(ImageView animView) {
    if (animView == null)
        return;
    animView.setImageResource(0);
    animView.clearAnimation();
    animView.setVisibility(View.GONE);
}
 
Example 3
Source File: Anim.java    From Hands-Chopping with Apache License 2.0 5 votes vote down vote up
public static void cleanAnim(ImageView animView) {
    if (animView == null)
        return;
    animView.setImageResource(0);
    animView.clearAnimation();
    animView.setVisibility(View.GONE);
}
 
Example 4
Source File: MonsterFaceRecyclerAdapter.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
/**
 * 隐藏进度显示动画
 */
public void hideProgressAnimation(ImageView view) {
    if (view == null) return;

    view.clearAnimation();
    view.setVisibility(View.GONE);
}
 
Example 5
Source File: StickerRecyclerAdapter.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
/**
 * 隐藏进度显示动画
 */
public void hideProgressAnimation(ImageView view) {
    if (view == null) return;

    view.clearAnimation();
    view.setVisibility(View.GONE);
}
 
Example 6
Source File: AddAddressHotHDMFragment.java    From bither-android with Apache License 2.0 5 votes vote down vote up
private void showFlash(ImageView iv) {
    ImageView[] ivs = new ImageView[]{ivHotLight, ivColdLight, ivServerLight};
    for (ImageView v : ivs) {
        if (v != iv) {
            v.clearAnimation();
            v.setVisibility(View.INVISIBLE);
        }
    }
    if (iv != null) {
        iv.setVisibility(View.VISIBLE);
        iv.startAnimation(AnimationUtils.loadAnimation(getActivity(),
                R.anim.hdm_keychain_add_one_part_flash));

    }
}
 
Example 7
Source File: EmptyLoadingView.java    From android_tv_metro with Apache License 2.0 5 votes vote down vote up
public void viewStopANimation(ImageView view) {
	if (mRotateAnim != null) {
		view.clearAnimation();
		mRotateAnim = null;
		mProgressLayout.setVisibility(View.GONE);
	}
}
 
Example 8
Source File: ImageLoader.java    From ghwatch with Apache License 2.0 5 votes vote down vote up
protected void showImageInView(ImageView iv, Bitmap bitmap, boolean animate) {
  iv.clearAnimation();
  if (animate)
    iv.setAlpha(0f);
  iv.setImageBitmap(bitmap);
  setProgressBarVisibility(iv, false);
  if (animate)
    iv.animate().alpha(1f).setDuration(200).start();
}
 
Example 9
Source File: TweetProgressListAdapter.java    From YiBo with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	if (convertView == null) {
		convertView = inflater.inflate(R.layout.list_item_dialog_tweet_progress, null);
	}
	final LocalAccount account = (LocalAccount)getItem(position);
	
	ImageView ivProfileImage = (ImageView) convertView.findViewById(R.id.ivProfileImage);
       ivProfileImage.setImageDrawable(GlobalResource.getDefaultMinHeader(context));
       
	String profileImageUrl = account.getUser().getProfileImageUrl();
	if (StringUtil.isNotEmpty(profileImageUrl)) {
		new ImageLoad4HeadTask(ivProfileImage, profileImageUrl, true).execute();
	}
	
	TextView screenName = (TextView) convertView.findViewById(R.id.tvScreenName);
	TextView spName = (TextView) convertView.findViewById(R.id.tvSPName);
	ImageView ivTweetState = (ImageView) convertView.findViewById(R.id.ivTweetState);
	
	State state = mapState.get(account);
	if (state == null) {
		state = State.Waiting;
		mapState.put(account, state);
	}
	ivTweetState.setImageLevel(state.getState());
       if (state == State.Loading) {
       	ivTweetState.startAnimation(rotateAnimation);
       } else {
       	ivTweetState.clearAnimation();
       }
       
	screenName.setText(account.getUser().getScreenName());
	String snNameText = account.getServiceProvider().getSpName();
	spName.setText(snNameText);
	
	return convertView;
}
 
Example 10
Source File: DrawerSubMenuBase.java    From edslite with GNU General Public License v2.0 4 votes vote down vote up
public void rotateIconAndChangeState(View view)
{
    if(!isExpanded())
        rotateExpandedIcons();
    final ImageView icon = (ImageView) view.findViewById(android.R.id.icon); //getIconImageView();
    if(icon!=null)
    {
        IS_ANIMATING = true;
        icon.clearAnimation();
        ObjectAnimator anim = ObjectAnimator.ofFloat(icon, View.ROTATION, isExpanded() ? 0 : 180);
        anim.setDuration(200);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
            icon.setHasTransientState(true);
        anim.addListener(new AnimatorListenerAdapter()
        {
            @Override
            public void onAnimationEnd(Animator animation)
            {
                if (isExpanded())
                    collapse();
                else
                {
                    collapseAll();
                    expand();
                }
                getAdapter().notifyDataSetChanged();
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
                    icon.setHasTransientState(false);
                IS_ANIMATING = false;

            }
        });
        anim.start();
    }
    else
    {
        if(isExpanded())
            collapse();
        else
            expand();
    }
}
 
Example 11
Source File: SplashActivity.java    From android-spotify-demo with MIT License 4 votes vote down vote up
private void StartAnimations(){
    Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
    anim.reset();
    LinearLayout l = (LinearLayout)findViewById(R.id.lin_lay);
    l.clearAnimation();
    l.startAnimation(anim);

    anim = AnimationUtils.loadAnimation(this, R.anim.translate);
    anim.reset();
    ImageView iv = (ImageView)findViewById(R.id.splash);
    iv.clearAnimation();
    iv.startAnimation(anim);

    Thread splashTread = new Thread() {
        @Override
        public void run() {
            try {
                int waited = 0;
                // Splash screen pause time
                while (waited < 2500) {
                    sleep(100);
                    waited += 100;
                }

                Intent intent = new Intent(SplashActivity.this,
                        SpotifyLoginActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

                startActivity(intent);
                overridePendingTransition(R.anim.pull_up_from_bottom, R.anim.hold);

                SplashActivity.this.finish();
            } catch (InterruptedException e) {
                // do nothing
            } finally {
                SplashActivity.this.finish();
            }

        }
    };
    splashTread.start();
}
 
Example 12
Source File: PlayingSongDecorationUtil.java    From VinylMusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
public static void decorate(
        @Nullable final TextView title,
        @Nullable final ImageView image,
        @Nullable final TextView imageText,
        Song song,
        @NonNull final AppCompatActivity activity,
        boolean showAlbumImage)
{
    final boolean isPlaying = MusicPlayerRemote.isPlaying(song);

    if (title != null) {
        title.setTypeface(null, isPlaying ? Typeface.BOLD : Typeface.NORMAL);
    }

    if (image != null) {
        image.setVisibility((isPlaying || showAlbumImage) ? View.VISIBLE : View.GONE);
        final boolean animateIcon = PreferenceUtil.getInstance().animatePlayingSongIcon();

        if (isPlaying) {
            image.setScaleType(ImageView.ScaleType.CENTER);

            final int color = ATHUtil.resolveColor(activity, R.attr.iconColor, ThemeStore.textColorSecondary(activity));
            image.setColorFilter(color, PorterDuff.Mode.SRC_IN);

            final int size = (int)(24 * activity.getResources().getDisplayMetrics().density);

            // Note: No transition for Glide, the animation is explicitly controlled
            GlideApp.with(activity)
                    .asBitmap()
                    .load(sIconPlaying)
                    .override(size)
                    .into(image);

            if (animateIcon) { image.startAnimation(sIconAnimation); }
        }
        else {
            image.clearColorFilter();
            if (animateIcon) { image.clearAnimation(); }
        }
    }

    if (imageText != null) {
        imageText.setVisibility((isPlaying || showAlbumImage) ? View.GONE : View.VISIBLE);
    }
}
 
Example 13
Source File: TimeLineBitmapDownloader.java    From iBeebo with GNU General Public License v3.0 4 votes vote down vote up
private void displayImageView(final ImageView view, final String urlKey, final FileLocationMethod method,
                              boolean isFling, boolean isMultiPictures) {
    view.clearAnimation();

    if (!shouldReloadPicture(view, urlKey)) {
        return;
    }

    final Bitmap bitmap = getBitmapFromMemCache(urlKey);
    if (bitmap != null) {
        view.setImageBitmap(bitmap);
        view.setTag(urlKey);
        if (view.getAlpha() != 1.0f) {
            view.setAlpha(1.0f);
        }
        cancelPotentialDownload(urlKey, view);
    } else {

        if (isFling) {
            view.setImageResource(defaultPictureResId);
            return;
        }

        if (!cancelPotentialDownload(urlKey, view)) {
            return;
        }

        final LocalOrNetworkChooseWorker newTask = new LocalOrNetworkChooseWorker(view, urlKey, method, isMultiPictures);
        PictureBitmapDrawable downloadedDrawable = new PictureBitmapDrawable(newTask);
        view.setImageDrawable(downloadedDrawable);

        // listview fast scroll performance
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {

                if (getBitmapDownloaderTask(view) == newTask) {
                    newTask.executeOnNormal();
                }
                return;

            }
        }, 400);

    }

}
 
Example 14
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));
			}
		}
	}
 
Example 15
Source File: TimeLineBitmapDownloader.java    From iBeebo with GNU General Public License v3.0 4 votes vote down vote up
private void displayImageView(final ImageView view, final String urlKey, final FileLocationMethod method,
                              boolean isFling, boolean isMultiPictures) {
    view.clearAnimation();

    if (!shouldReloadPicture(view, urlKey)) {
        return;
    }

    final Bitmap bitmap = getBitmapFromMemCache(urlKey);
    if (bitmap != null) {
        view.setImageBitmap(bitmap);
        view.setTag(urlKey);
        if (view.getAlpha() != 1.0f) {
            view.setAlpha(1.0f);
        }
        cancelPotentialDownload(urlKey, view);
    } else {

        if (isFling) {
            view.setImageResource(defaultPictureResId);
            return;
        }

        if (!cancelPotentialDownload(urlKey, view)) {
            return;
        }

        final LocalOrNetworkChooseWorker newTask = new LocalOrNetworkChooseWorker(view, urlKey, method, isMultiPictures);
        PictureBitmapDrawable downloadedDrawable = new PictureBitmapDrawable(newTask);
        view.setImageDrawable(downloadedDrawable);

        // listview fast scroll performance
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {

                if (getBitmapDownloaderTask(view) == newTask) {
                    newTask.executeOnNormal();
                }
                return;

            }
        }, 400);

    }

}