示例#1
0
 @Override
 public CheckBoxBean dehydrate(final CheckBox checkBox) {
   CheckBoxBean bean =
       new CheckBoxBean(
           checkBox.getText().toString(), checkBox.isEnabled(), checkBox.getVisibility());
   return bean;
 }
  public boolean addInPayee() {
    if (addToBeneficiariesCheckBox.getVisibility() == View.VISIBLE) {

      return addToBeneficiariesCheckBox.isChecked();
    } else {
      return false;
    }
  }
    public static void animateShowing(
        final ViewHolder holder, final ListAdapter adapter, boolean isAnimate) {
      final CheckBox checkBox = holder.checkBox;
      if (checkBox.getVisibility() == View.VISIBLE) {
        return;
      }
      checkBox.setVisibility(View.VISIBLE);
      checkBox.setAlpha(0.0f);
      final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
      final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
      checkBox.measure(widthSpec, heightSpec);
      ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) checkBox.getLayoutParams();
      final long transValue = checkBox.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;

      if (!isAnimate) {
        checkBox.setAlpha(1.0f);
        holder.contentLayout.setTranslationX(transValue);
        return;
      }

      final ObjectAnimator transBodyAnimator = new ObjectAnimator();
      final PropertyValuesHolder trans =
          PropertyValuesHolder.ofFloat("TranslationX", 0.0f, transValue);
      transBodyAnimator.setTarget(holder.contentLayout);
      transBodyAnimator.setValues(trans);
      transBodyAnimator.setDuration(DURATION);

      ObjectAnimator checkBoxAnim = new ObjectAnimator();
      final PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("ScaleX", 0.0f, 1.0f);
      final PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("ScaleY", 0.0f, 1.0f);
      final PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("Alpha", 0.0f, 1.0f);
      checkBoxAnim.setValues(scaleX, scaleY, alpha);
      checkBoxAnim.setTarget(holder.checkBox);
      checkBoxAnim.setDuration(DURATION);
      checkBoxAnim.setInterpolator(new DecelerateInterpolator());
      checkBoxAnim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
              checkBox.setTag("animating");
            }

            @Override
            public void onAnimationEnd(Animator animation) {
              // adapter.setCheckBoxAnimator(false);
              checkBox.setTag("animated");
            }
          });
      if (!(checkBox.getTag() != null && "animating".equals(checkBox.getTag()))) {
        // 若正在播放动画,则不继续播放动画
        transBodyAnimator.start();
        checkBoxAnim.start();
      }
    }
 public final void hJ(boolean paramBoolean) {
   if (paramBoolean) {}
   for (int i = 0; ; i = 8) {
     if ((edK != null) && (edK.getVisibility() != i)) {
       edK.setVisibility(i);
     }
     if ((dMC != null) && (dMC.getVisibility() != i)) {
       dMC.setVisibility(i);
     }
     return;
   }
 }
    public static void animateHiding(
        final ViewHolder holder, final ListAdapter adapter, boolean isAnimate) {
      final CheckBox checkBox = holder.checkBox;
      final View tansBody = holder.contentLayout;

      if (checkBox.getVisibility() == View.GONE) {
        return;
      }
      ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) checkBox.getLayoutParams();
      final float transValue = checkBox.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;

      if (!isAnimate) {
        checkBox.setVisibility(View.GONE);
        holder.contentLayout.setTranslationX(0.0f);
        return;
      }
      final ObjectAnimator transBodyAnimator = new ObjectAnimator();
      final PropertyValuesHolder trans =
          PropertyValuesHolder.ofFloat("TranslationX", transValue, 0.0f);
      transBodyAnimator.setTarget(tansBody);
      transBodyAnimator.setValues(trans);
      transBodyAnimator.setDuration(DURATION);

      ObjectAnimator checkBoxAnim = new ObjectAnimator();
      final PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("ScaleX", 1.0f, 0.0f);
      final PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("ScaleY", 1.0f, 0.0f);
      final PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("Alpha", 1.0f, 0.0f);
      checkBoxAnim.setValues(scaleX, scaleY, alpha);
      checkBoxAnim.setTarget(checkBox);
      checkBoxAnim.setDuration(DURATION);
      checkBoxAnim.setInterpolator(new AccelerateInterpolator());
      checkBoxAnim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
              checkBox.setTag("animating");
            }

            @Override
            public void onAnimationEnd(Animator animation) {
              // adapter.setCheckBoxAnimator(false);
              checkBox.setScaleX(1.0f);
              checkBox.setScaleY(1.0f);
              checkBox.setAlpha(1.0f);
              checkBox.setVisibility(View.GONE);
              checkBox.setTag("animated");
            }
          });
      if (!(checkBox.getTag() != null && "animating".equals(checkBox.getTag()))) {
        transBodyAnimator.start();
        checkBoxAnim.start();
      }
    }
 /* (non-Javadoc)
  * @see android.view.View#onTouchEvent(android.view.MotionEvent)
  */
 @Override
 public boolean onTouchEvent(MotionEvent event) {
   if (checkIndicator != null
       && checkIndicator.getVisibility() == View.VISIBLE
       && isPointInsideView(event, checkIndicator)) {
     checkIndicator.onTouchEvent(event);
     return true;
   } else if (contextMenuButton != null
       && contextMenuButton.getVisibility() == View.VISIBLE
       && isPointInsideView(event, contextMenuButton)) {
     contextMenuButton.onTouchEvent(event);
     return true;
   } else {
     return super.onTouchEvent(event);
   }
 }