void showFilter(boolean isVisible) { mIsFilterVisible = isVisible; mConstraintSet.clone(mRootView); if (isVisible) { mConstraintSet.clear(mRvFilters.getId(), ConstraintSet.START); mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); } else { mConstraintSet.connect(mRvFilters.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.END); mConstraintSet.clear(mRvFilters.getId(), ConstraintSet.END); } ChangeBounds changeBounds = new ChangeBounds(); changeBounds.setDuration(350); changeBounds.setInterpolator(new AnticipateOvershootInterpolator(1.0f)); TransitionManager.beginDelayedTransition(mRootView, changeBounds); mConstraintSet.applyTo(mRootView); }
/** * Shows a vertical line in the program guide to indicate the current time. * It is only visible in the first screen. This method is called every minute. */ private void setCurrentTimeIndication() { // Get the difference between the current time and the given start time. Calculate // from this value in minutes the width in pixels. This will be horizontal offset // for the time indication. If channel icons are shown then we need to add a // the icon width to the offset. final long currentTime = Calendar.getInstance().getTimeInMillis(); final long durationTime = (currentTime - startTime) / 1000 / 60; final int offset = (int) (durationTime * pixelsPerMinute); // Set the left constraint of the time indication so it shows the actual time if (currentTimeIndication != null) { constraintSet.connect(currentTimeIndication.getId(), ConstraintSet.LEFT, constraintLayout.getId(), ConstraintSet.LEFT, offset); constraintSet.connect(currentTimeIndication.getId(), ConstraintSet.START, constraintLayout.getId(), ConstraintSet.START, offset); constraintSet.applyTo(constraintLayout); } }
ConstraintSet set = new ConstraintSet(); set.clone(parentLayout); set.connect(item.view.getId(), ConstraintSet.LEFT, ConstraintSet.PARENT_ID, ConstraintSet.LEFT); set.connect(item.view.getId(), ConstraintSet.RIGHT, ConstraintSet.PARENT_ID, ConstraintSet.RIGHT); set.connect(item.view.getId(), ConstraintSet.TOP, (i == 0 ? ConstraintSet.PARENT_ID : alarmItems.get(i - 1).view.getId()), ConstraintSet.BOTTOM); set.applyTo(parentLayout);