List of usage examples for android.view View setAlpha
public void setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)
From source file:com.rbware.github.androidcouchpotato.app.OnboardingSupportFragment.java
void startEnterAnimation() { mEnterTransitionFinished = true;/*w ww .jav a 2s . c o m*/ initializeViews(getView()); List<Animator> animators = new ArrayList<>(); Animator animator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_page_indicator_enter); animator.setTarget(getPageCount() <= 1 ? mStartButton : mPageIndicator); animators.add(animator); // Header title View view = getActivity().findViewById(R.id.title); view.setAlpha(0); animator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_title_enter); animator.setStartDelay(START_DELAY_TITLE_MS); animator.setTarget(view); animators.add(animator); // Header description view = getActivity().findViewById(R.id.description); view.setAlpha(0); animator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_description_enter); animator.setStartDelay(START_DELAY_DESCRIPTION_MS); animator.setTarget(view); animators.add(animator); // Customized animation by the inherited class. Animator customAnimator = onCreateEnterAnimation(); if (customAnimator != null) { animators.add(customAnimator); } mAnimator = new AnimatorSet(); mAnimator.playTogether(animators); mAnimator.start(); // Search focus and give the focus to the appropriate child which has become visible. getView().requestFocus(); }
From source file:net.archenemy.archenemyapp.presenter.MainActivity.java
private void setViewSelected(View view) { view.setAlpha(1F); }
From source file:net.archenemy.archenemyapp.presenter.MainActivity.java
private void setViewUnselected(View view) { view.setAlpha(0.54F); }
From source file:io.bunnyblue.noticedog.app.lockscreen.ui.LockScreenWidget.java
void safeSetVisibility(View view, int visibility) { if (visibility == 0) { view.setAlpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT); } else {/* w ww. j av a 2 s . com*/ view.setAlpha(0.0f); } }
From source file:com.pdmanager.views.caregiver.CaregiverActivity.java
@Override public void onMessageReceived(final CNMessage cnMessage) { if (application.getUniqueId().equals(cnMessage.getUniqueId())) { return;/* ww w . j a va 2s. c o m*/ } if (cnMessage.getMessageType() == CNMessage.CNMessageType.Calling) { if (application.isInConference()) { application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.Busy, null); return; } callDialog = new AlertDialog.Builder(this).create(); LayoutInflater inflater = getLayoutInflater(); View incomingCallDialog = inflater.inflate(R.layout.incoming_call_dialog, null); incomingCallDialog.setAlpha(0.5f); callDialog.setView(incomingCallDialog); TextView caller = (TextView) incomingCallDialog.findViewById(R.id.caller); caller.setText(cnMessage.getDisplayName()); Button answerButton = (Button) incomingCallDialog.findViewById(R.id.answer_button); answerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { application.setConferenceId(cnMessage.getConferenceId()); application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerAccept, null); callDialog.hide(); currentRingtone.stop(); Intent intent = new Intent(application.getContext(), CaregiverActivity.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(intent); application.join(application.getConferenceId(), true); } }); Button declineButton = (Button) incomingCallDialog.findViewById(R.id.decline_button); declineButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerDecline, null); currentRingtone.stop(); callDialog.hide(); } }); callDialog.setCancelable(false); callDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); //play current Ringtone currentRingtone.play(); callDialog.show(); } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.Cancel) { currentRingtone.stop(); callDialog.hide(); } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.EndCall) { if (application.leave()) { int count = getFragmentManager().getBackStackEntryCount(); String name = getFragmentManager().getBackStackEntryAt(count - 2).getName(); getFragmentManager().popBackStack(name, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } }
From source file:org.starfishrespect.myconsumption.android.ui.BaseActivity.java
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); setupNavDrawer();/* w ww . j a v a2 s . c o m*/ View mainContent = findViewById(R.id.main_content); if (mainContent != null) { mainContent.setAlpha(0); mainContent.animate().alpha(1).setDuration(MAIN_CONTENT_FADEIN_DURATION); } else { LOGW(TAG, "No view with ID main_content to fade in."); } }
From source file:com.zhangyp.higo.drawingboard.fragment.SketchFragment.java
void setAlpha(View v, float alpha) { if (Build.VERSION.SDK_INT < 11) { AlphaAnimation animation = new AlphaAnimation(1.0F, alpha); animation.setFillAfter(true);//w w w .java2 s . com v.startAnimation(animation); } else { v.setAlpha(alpha); } }
From source file:com.androzic.ui.FileListDialog.java
@SuppressLint("NewApi") private void crossfade(boolean direct) { final View from = direct ? progressBar : listView; final View to = direct ? listView : progressBar; if (!direct) { dialogView.setMinimumWidth(dialogView.getWidth()); dialogView.setMinimumHeight(dialogView.getHeight()); }// w ww . j a v a 2s . c o m if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) { from.setVisibility(View.GONE); to.setVisibility(View.VISIBLE); } else { // Set the content view to 0% opacity but visible, so that it is visible // (but fully transparent) during the animation. to.setAlpha(0f); to.setVisibility(View.VISIBLE); // Animate the content view to 100% opacity, and clear any animation // listener set on the view. to.animate().alpha(1f).setDuration(shortAnimationDuration).setListener(null); // Animate the loading view to 0% opacity. After the animation ends, // set its visibility to GONE as an optimization step (it won't // participate in layout passes, etc.) from.animate().alpha(0f).setDuration(shortAnimationDuration).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { from.setVisibility(View.GONE); } }); } }
From source file:org.onebusaway.android.util.UIUtils.java
/** * Shows a view, using animation if the platform supports it * * @param v View to show * @param animationDuration duration of animation *//*from w w w .j a va 2 s .co m*/ @TargetApi(14) public static void showViewWithAnimation(final View v, int animationDuration) { // If we're on a legacy device, show the view without the animation if (!canAnimateViewModern()) { showViewWithoutAnimation(v); return; } if (v.getVisibility() == View.VISIBLE && v.getAlpha() == 1) { // View is already visible and not transparent, return without doing anything return; } v.clearAnimation(); if (canCancelAnimation()) { v.animate().cancel(); } if (v.getVisibility() != View.VISIBLE) { // Set the content view to 0% opacity but visible, so that it is visible // (but fully transparent) during the animation. v.setAlpha(0f); v.setVisibility(View.VISIBLE); } // Animate the content view to 100% opacity, and clear any animation listener set on the view. v.animate().alpha(1f).setDuration(animationDuration).setListener(null); }
From source file:com.pdmanager.views.patient.MainActivity.java
@Override public void onMessageReceived(final CNMessage cnMessage) { if (application.getUniqueId().equals(cnMessage.getUniqueId())) { return;//from w w w . ja v a 2 s . c o m } if (cnMessage.getMessageType() == CNMessage.CNMessageType.Calling) { if (application.isInConference()) { application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.Busy, null); return; } callDialog = new AlertDialog.Builder(this).create(); LayoutInflater inflater = getLayoutInflater(); View incomingCallDialog = inflater.inflate(R.layout.incoming_call_dialog, null); incomingCallDialog.setAlpha(0.5f); callDialog.setView(incomingCallDialog); TextView caller = (TextView) incomingCallDialog.findViewById(R.id.caller); caller.setText(cnMessage.getDisplayName()); Button answerButton = (Button) incomingCallDialog.findViewById(R.id.answer_button); answerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { application.setConferenceId(cnMessage.getConferenceId()); application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerAccept, null); callDialog.hide(); currentRingtone.stop(); Intent intent = new Intent(application.getContext(), MainActivity.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(intent); application.join(application.getConferenceId(), true); } }); Button declineButton = (Button) incomingCallDialog.findViewById(R.id.decline_button); declineButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerDecline, null); currentRingtone.stop(); callDialog.hide(); } }); callDialog.setCancelable(false); callDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); //play current Ringtone currentRingtone.play(); callDialog.show(); } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.Cancel) { currentRingtone.stop(); callDialog.hide(); } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.EndCall) { if (application.leave()) { int count = getFragmentManager().getBackStackEntryCount(); String name = getFragmentManager().getBackStackEntryAt(count - 2).getName(); getFragmentManager().popBackStack(name, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } }