Example usage for android.widget ImageView setVisibility

List of usage examples for android.widget ImageView setVisibility

Introduction

In this page you can find the example usage for android.widget ImageView setVisibility.

Prototype

@RemotableViewMethod
    @Override
    public void setVisibility(int visibility) 

Source Link

Usage

From source file:Main.java

public static void setIconInActionBar(ImageView imageButton, int Res) {
    imageButton.setVisibility(View.VISIBLE);
    imageButton.setImageResource(Res);/* ww  w .  j  a v  a 2s .com*/
}

From source file:Main.java

public static void reset(View circleBackground, ImageView icon1, ImageView icon2) {
    icon1.setVisibility(View.GONE);
    icon2.setVisibility(View.VISIBLE);
    icon2.setScaleX(mScaleX);/*www  .  ja  v a 2 s.  co m*/
    icon2.setScaleY(mScaleY);
}

From source file:Main.java

private static void resetLikeAnimationState(ImageView likeBg, ImageView likeIcon) {
    likeBg.setVisibility(View.GONE);
    likeIcon.setVisibility(View.GONE);
}

From source file:Main.java

public static void animatePhotoLike(final ImageView likeBg, final ImageView likeIcon) {
    likeBg.setVisibility(View.VISIBLE);
    likeIcon.setVisibility(View.VISIBLE);

    likeBg.setScaleY(0.1f);//from   w w  w.ja  v  a2s.com
    likeBg.setScaleX(0.1f);
    likeBg.setAlpha(1f);
    likeIcon.setScaleY(0.1f);
    likeIcon.setScaleX(0.1f);

    AnimatorSet animatorSet = new AnimatorSet();

    ObjectAnimator bgScaleYAnim = ObjectAnimator.ofFloat(likeBg, "scaleY", 0.1f, 1f);
    bgScaleYAnim.setDuration(200);
    bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator bgScaleXAnim = ObjectAnimator.ofFloat(likeBg, "scaleX", 0.1f, 1f);
    bgScaleXAnim.setDuration(200);
    bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(likeBg, "alpha", 1f, 0f);
    bgAlphaAnim.setDuration(200);
    bgAlphaAnim.setStartDelay(150);
    bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR);

    ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(likeIcon, "scaleY", 0.1f, 1f);
    imgScaleUpYAnim.setDuration(300);
    imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR);
    ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(likeIcon, "scaleX", 0.1f, 1f);
    imgScaleUpXAnim.setDuration(300);
    imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR);

    ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(likeIcon, "scaleY", 1f, 0f);
    imgScaleDownYAnim.setDuration(300);
    imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
    ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(likeIcon, "scaleX", 1f, 0f);
    imgScaleDownXAnim.setDuration(300);
    imgScaleDownXAnim.setInterpolator(ACCELERATE_INTERPOLATOR);

    animatorSet.playTogether(bgScaleYAnim, bgScaleXAnim, bgAlphaAnim, imgScaleUpYAnim, imgScaleUpXAnim);
    animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim);

    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            resetLikeAnimationState(likeBg, likeIcon);
        }
    });
    animatorSet.start();
}

From source file:org.videolan.vlc.gui.helpers.AsyncImageLoader.java

private static void updateTargetImage(final Bitmap bitmap, final View target, final ViewDataBinding vdb) {
    if (bitmap == null || bitmap.getWidth() <= 1 || bitmap.getHeight() <= 1)
        return;//from  w w  w.ja v a  2s. c  o m
    if (vdb != null) {
        vdb.setVariable(BR.scaleType, ImageView.ScaleType.FIT_CENTER);
        vdb.setVariable(BR.cover, new BitmapDrawable(VLCApplication.getAppResources(), bitmap));
        vdb.setVariable(BR.protocol, null);
    } else {
        sHandler.post(new Runnable() {
            @Override
            public void run() {
                if (target instanceof ImageView) {
                    ImageView iv = (ImageView) target;
                    iv.setVisibility(View.VISIBLE);
                    iv.setScaleType(ImageView.ScaleType.FIT_CENTER);
                    iv.setImageBitmap(bitmap);
                } else if (target instanceof TextView) {
                    ViewCompat.setBackground(target,
                            new BitmapDrawable(VLCApplication.getAppResources(), bitmap));
                    ((TextView) target).setText(null);
                }
            }
        });
    }
}

From source file:Main.java

private static void preloadImage(ImageView imageView, int placeholderImageResource, Message msg) {
    // set the default image first, when the query is complete, we will
    // replace the image with the correct one.
    if (placeholderImageResource != -1) {
        imageView.setVisibility(View.VISIBLE);
        imageView.setImageResource(placeholderImageResource);
    } else {/*from ww  w.j  a v  a  2s  .  c o  m*/
        imageView.setVisibility(View.INVISIBLE);
    }

    // notify the thread to begin working
    sThreadHandler.sendMessage(msg);
}

From source file:com.todoroo.astrid.notes.CommentsController.java

private static void setupImagePopupForCommentView(View view, ImageView commentPictureView,
        final Uri updateBitmap, final Activity activity) {
    if (updateBitmap != null) {
        commentPictureView.setVisibility(View.VISIBLE);
        String path = getPathFromUri(activity, updateBitmap);
        commentPictureView.setImageBitmap(sampleBitmap(path, commentPictureView.getLayoutParams().width,
                commentPictureView.getLayoutParams().height));

        view.setOnClickListener(v -> {
            File file = new File(updateBitmap.getPath());
            Uri uri = FileProvider.getUriForFile(activity, Constants.FILE_PROVIDER_AUTHORITY,
                    file.getAbsoluteFile());
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(uri, "image/*");
            FileHelper.grantReadPermissions(activity, intent, uri);
            activity.startActivity(intent);
        });//from ww  w  . j  av a  2  s  . co m
    } else {
        commentPictureView.setVisibility(View.GONE);
    }
}

From source file:de.baumann.hhsmoodle.helper.helper_main.java

public static void showFilter(Activity activity, RelativeLayout layout, ImageView imageView, EditText editText,
        String text, String hint, boolean showKeyboard) {
    layout.setVisibility(View.VISIBLE);
    imageView.setVisibility(View.GONE);
    editText.setText(text);/*w w  w . j ava 2s .  c  o  m*/
    editText.setHint(hint);
    editText.requestFocus();
    if (showKeyboard) {
        helper_main.showKeyboard(activity, editText);
    }
}

From source file:com.csipsimple.utils.ContactsAsyncHelper.java

private static void defaultImage(ImageView imageView, int placeholderImageResource) {
    Log.v(THIS_FILE, "No uri, just display placeholder.");
    PhotoViewTag photoTag = new PhotoViewTag();
    photoTag.uri = null;/*from  ww w.ja v a  2s .c  om*/
    imageView.setTag(TAG_PHOTO_INFOS, photoTag);
    imageView.setVisibility(View.VISIBLE);
    imageView.setImageResource(placeholderImageResource);
}

From source file:de.baumann.hhsmoodle.helper.helper_main.java

public static void hideFilter(Activity activity, RelativeLayout layout, ImageView imageView) {
    InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(layout.getWindowToken(), 0);
    imageView.setVisibility(View.VISIBLE);
    layout.setVisibility(View.GONE);
}