@Override public void onPanelSlide(View panel, float slideOffset) { View nowPlayingCard = QuickControlsFragment.topContainer; nowPlayingCard.setAlpha(1 - slideOffset); }
@Override public void onPanelExpanded(View panel) { View nowPlayingCard = QuickControlsFragment.topContainer; nowPlayingCard.setAlpha(0); }
static void setAlpha(View view, float alpha) { view.setAlpha(alpha); }
@Override public void onPanelCollapsed(View panel) { View nowPlayingCard = QuickControlsFragment.topContainer; nowPlayingCard.setAlpha(1); }
public void onAnimationEnd(Animator animation) { dropView.setVisibility(GONE); dropView.setAlpha(1); } });
private void clearAnimatedValues(final View view) { view.setAlpha(1f); view.setTranslationX(0f); view.setTranslationY(0f); }
private void setButtonEnabled(boolean enabled, View view) { if (view == null) { return; } view.setEnabled(enabled); view.setAlpha(enabled ? 1f : 0.3f); view.setVisibility(VISIBLE); }
private void addAnimate(SmartViewHolder holder, int postion) { if (mOpenAnimationEnable && mLastPosition < postion) { holder.itemView.setAlpha(0); holder.itemView.animate().alpha(1).start(); mLastPosition = postion; } }
@Override public void onAnimationEnd(Animator animation) { circleView.setVisibility(View.INVISIBLE); growingView.setVisibility(View.VISIBLE); endView.setAlpha(1f); } });
@Override public void transformPage(View page, float position) { position = (float) Math.sqrt(1 - Math.abs(position)); page.setAlpha(position); } });
@Override public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { if (lastScrollY < h) { scrollY = Math.min(h, scrollY); mScrollY = scrollY > h ? h : scrollY; buttonBar.setAlpha(1f * mScrollY / h); toolbar.setBackgroundColor(((255 * mScrollY / h) << 24) | color); parallax.setTranslationY(mOffset - mScrollY); } lastScrollY = scrollY; } });
@Override protected void onAnimationEndedBeforeStarted(@NonNull ChangeAnimationInfo info, @NonNull RecyclerView.ViewHolder item) { final View view = item.itemView; view.setAlpha(1); view.setTranslationX(0); view.setTranslationY(0); }
private void updateShuffleButton() { if (!isVisible() || !isAttachedToWindow || shuffleButton == null) { return; } if (!showShuffleButton) { shuffleButton.setVisibility(View.GONE); } else if (player == null) { setButtonEnabled(false, shuffleButton); } else { shuffleButton.setAlpha(player.getShuffleModeEnabled() ? 1f : 0.3f); shuffleButton.setEnabled(true); shuffleButton.setVisibility(View.VISIBLE); } }
private void animateUserProfileHeader() { vUserProfileRoot.setTranslationY(-vUserProfileRoot.getHeight()); ivUserProfilePhoto.setTranslationY(-ivUserProfilePhoto.getHeight()); vUserDetails.setTranslationY(-vUserDetails.getHeight()); vUserStats.setAlpha(0); vUserProfileRoot.animate().translationY(0).setDuration(300).setInterpolator(INTERPOLATOR); ivUserProfilePhoto.animate().translationY(0).setDuration(300).setStartDelay(100).setInterpolator(INTERPOLATOR); vUserDetails.animate().translationY(0).setDuration(300).setStartDelay(200).setInterpolator(INTERPOLATOR); vUserStats.animate().alpha(1).setDuration(200).setStartDelay(400).setInterpolator(INTERPOLATOR).start(); } }
@Override public int onFinish(@NonNull RefreshLayout layout, boolean success) { if (mManualOperation) { postStatus(success ? STATUS_GAME_FINISHED : STATUS_GAME_FAIL); } else { postStatus(STATUS_GAME_PREPARE); final View topView = mMaskViewTop; final View bottomView = mMaskViewBottom; final View shadowView = mShadowView; topView.setTranslationY(topView.getTranslationY() + mHalfHeaderHeight); bottomView.setTranslationY(bottomView.getTranslationY() - mHalfHeaderHeight); shadowView.setAlpha(1.f); topView.setVisibility(View.VISIBLE); bottomView.setVisibility(View.VISIBLE); shadowView.setVisibility(View.VISIBLE); } return super.onFinish(layout, success); }
private static void unsetAlpha(View view, NodeInfo nodeInfo) { if (Build.VERSION.SDK_INT >= 11) { if (nodeInfo.isAlphaSet() && view.getAlpha() != 1) { view.setAlpha(1); } } }
@Override public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) { view.setAlpha(0f); view.setScaleX(0f); view.setScaleY(0f); return ObjectAnimator.ofPropertyValuesHolder( view, PropertyValuesHolder.ofFloat(View.ALPHA, 1f), PropertyValuesHolder.ofFloat(View.SCALE_X, 1f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f)); }
private static void setAlpha(View view, NodeInfo nodeInfo) { if (Build.VERSION.SDK_INT >= 11) { if (nodeInfo.isAlphaSet()) { view.setAlpha(nodeInfo.getAlpha()); } } }
public BaseViewHolder setAlpha(int viewId, float value) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { getView(viewId).setAlpha(value); } else { AlphaAnimation alpha = new AlphaAnimation(value, value); alpha.setDuration(0); alpha.setFillAfter(true); getView(viewId).startAnimation(alpha); } return this; }
@Test public void shouldGetAndSetAlpha() throws Exception { view = new TestView(buildActivity(Activity.class).create().get()); view.setAlpha(9.1f); assertThat(view.getAlpha()).isEqualTo(9.1f); }