List of usage examples for android.view View ALPHA
Property ALPHA
To view the source code for android.view View ALPHA.
Click Source Link
alpha
functionality handled by the View#setAlpha(float) and View#getAlpha() methods. From source file:org.telegram.ui.SettingsActivity.java
private void showAvatarProgress(boolean show, boolean animated) { if (avatarProgressView == null) { return;//from ww w . j a va 2s .c o m } if (avatarAnimation != null) { avatarAnimation.cancel(); avatarAnimation = null; } if (animated) { avatarAnimation = new AnimatorSet(); if (show) { avatarProgressView.setVisibility(View.VISIBLE); avatarAnimation.playTogether(ObjectAnimator.ofFloat(avatarProgressView, View.ALPHA, 1.0f)); } else { avatarAnimation.playTogether(ObjectAnimator.ofFloat(avatarProgressView, View.ALPHA, 0.0f)); } avatarAnimation.setDuration(180); avatarAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (avatarAnimation == null || avatarProgressView == null) { return; } if (!show) { avatarProgressView.setVisibility(View.INVISIBLE); } avatarAnimation = null; } @Override public void onAnimationCancel(Animator animation) { avatarAnimation = null; } }); avatarAnimation.start(); } else { if (show) { avatarProgressView.setAlpha(1.0f); avatarProgressView.setVisibility(View.VISIBLE); } else { avatarProgressView.setAlpha(0.0f); avatarProgressView.setVisibility(View.INVISIBLE); } } }
From source file:com.waz.zclient.pages.main.participants.ParticipantFragment.java
@Override public void onShowPickUser(IPickUserController.Destination destination, View anchorView) { if (LayoutSpec.isPhone(getActivity())) { return;/*from w w w. j ava 2 s .c o m*/ } if (!getCurrentPickerDestination().equals(destination)) { onHidePickUser(getCurrentPickerDestination(), true); return; } FragmentManager fragmentManager = getChildFragmentManager(); int pickUserAnimation = LayoutSpec.isTablet(getActivity()) ? R.anim.fade_in : R.anim.slide_in_from_bottom_pick_user; if (!groupConversation && otherUser != null) { getControllerFactory().getPickUserController().addUser(otherUser); } fragmentManager.beginTransaction().setCustomAnimations(pickUserAnimation, R.anim.fade_out) .add(R.id.fl__add_to_conversation__pickuser__container, PickUserFragment.newInstance(true, groupConversation), PickUserFragment.TAG) .addToBackStack(PickUserFragment.TAG).commit(); if (LayoutSpec.isPhone(getActivity())) { getControllerFactory().getNavigationController().setRightPage(Page.PICK_USER_ADD_TO_CONVERSATION, TAG); } final ObjectAnimator hideParticipantsAnimator = ObjectAnimator.ofFloat(participantsContainerView, View.ALPHA, 1f, 0f); hideParticipantsAnimator.setInterpolator(new Quart.EaseOut()); hideParticipantsAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_medium)); hideParticipantsAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { participantsContainerView.setVisibility(View.GONE); } }); hideParticipantsAnimator.start(); }
From source file:com.waz.zclient.pages.main.participants.ParticipantFragment.java
@Override public void onHidePickUser(IPickUserController.Destination destination, boolean closeWithoutSelectingPeople) { if (LayoutSpec.isPhone(getActivity())) { return;/* ww w . j av a2 s .com*/ } if (!destination.equals(getCurrentPickerDestination())) { return; } // Workaround for animation bug with nested child fragments // Animating fragment container views and then popping stack at end of animation int showParticipantsDelay = getResources().getInteger(R.integer.framework_animation_delay_long); int hidePickUserAnimDuration = getResources().getInteger(R.integer.framework_animation_duration_medium); TimeInterpolator hidePickUserInterpolator = new Expo.EaseIn(); ObjectAnimator hidePickUserAnimator; // Fade animation in participants dialog on tablet if (LayoutSpec.isTablet(getActivity())) { hidePickUserAnimator = ObjectAnimator.ofFloat(pickUserContainerView, View.ALPHA, 1f, 0f); hidePickUserAnimator.setInterpolator(new Linear.EaseIn()); } else { hidePickUserAnimator = ObjectAnimator.ofFloat(pickUserContainerView, View.TRANSLATION_Y, 0f, pickUserContainerView.getMeasuredHeight()); hidePickUserAnimator.setInterpolator(hidePickUserInterpolator); hidePickUserAnimator.setDuration(hidePickUserAnimDuration); } hidePickUserAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (!isResumed()) { return; } getChildFragmentManager().popBackStackImmediate(PickUserFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE); if (LayoutSpec.isTablet(getActivity())) { // Reset for fade animation in participants dialog on tablet pickUserContainerView.setAlpha(1f); } else { pickUserContainerView.setTranslationY(0f); } } }); participantsContainerView.setAlpha(0); participantsContainerView.setVisibility(View.VISIBLE); ObjectAnimator showParticipantsAnimator = ObjectAnimator.ofFloat(participantsContainerView, View.ALPHA, 0f, 1f); showParticipantsAnimator.setInterpolator(new Quart.EaseOut()); showParticipantsAnimator .setDuration(getResources().getInteger(R.integer.framework_animation_duration_medium)); showParticipantsAnimator.setStartDelay(showParticipantsDelay); AnimatorSet hideSet = new AnimatorSet(); hideSet.playTogether(hidePickUserAnimator, showParticipantsAnimator); hideSet.start(); if (LayoutSpec.isPhone(getActivity()) && getControllerFactory().getNavigationController() .getPagerPosition() == NavigationController.SECOND_PAGE) { // TODO: https://wearezeta.atlassian.net/browse/AN-3081 if (getControllerFactory().getConversationScreenController().isShowingParticipant()) { getControllerFactory().getNavigationController().setRightPage(Page.PARTICIPANT, TAG); } else { getControllerFactory().getNavigationController().setRightPage(Page.MESSAGE_STREAM, TAG); } } }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
Animator generateAnimator(View target, boolean dismiss, long startDelay) { float[] fadeIn = new float[] { 0f, 1f }; float[] fadeOut = new float[] { 1f, 0f }; final ObjectAnimator propAnimator = ObjectAnimator.ofPropertyValuesHolder(target, PropertyValuesHolder.ofFloat(View.ALPHA, dismiss ? fadeOut : fadeIn), PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, dismiss ? (target.getHeight() * 2f) : 0f)); propAnimator.setStartDelay(startDelay); propAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); propAnimator.setDuration(240);//ww w . ja v a2 s . c o m return propAnimator; }
From source file:com.mishiranu.dashchan.ui.navigator.NavigatorActivity.java
private void showScaleAnimation(boolean post) { clearListAnimator();/*ww w .j a v a 2 s .c om*/ if (allowScaleAnimation) { if (post) { listView.setVisibility(View.INVISIBLE); handler.post(showScaleRunnable); } else { final float fromScale = 0.925f; ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(listView, View.ALPHA, 0f, 1f); ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(listView, View.SCALE_X, fromScale, 1f); ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(listView, View.SCALE_Y, fromScale, 1f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator); animatorSet.setDuration(100); startListAnimator(animatorSet); } } }
From source file:com.amaze.filemanager.activities.MainActivity.java
void revealShow(final View view, boolean reveal) { if (reveal) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f); animator.setDuration(300); //ms animator.addListener(new AnimatorListenerAdapter() { @Override// ww w . j ava 2 s .c om public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } }); animator.start(); } else { ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f); animator.setDuration(300); //ms animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.GONE); } }); animator.start(); } }
From source file:org.telegram.ui.PassportActivity.java
private void showEditDoneProgress(final boolean animateDoneItem, final boolean show) { if (doneItemAnimation != null) { doneItemAnimation.cancel();/*w w w . j ava 2 s . co m*/ } if (animateDoneItem && doneItem != null) { doneItemAnimation = new AnimatorSet(); if (show) { progressView.setVisibility(View.VISIBLE); doneItem.setEnabled(false); doneItemAnimation.playTogether(ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(doneItem.getImageView(), View.ALPHA, 0.0f), ObjectAnimator.ofFloat(progressView, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(progressView, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(progressView, View.ALPHA, 1.0f)); } else { doneItem.getImageView().setVisibility(View.VISIBLE); doneItem.setEnabled(true); doneItemAnimation.playTogether(ObjectAnimator.ofFloat(progressView, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(progressView, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(progressView, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(doneItem.getImageView(), View.ALPHA, 1.0f)); } doneItemAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (doneItemAnimation != null && doneItemAnimation.equals(animation)) { if (!show) { progressView.setVisibility(View.INVISIBLE); } else { doneItem.getImageView().setVisibility(View.INVISIBLE); } } } @Override public void onAnimationCancel(Animator animation) { if (doneItemAnimation != null && doneItemAnimation.equals(animation)) { doneItemAnimation = null; } } }); doneItemAnimation.setDuration(150); doneItemAnimation.start(); } else if (acceptTextView != null) { doneItemAnimation = new AnimatorSet(); if (show) { progressViewButton.setVisibility(View.VISIBLE); bottomLayout.setEnabled(false); doneItemAnimation.playTogether(ObjectAnimator.ofFloat(acceptTextView, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(acceptTextView, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(acceptTextView, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(progressViewButton, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(progressViewButton, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(progressViewButton, View.ALPHA, 1.0f)); } else { acceptTextView.setVisibility(View.VISIBLE); bottomLayout.setEnabled(true); doneItemAnimation.playTogether(ObjectAnimator.ofFloat(progressViewButton, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(progressViewButton, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(progressViewButton, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(acceptTextView, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(acceptTextView, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(acceptTextView, View.ALPHA, 1.0f)); } doneItemAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (doneItemAnimation != null && doneItemAnimation.equals(animation)) { if (!show) { progressViewButton.setVisibility(View.INVISIBLE); } else { acceptTextView.setVisibility(View.INVISIBLE); } } } @Override public void onAnimationCancel(Animator animation) { if (doneItemAnimation != null && doneItemAnimation.equals(animation)) { doneItemAnimation = null; } } }); doneItemAnimation.setDuration(150); doneItemAnimation.start(); } }