Java Code Examples for androidx.constraintlayout.widget.ConstraintSet#clone()
The following examples show how to use
androidx.constraintlayout.widget.ConstraintSet#clone() .
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: ProgramEventDetailActivity.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 7 votes |
@Override public void showHideFilter() { Transition transition = new ChangeBounds(); transition.setDuration(200); TransitionManager.beginDelayedTransition(binding.backdropLayout, transition); backDropActive = !backDropActive; ConstraintSet initSet = new ConstraintSet(); initSet.clone(binding.backdropLayout); binding.filterOpen.setVisibility(backDropActive ? View.VISIBLE : View.GONE); if (backDropActive) { initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.filterLayout, ConstraintSet.BOTTOM, 50); } else { initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.backdropGuideTop, ConstraintSet.BOTTOM, 0); } initSet.applyTo(binding.backdropLayout); }
Example 2
Source File: MainFragment.java From InviZible with GNU General Public License v3.0 | 6 votes |
@SuppressLint("SetTextI18n") @Override public void setITPDLogViewText() { if (getActivity() != null && tvITPDLog == null && !orientationLandscape) { tvITPDLog = getActivity().findViewById(R.id.tvITPDLog); clITPDLog = getActivity().findViewById(R.id.clITPDLog); } if (tvITPDLog != null) { tvITPDLog.setText(getText(R.string.tvITPDDefaultLog) + " " + ITPDVersion); tvITPDLog.setGravity(Gravity.CENTER); if (clITPDLog != null) { ConstraintSet set = new ConstraintSet(); set.clone(clITPDLog); set.connect(tvITPDLog.getId(), ConstraintSet.TOP, clITPDLog.getId(), ConstraintSet.TOP); set.applyTo(clITPDLog); } } }
Example 3
Source File: MainFragment.java From InviZible with GNU General Public License v3.0 | 6 votes |
@Override public void setITPDLogViewText(Spanned text) { if (getActivity() != null && tvITPDLog == null && !orientationLandscape) { tvITPDLog = getActivity().findViewById(R.id.tvITPDLog); clITPDLog = getActivity().findViewById(R.id.clITPDLog); } if (tvITPDLog != null) { tvITPDLog.setText(text); tvITPDLog.setGravity(Gravity.NO_GRAVITY); if (clITPDLog != null) { ConstraintSet set = new ConstraintSet(); set.clone(clITPDLog); set.clear(tvITPDLog.getId(), ConstraintSet.TOP); set.applyTo(clITPDLog); } } }
Example 4
Source File: DataSetDetailActivity.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void showHideFilter() { Transition transition = new ChangeBounds(); transition.setDuration(200); TransitionManager.beginDelayedTransition(binding.backdropLayout, transition); backDropActive = !backDropActive; ConstraintSet initSet = new ConstraintSet(); initSet.clone(binding.backdropLayout); if (backDropActive) { initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.filterLayout, ConstraintSet.BOTTOM, 50); } else { initSet.connect(R.id.eventsLayout, ConstraintSet.TOP, R.id.backdropGuideTop, ConstraintSet.BOTTOM, 0); } initSet.applyTo(binding.backdropLayout); binding.filterOpen.setVisibility(backDropActive ? View.VISIBLE : View.GONE); }
Example 5
Source File: OngoingCallActivity.java From call_manage with MIT License | 5 votes |
/** * Moves the reject button to the middle */ private void moveRejectButtonToMiddle() { ConstraintSet ongoingSet = new ConstraintSet(); ongoingSet.clone(mOngoingCallLayout); ongoingSet.connect(R.id.reject_btn, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.END); ongoingSet.connect(R.id.reject_btn, ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.START); ongoingSet.setHorizontalBias(R.id.reject_btn, 0.5f); ongoingSet.setMargin(R.id.reject_btn, ConstraintSet.END, 0); ConstraintSet overlaySet = new ConstraintSet(); overlaySet.clone(this, R.layout.correction_overlay_reject_call_options); if (!mIsCreatingUI) { //Don't animate if the activity is just being created Transition transition = new ChangeBounds(); transition.setInterpolator(new AccelerateDecelerateInterpolator()); transition.addTarget(mRejectCallOverlay); transition.addTarget(mRejectButton); TransitionManager.beginDelayedTransition(mOngoingCallLayout, transition); } ongoingSet.applyTo(mOngoingCallLayout); overlaySet.applyTo((ConstraintLayout) mRejectCallOverlay); mFloatingRejectCallTimerButton.hide(); mFloatingCancelOverlayButton.hide(); mFloatingSendSMSButton.hide(); mRootView.removeView(mAnswerCallOverlay); }
Example 6
Source File: SingleCGroupAdapter.java From call_manage with MIT License | 5 votes |
/** * Animates the ContactHolder */ public void animate() { ConstraintLayout itemRoot = (ConstraintLayout) itemView; ConstraintSet set = new ConstraintSet(); set.clone(itemRoot); Transition transition = new AutoTransition(); transition.setInterpolator(new OvershootInterpolator()); TransitionManager.beginDelayedTransition(itemRoot, transition); int layoutId = mEditModeEnabled ? R.layout.item_contact_editable_modified : R.layout.item_contact_editable; set.load(mContext, layoutId); set.applyTo(itemRoot); }
Example 7
Source File: TimePickerView.java From material-components-android with Apache License 2.0 | 5 votes |
private void updateToggleConstraints() { if (toggle.getVisibility() == VISIBLE) { // The clock display would normally be centered, clear the constraint on one side to make // room for the toggle ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(this); boolean isLtr = ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_LTR; int sideToClear = isLtr ? ConstraintSet.RIGHT : ConstraintSet.LEFT; constraintSet.clear(R.id.material_clock_display, sideToClear); constraintSet.applyTo(this); } }
Example 8
Source File: SearchTEActivity.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void activeFilter(boolean general) { ConstraintSet initSet = new ConstraintSet(); initSet.clone(binding.backdropLayout); if (backDropActive) { initSet.connect(R.id.mainLayout, ConstraintSet.TOP, general ? R.id.filterLayout : R.id.form_recycler, ConstraintSet.BOTTOM, 50); } else { initSet.connect(R.id.mainLayout, ConstraintSet.TOP, R.id.backdropGuideTop, ConstraintSet.BOTTOM, 0); } initSet.applyTo(binding.backdropLayout); }
Example 9
Source File: AdaptiveColorsActivity.java From PercentageChartView with Apache License 2.0 | 5 votes |
private void setupLayoutAnimation() { Explode transition = new Explode(); transition.setDuration(600); transition.setInterpolator(new OvershootInterpolator(1f)); getWindow().setEnterTransition(transition); displayedMode = MODE_PIE; mConstraintSet = new ConstraintSet(); mConstraintSet.clone(mConstraintLayout); fade = new Fade(); fade.setDuration(400); }
Example 10
Source File: GradientColorsActivity.java From PercentageChartView with Apache License 2.0 | 5 votes |
private void setupLayoutAnimation() { Explode transition = new Explode(); transition.setDuration(600); transition.setInterpolator(new OvershootInterpolator(1f)); getWindow().setEnterTransition(transition); displayedMode = MODE_PIE; mConstraintSet = new ConstraintSet(); mConstraintSet.clone(mConstraintLayout); fade = new Fade(); fade.setDuration(400); }
Example 11
Source File: WebRtcCallView.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private void fadeControls(int visibility) { Transition transition = new AutoTransition().setDuration(TRANSITION_DURATION_MILLIS); TransitionManager.beginDelayedTransition(parent, transition); ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(parent); for (View view : visibleViewSet) { constraintSet.setVisibility(view.getId(), visibility); } constraintSet.applyTo(parent); }
Example 12
Source File: ContactSelectionListFragment.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private void setChipGroupVisibility(int visibility) { TransitionManager.beginDelayedTransition(constraintLayout, new AutoTransition().setDuration(CHIP_GROUP_REVEAL_DURATION_MS)); ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(constraintLayout); constraintSet.setVisibility(R.id.chipGroupScrollContainer, visibility); constraintSet.applyTo(constraintLayout); }
Example 13
Source File: CommentsListingRecyclerViewAdapter.java From Infinity-For-Reddit with GNU Affero General Public License v3.0 | 4 votes |
CommentViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); if (mVoteButtonsOnTheRight) { ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(bottomConstraintLayout); constraintSet.clear(upvoteButton.getId(), ConstraintSet.START); constraintSet.clear(scoreTextView.getId(), ConstraintSet.START); constraintSet.clear(downvoteButton.getId(), ConstraintSet.START); constraintSet.clear(expandButton.getId(), ConstraintSet.END); constraintSet.clear(replyButton.getId(), ConstraintSet.END); constraintSet.connect(upvoteButton.getId(), ConstraintSet.END, scoreTextView.getId(), ConstraintSet.START); constraintSet.connect(scoreTextView.getId(), ConstraintSet.END, downvoteButton.getId(), ConstraintSet.START); constraintSet.connect(downvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); constraintSet.connect(moreButton.getId(), ConstraintSet.START, expandButton.getId(), ConstraintSet.END); constraintSet.connect(moreButton.getId(), ConstraintSet.END, upvoteButton.getId(), ConstraintSet.END); constraintSet.connect(expandButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END); constraintSet.connect(replyButton.getId(), ConstraintSet.START, replyButton.getId(), ConstraintSet.END); constraintSet.setHorizontalBias(moreButton.getId(), 0); constraintSet.applyTo(bottomConstraintLayout); } if (mShowCommentDivider) { commentDivider.setVisibility(View.VISIBLE); } itemView.setBackgroundColor(mCommentBackgroundColor); authorTextView.setTextColor(mUsernameColor); authorFlairTextView.setTextColor(mAuthorFlairColor); commentTimeTextView.setTextColor(mSecondaryTextColor); awardsTextView.setTextColor(mSecondaryTextColor); commentMarkdownView.setTextColor(mCommentColor); upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); scoreTextView.setTextColor(mCommentIconAndInfoColor); downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); moreButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); expandButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); saveButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); replyButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); commentDivider.setBackgroundColor(mDividerColor); }
Example 14
Source File: OpenChannelBSDFragment.java From zap-android with MIT License | 4 votes |
private void switchToFailedScreen(String error) { // Animate Layout changes ConstraintSet csRoot = new ConstraintSet(); csRoot.clone(mRootLayout); csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP); csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f); Transition transition = new ChangeBounds(); transition.setInterpolator(new DecelerateInterpolator(3)); transition.setDuration(1000); //transition.setStartDelay(200); TransitionManager.beginDelayedTransition(mRootLayout, transition); csRoot.applyTo(mRootLayout); // Animate finished Icon switch mProgressFinishedIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp)); mProgressFinishedIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed))); ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f); ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f); scaleUpX.setDuration(500); scaleUpY.setDuration(500); AnimatorSet scaleUpIcon = new AnimatorSet(); scaleUpIcon.play(scaleUpX).with(scaleUpY); scaleUpIcon.start(); ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f); ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f); ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f); ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f); scaleDownX.setDuration(500); scaleDownY.setDuration(500); scaleDownX2.setDuration(500); scaleDownY2.setDuration(500); AnimatorSet scaleDownIcon = new AnimatorSet(); scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2); scaleDownIcon.start(); // Set failed states mTvFinishedText.setText(getString(R.string.channel_open_error)); mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed)); mTvFinishedTextDetail.setText(error); // Animate in mFinishedScreen.setAlpha(1.0f); AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f); animateIn.setDuration(300); animateIn.setStartOffset(300); animateIn.setFillAfter(true); mFinishedScreen.startAnimation(animateIn); mOkButton.setEnabled(true); }
Example 15
Source File: SendBSDFragment.java From zap-android with MIT License | 4 votes |
private void switchToSuccessScreen() { // Animate Layout changes ConstraintSet csRoot = new ConstraintSet(); csRoot.clone(mRootLayout); csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP); csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f); Transition transition = new ChangeBounds(); transition.setInterpolator(new DecelerateInterpolator(3)); transition.setDuration(1000); //transition.setStartDelay(200); TransitionManager.beginDelayedTransition(mRootLayout, transition); csRoot.applyTo(mRootLayout); // Animate finished Icon switch ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f); ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f); scaleUpX.setDuration(500); scaleUpY.setDuration(500); AnimatorSet scaleUpIcon = new AnimatorSet(); //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); scaleUpIcon.play(scaleUpX).with(scaleUpY); scaleUpIcon.start(); ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f); ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f); ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f); ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f); scaleDownX.setDuration(500); scaleDownY.setDuration(500); scaleDownX2.setDuration(500); scaleDownY2.setDuration(500); AnimatorSet scaleDownIcon = new AnimatorSet(); //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2); scaleDownIcon.start(); // Animate in mFinishedScreen.setAlpha(1.0f); AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f); animateIn.setDuration(300); animateIn.setStartOffset(300); animateIn.setFillAfter(true); mFinishedScreen.startAnimation(animateIn); // Enable Ok button mOkButton.setEnabled(true); }
Example 16
Source File: SendBSDFragment.java From zap-android with MIT License | 4 votes |
private void switchToFailedScreen(String error) { // Animate Layout changes ConstraintSet csRoot = new ConstraintSet(); csRoot.clone(mRootLayout); csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP); csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f); Transition transition = new ChangeBounds(); transition.setInterpolator(new DecelerateInterpolator(3)); transition.setDuration(1000); //transition.setStartDelay(200); TransitionManager.beginDelayedTransition(mRootLayout, transition); csRoot.applyTo(mRootLayout); // Animate finished Icon switch mProgressFinishedIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp)); mProgressFinishedIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed))); ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f); ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f); scaleUpX.setDuration(500); scaleUpY.setDuration(500); AnimatorSet scaleUpIcon = new AnimatorSet(); //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); scaleUpIcon.play(scaleUpX).with(scaleUpY); scaleUpIcon.start(); ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f); ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f); ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f); ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f); scaleDownX.setDuration(500); scaleDownY.setDuration(500); scaleDownX2.setDuration(500); scaleDownY2.setDuration(500); AnimatorSet scaleDownIcon = new AnimatorSet(); //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2); scaleDownIcon.start(); // Set failed states mTvFinishedText.setText(R.string.send_fail); mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed)); mTvFinishedText2.setText(error); // Animate in mFinishedScreen.setAlpha(1.0f); AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f); animateIn.setDuration(300); animateIn.setStartOffset(300); animateIn.setFillAfter(true); mFinishedScreen.startAnimation(animateIn); // Enable Ok button mOkButton.setEnabled(true); }
Example 17
Source File: ChannelDetailBSDFragment.java From zap-android with MIT License | 4 votes |
private void switchToFinishScreen(boolean success, String error) { mFinishedScreen.setVisibility(View.VISIBLE); // Animate Layout changes ConstraintSet csRoot = new ConstraintSet(); csRoot.clone(mRootLayout); csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP); csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f); Transition transition = new ChangeBounds(); transition.setInterpolator(new DecelerateInterpolator(3)); transition.setDuration(1000); TransitionManager.beginDelayedTransition(mRootLayout, transition); csRoot.applyTo(mRootLayout); // Animate result icon switch if (!success) { mProgressResultIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_failed_circle_black_60dp)); mProgressResultIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superRed))); } else { mProgressResultIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_check_circle_black_60dp)); mProgressResultIcon.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.superGreen))); } ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressResultIcon, "scaleX", 0f, 1f); ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressResultIcon, "scaleY", 0f, 1f); scaleUpX.setDuration(500); scaleUpY.setDuration(500); AnimatorSet scaleUpIcon = new AnimatorSet(); scaleUpIcon.play(scaleUpX).with(scaleUpY); scaleUpIcon.start(); ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f); ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f); ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mProgressThunderIcon, "scaleX", 1f, 0f); ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mProgressThunderIcon, "scaleY", 1f, 0f); scaleDownX.setDuration(500); scaleDownY.setDuration(500); scaleDownX2.setDuration(500); scaleDownY2.setDuration(500); AnimatorSet scaleDownIcon = new AnimatorSet(); scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2); scaleDownIcon.start(); if (success) { mTvFinishedText.setText(R.string.success); mTvFinishedText2.setText(R.string.channel_close_success); } else { mTvFinishedText.setText(R.string.channel_close_error); mTvFinishedText.setTextColor(getResources().getColor(R.color.superRed)); mTvFinishedText2.setText(error); } // Animate in mFinishedScreen.setAlpha(1.0f); AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f); animateIn.setDuration(300); animateIn.setStartOffset(300); animateIn.setFillAfter(true); mFinishedScreen.startAnimation(animateIn); // Enable Ok button mOkButton.setEnabled(true); }
Example 18
Source File: LnUrlWithdrawBSDFragment.java From zap-android with MIT License | 4 votes |
private void switchToSuccessScreen() { // Animate Layout changes ConstraintSet csRoot = new ConstraintSet(); csRoot.clone(mRootLayout); csRoot.connect(mProgressScreen.getId(), ConstraintSet.TOP, ConstraintSet.PARENT_ID, ConstraintSet.TOP); csRoot.setVerticalBias(mProgressScreen.getId(), 0.0f); Transition transition = new ChangeBounds(); transition.setInterpolator(new DecelerateInterpolator(3)); transition.setDuration(1000); //transition.setStartDelay(200); TransitionManager.beginDelayedTransition(mRootLayout, transition); csRoot.applyTo(mRootLayout); // Animate finished Icon switch ObjectAnimator scaleUpX = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleX", 0f, 1f); ObjectAnimator scaleUpY = ObjectAnimator.ofFloat(mProgressFinishedIcon, "scaleY", 0f, 1f); scaleUpX.setDuration(500); scaleUpY.setDuration(500); AnimatorSet scaleUpIcon = new AnimatorSet(); //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); scaleUpIcon.play(scaleUpX).with(scaleUpY); scaleUpIcon.start(); ObjectAnimator scaleDownX = ObjectAnimator.ofFloat(mProgressBar, "scaleX", 1f, 0f); ObjectAnimator scaleDownY = ObjectAnimator.ofFloat(mProgressBar, "scaleY", 1f, 0f); ObjectAnimator scaleDownX2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleX", 1f, 0f); ObjectAnimator scaleDownY2 = ObjectAnimator.ofFloat(mIvProgressPaymentTypeIcon, "scaleY", 1f, 0f); scaleDownX.setDuration(500); scaleDownY.setDuration(500); scaleDownX2.setDuration(500); scaleDownY2.setDuration(500); AnimatorSet scaleDownIcon = new AnimatorSet(); //scaleUpIcon.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); scaleDownIcon.play(scaleDownX).with(scaleDownY).with(scaleDownX2).with(scaleDownY2); scaleDownIcon.start(); // Animate in mFinishedScreen.setAlpha(1.0f); AlphaAnimation animateIn = new AlphaAnimation(0f, 1.0f); animateIn.setDuration(300); animateIn.setStartOffset(300); animateIn.setFillAfter(true); mFinishedScreen.startAnimation(animateIn); // Enable Ok button mOkButton.setEnabled(true); }
Example 19
Source File: VideoFragment.java From googleads-ima-android with Apache License 2.0 | 4 votes |
private void initUi(View rootView) { VideoPlayerWithAdPlayback mVideoPlayerWithAdPlayback = rootView.findViewById(R.id.videoPlayerWithAdPlayback); View playButton = rootView.findViewById(R.id.playButton); View playPauseToggle = rootView.findViewById(R.id.videoContainer); ViewGroup companionAdSlot = rootView.findViewById(R.id.companionAdSlot); mVideoTitle = rootView.findViewById(R.id.video_title); mVideoExampleLayout = rootView.findViewById(R.id.videoExampleLayout); mVideoExampleLayout.setOverScrollMode(View.OVER_SCROLL_ALWAYS); mVideoExampleLayout.setSmoothScrollingEnabled(true); // Make the dummyScrollContent height the size of the screen height. DisplayMetrics displayMetrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); ConstraintLayout constraintLayout = rootView.findViewById(R.id.constraintLayout); ConstraintSet forceHeight = new ConstraintSet(); forceHeight.clone(constraintLayout); forceHeight.constrainHeight(R.id.dummyScrollContent, displayMetrics.heightPixels); forceHeight.applyTo(constraintLayout); final TextView logText = rootView.findViewById(R.id.logText); // Provide an implementation of a logger so we can output SDK events to the UI. VideoPlayerController.Logger logger = new VideoPlayerController.Logger() { @Override public void log(String message) { Log.i("ImaExample", message); if (logText != null) { logText.append(message); } } }; mVideoPlayerController = new VideoPlayerController( this.getActivity(), mVideoPlayerWithAdPlayback, playButton, playPauseToggle, getString(R.string.ad_ui_lang), companionAdSlot, logger); // If we've already selected a video, load it now. if (mVideoItem != null) { loadVideo(mVideoItem); } }
Example 20
Source File: ConversationReactionOverlay.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
private void setupSelectedEmoji() { final String oldEmoji = getOldEmoji(messageRecord); if (oldEmoji == null) { selectedView.setVisibility(View.GONE); } boolean foundSelected = false; for (int i = 0; i < emojiViews.length; i++) { final EmojiImageView view = emojiViews[i]; view.setScaleX(1.0f); view.setScaleY(1.0f); view.setTranslationY(0); boolean isAtCustomIndex = i == customEmojiIndex; boolean isNotAtCustomIndexAndOldEmojiMatches = !isAtCustomIndex && ReactionEmoji.values()[i].emoji.equals(oldEmoji); boolean isAtCustomIndexAndOldEmojiExists = isAtCustomIndex && oldEmoji != null; if (!foundSelected && (isNotAtCustomIndexAndOldEmojiMatches || isAtCustomIndexAndOldEmojiExists)) { foundSelected = true; selectedView.setVisibility(View.VISIBLE); ConstraintSet constraintSet = new ConstraintSet(); constraintSet.clone(foregroundView); constraintSet.clear(selectedView.getId(), ConstraintSet.LEFT); constraintSet.clear(selectedView.getId(), ConstraintSet.RIGHT); constraintSet.connect(selectedView.getId(), ConstraintSet.LEFT, view.getId(), ConstraintSet.LEFT); constraintSet.connect(selectedView.getId(), ConstraintSet.RIGHT, view.getId(), ConstraintSet.RIGHT); constraintSet.applyTo(foregroundView); if (isAtCustomIndex) { view.setImageEmoji(oldEmoji); view.setTag(oldEmoji); } else { view.setImageEmoji(ReactionEmoji.values()[i].emoji); } } else if (isAtCustomIndex) { view.setImageDrawable(AppCompatResources.getDrawable(getContext(), R.drawable.ic_any_emoji_32)); view.setTag(null); } else { view.setImageEmoji(ReactionEmoji.values()[i].emoji); } } }