Java Code Examples for androidx.constraintlayout.widget.ConstraintSet#setHorizontalBias()
The following examples show how to use
androidx.constraintlayout.widget.ConstraintSet#setHorizontalBias() .
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: 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 2
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); }