Example usage for android.widget ImageView setAlpha

List of usage examples for android.widget ImageView setAlpha

Introduction

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

Prototype

@Deprecated
@RemotableViewMethod
public void setAlpha(int alpha) 

Source Link

Document

Sets the alpha value that should be applied to the image.

Usage

From source file:com.arlib.floatingsearchview.suggestions.SearchSuggestionsAdapter.java

private void resetImageView(ImageView imageView) {

    imageView.setImageDrawable(null);
    imageView.setAlpha(1.0f);
}

From source file:net.archenemy.archenemyapp.view.SlidingTabLayout.java

private void setTabSelected(View tab) {
    ImageView tabIcon = (ImageView) tab.findViewById(tabViewImageViewId);
    tabIcon.setAlpha(1f);
}

From source file:net.archenemy.archenemyapp.view.SlidingTabLayout.java

private void setTabUnselected(View tab) {
    ImageView tabIcon = (ImageView) tab.findViewById(tabViewImageViewId);
    tabIcon.setAlpha(0.54f);
}

From source file:ua.com.spasetv.testintuitions.FragExerciseTwo.java

@Override
public void onAnimationEnd(Animation animation) {
    if (animation == animPauseBeforeOpenAll) {
        showAllAnswers();//  ww w  . j a v  a2 s  . com
    } else if (animation == animPauseAfterOpenAll) {
        if (numberRepeatExercise < REPEAT_EX_TWO) {
            for (ImageView img : arrayButtons) {
                img.startAnimation(animScaleOut);
                img.setAlpha(0.6f);
                img.setImageResource(R.drawable.ic_help_outline_black_24dp);
                img.startAnimation(animScaleIn);
            }
            initExerciseBeforeRepeat();
            setProgressBar(numberRepeatExercise);
            setButtonsTouchListener(); //set touch listener to the all buttons
            isOnTouchKeyOn = true;
        } else {
            try {
                saveResultExercise();
            } catch (IOException e) {
                e.printStackTrace();
            }
            onExerciseFinishListener.onExerciseFinish(FRAGMENT_EXERCISE_TWO, (byte) totalCorrectAnswers);
        }
    }
    if (vibrator != null)
        vibrator.cancel();
}

From source file:nl.hnogames.domoticz.app.DomoticzCardFragment.java

private void setMessage(String message) {
    RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout);
    if (errorLayout != null) {
        errorLayout.setVisibility(View.VISIBLE);

        ImageView errorImage = (ImageView) root.findViewById(R.id.errorImage);
        errorImage.setImageResource(R.drawable.empty);
        errorImage.setAlpha(0.5f);
        errorImage.setVisibility(View.VISIBLE);

        TextView errorTextWrong = (TextView) root.findViewById(R.id.errorTextWrong);
        errorTextWrong.setVisibility(View.GONE);

        TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage);
        errorTextMessage.setText(message);
    } else/*from ww  w .  j  av a 2s . c o m*/
        throw new RuntimeException("Layout should have a RelativeLayout defined with the ID of errorLayout");
}

From source file:nl.hnogames.domoticz.app.DomoticzDashboardFragment.java

public void setMessage(String message) {
    RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout);
    if (errorLayout != null) {
        errorLayout.setVisibility(View.VISIBLE);

        ImageView errorImage = (ImageView) root.findViewById(R.id.errorImage);
        errorImage.setImageResource(R.drawable.empty);
        errorImage.setAlpha(0.5f);
        errorImage.setVisibility(View.VISIBLE);

        TextView errorTextWrong = (TextView) root.findViewById(R.id.errorTextWrong);
        errorTextWrong.setVisibility(View.GONE);

        TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage);
        errorTextMessage.setText(message);
    } else//  w  w  w  .j  a va2s.co m
        throw new RuntimeException("Layout should have a RelativeLayout defined with the ID of errorLayout");
}

From source file:com.ibm.mil.readyapps.telco.activities.MainActivity.java

/**
 * Highlight the active tab image while dimming all other tab images.
 *
 * @param tabImageToHighlight the tab image to highlight
 *///from w ww.ja va 2s .  c  o m
private void setImageHighlight(ImageView tabImageToHighlight) {
    for (ImageView image : tabImages) {
        if (image == tabImageToHighlight) {
            image.setAlpha((float) 1.0);
        } else {
            image.setAlpha((float) 0.5);
        }
    }
}

From source file:fr.paug.droidcon.util.LPreviewUtilsBase.java

public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate,
        int resIdChecked) {

    final int imageResId = isCheck ? resIdChecked : R.drawable.add_schedule_button_icon_unchecked;

    if (imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();/*w  w  w .ja  v  a  2  s.  c  om*/
            imageView.setAlpha(1f);
        }
    }

    if (allowAnimate && isCheck) {
        int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

From source file:com.bb.hbx.activitiy.InsurancePlanActivity.java

@Override
protected void onRestart() {
    super.onRestart();
    ImageView dotView = new ImageView(mContext);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(10, 10);
    lp.leftMargin = 10;/*w  w  w. j a  v  a2 s . c o m*/
    dotView.setLayoutParams(lp);
    dotView.setBackgroundResource(R.drawable.dot_selected);
    dotView.setAlpha(0.38f);
    dotList.add(dotView);
    lin_add.addView(dotView);
    ComCarPropsBean.PlanListBean newBean = new ComCarPropsBean.PlanListBean();
    newBean.setSyxList(customSyxPlan);
    newBean.setJqxList(customJqxPlan);
    newBean.setFjxList(customFjxPlan);
    newBean.setQtxList(customQtxPlan);
    //planList.add(newBean);
    planList.add(prePosition, newBean);
    //?
    mCardAdapter.addViewCount();
    mCardAdapter.notifyDataSetChanged();
    vp_tb.setCurrentItem(prePosition);
}

From source file:com.google.samples.apps.iosched.util.LPreviewUtilsBase.java

public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate) {
    final int imageResId = isCheck ? R.drawable.add_schedule_button_icon_checked
            : R.drawable.add_schedule_button_icon_unchecked;

    if (imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();/*from   w ww.j a v a  2  s .com*/
            imageView.setAlpha(1f);
        }
    }

    if (allowAnimate && isCheck) {
        int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}