public override void addView(android.view.View child, int index, android.view.ViewGroup .LayoutParams @params) { base.addView(child, index, @params); if (getChildCount() == 1) { child.setVisibility(android.view.View.VISIBLE); } else { child.setVisibility(android.view.View.GONE); } }
private void setupStackSlider(android.view.View v, int mode) { mStackSlider.setMode(mode); if (v != null) { mHighlight.setImageBitmap(sHolographicHelper.createResOutline(v, mResOutColor)); mHighlight.setRotation(v.getRotation()); mHighlight.setTranslationY(v.getTranslationY()); mHighlight.setTranslationX(v.getTranslationX()); mHighlight.bringToFront(); v.bringToFront(); mStackSlider.setView(v); v.setVisibility(VISIBLE); } }
/// <summary> /// Sets the drawable in an image view, makes sure the view is only visible if there /// is a drawable. /// </summary> /// <remarks> /// Sets the drawable in an image view, makes sure the view is only visible if there /// is a drawable. /// </remarks> private void setViewDrawable(android.widget.ImageView v, android.graphics.drawable.Drawable drawable, int nullVisibility) { // Set the icon even if the drawable is null, since we need to clear any // previous icon. v.setImageDrawable(drawable); if (drawable == null) { v.setVisibility(nullVisibility); } else { v.setVisibility(android.view.View.VISIBLE); // This is a hack to get any animated drawables (like a 'working' spinner) // to animate. You have to setVisible true on an AnimationDrawable to get // it to start animating, but it must first have been false or else the // call to setVisible will be ineffective. We need to clear up the story // about animated drawables in the future, see http://b/1878430. drawable.setVisible(false, false); drawable.setVisible(true, false); } }
internal override void transformViewForTransition(int fromIndex, int toIndex, android.view.View view, bool animate_1) { if (!animate_1) { ((android.widget.StackView.StackFrame)view).cancelSliderAnimator(); view.setRotationX(0f); android.widget.StackView.LayoutParams lp = (android.widget.StackView.LayoutParams )view.getLayoutParams(); lp.setVerticalOffset(0); lp.setHorizontalOffset(0); } if (fromIndex == -1 && toIndex == getNumActiveViews() - 1) { transformViewAtIndex(toIndex, view, false); view.setVisibility(VISIBLE); view.setAlpha(1.0f); } else { if (fromIndex == 0 && toIndex == 1) { ((android.widget.StackView.StackFrame)view).cancelSliderAnimator(); view.setVisibility(VISIBLE); int duration = Sharpen.Util.Round(mStackSlider.getDurationForNeutralPosition(mYVelocity )); android.widget.StackView.StackSlider animationSlider = new android.widget.StackView .StackSlider(this, mStackSlider); animationSlider.setView(view); if (animate_1) { android.animation.PropertyValuesHolder slideInY = android.animation.PropertyValuesHolder .ofFloat("YProgress", 0.0f); android.animation.PropertyValuesHolder slideInX = android.animation.PropertyValuesHolder .ofFloat("XProgress", 0.0f); android.animation.ObjectAnimator slideIn = android.animation.ObjectAnimator.ofPropertyValuesHolder (animationSlider, slideInX, slideInY); slideIn.setDuration(duration); slideIn.setInterpolator(new android.view.animation.LinearInterpolator()); ((android.widget.StackView.StackFrame)view).setSliderAnimator(slideIn); slideIn.start(); } else { animationSlider.setYProgress(0f); animationSlider.setXProgress(0f); } } else { if (fromIndex == 1 && toIndex == 0) { ((android.widget.StackView.StackFrame)view).cancelSliderAnimator(); int duration = Sharpen.Util.Round(mStackSlider.getDurationForOffscreenPosition(mYVelocity )); android.widget.StackView.StackSlider animationSlider = new android.widget.StackView .StackSlider(this, mStackSlider); animationSlider.setView(view); if (animate_1) { android.animation.PropertyValuesHolder slideOutY = android.animation.PropertyValuesHolder .ofFloat("YProgress", 1.0f); android.animation.PropertyValuesHolder slideOutX = android.animation.PropertyValuesHolder .ofFloat("XProgress", 0.0f); android.animation.ObjectAnimator slideOut = android.animation.ObjectAnimator.ofPropertyValuesHolder (animationSlider, slideOutX, slideOutY); slideOut.setDuration(duration); slideOut.setInterpolator(new android.view.animation.LinearInterpolator()); ((android.widget.StackView.StackFrame)view).setSliderAnimator(slideOut); slideOut.start(); } else { animationSlider.setYProgress(1.0f); animationSlider.setXProgress(0f); } } else { if (toIndex == 0) { view.setAlpha(0.0f); view.setVisibility(INVISIBLE); } else { if ((fromIndex == 0 || fromIndex == 1) && toIndex > 1) { view.setVisibility(VISIBLE); view.setAlpha(1.0f); view.setRotationX(0f); android.widget.StackView.LayoutParams lp = (android.widget.StackView.LayoutParams )view.getLayoutParams(); lp.setVerticalOffset(0); lp.setHorizontalOffset(0); } else { if (fromIndex == -1) { view.setAlpha(1.0f); view.setVisibility(VISIBLE); } else { if (toIndex == -1) { if (animate_1) { postDelayed(new _Runnable_294(view), STACK_RELAYOUT_DURATION); } else { view.setAlpha(0f); } } } } } } } } // Implement the faked perspective if (toIndex != -1) { transformViewAtIndex(toIndex, view, animate_1); } }
private void setViewText(android.widget.TextView v, java.lang.CharSequence text) { // Set the text even if it's null, since we need to clear any previous text. v.setText(text); if (android.text.TextUtils.isEmpty(text)) { v.setVisibility(android.view.View.GONE); } else { v.setVisibility(android.view.View.VISIBLE); } }