android.support.v4.view.ViewCompat#isLaidOut ( )源码实例Demo

下面列出了android.support.v4.view.ViewCompat#isLaidOut ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: connectivity-samples   文件: MainActivity.java
/** Transitions from the old state to the new state with an animation implying moving forward. */
@UiThread
private void transitionForward(State oldState, final State newState) {
  mPreviousStateView.setVisibility(View.VISIBLE);
  mCurrentStateView.setVisibility(View.VISIBLE);

  updateTextView(mPreviousStateView, oldState);
  updateTextView(mCurrentStateView, newState);

  if (ViewCompat.isLaidOut(mCurrentStateView)) {
    mCurrentAnimator = createAnimator(false /* reverse */);
    mCurrentAnimator.addListener(
        new AnimatorListener() {
          @Override
          public void onAnimationEnd(Animator animator) {
            updateTextView(mCurrentStateView, newState);
          }
        });
    mCurrentAnimator.start();
  }
}
 
源代码2 项目: connectivity-samples   文件: MainActivity.java
/** Transitions from the old state to the new state with an animation implying moving backward. */
@UiThread
private void transitionBackward(State oldState, final State newState) {
  mPreviousStateView.setVisibility(View.VISIBLE);
  mCurrentStateView.setVisibility(View.VISIBLE);

  updateTextView(mCurrentStateView, oldState);
  updateTextView(mPreviousStateView, newState);

  if (ViewCompat.isLaidOut(mCurrentStateView)) {
    mCurrentAnimator = createAnimator(true /* reverse */);
    mCurrentAnimator.addListener(
        new AnimatorListener() {
          @Override
          public void onAnimationEnd(Animator animator) {
            updateTextView(mCurrentStateView, newState);
          }
        });
    mCurrentAnimator.start();
  }
}
 
源代码3 项目: connectivity-samples   文件: MainActivity.java
/** Transitions from the old state to the new state with an animation implying moving forward. */
@UiThread
private void transitionForward(State oldState, final State newState) {
  mPreviousStateView.setVisibility(View.VISIBLE);
  mCurrentStateView.setVisibility(View.VISIBLE);

  updateTextView(mPreviousStateView, oldState);
  updateTextView(mCurrentStateView, newState);

  if (ViewCompat.isLaidOut(mCurrentStateView)) {
    mCurrentAnimator = createAnimator(false /* reverse */);
    mCurrentAnimator.addListener(
        new AnimatorListener() {
          @Override
          public void onAnimationEnd(Animator animator) {
            updateTextView(mCurrentStateView, newState);
          }
        });
    mCurrentAnimator.start();
  }
}
 
源代码4 项目: connectivity-samples   文件: MainActivity.java
/** Transitions from the old state to the new state with an animation implying moving backward. */
@UiThread
private void transitionBackward(State oldState, final State newState) {
  mPreviousStateView.setVisibility(View.VISIBLE);
  mCurrentStateView.setVisibility(View.VISIBLE);

  updateTextView(mCurrentStateView, oldState);
  updateTextView(mPreviousStateView, newState);

  if (ViewCompat.isLaidOut(mCurrentStateView)) {
    mCurrentAnimator = createAnimator(true /* reverse */);
    mCurrentAnimator.addListener(
        new AnimatorListener() {
          @Override
          public void onAnimationEnd(Animator animator) {
            updateTextView(mCurrentStateView, newState);
          }
        });
    mCurrentAnimator.start();
  }
}
 
源代码5 项目: Nimingban   文件: Snackbar.java
final void showView() {
    if (mView.getParent() == null) {
        mParent.addView(mView);
    }
    if (ViewCompat.isLaidOut(mView)) {
        animateViewIn();
    } else {
        mView.setOnLayoutChangeListener(new Snackbar.SnackbarLayout.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View view, int left, int top, int right, int bottom) {
                animateViewIn();
                mView.setOnLayoutChangeListener(null);
            }
        });
    }
}
 
源代码6 项目: BubbleActions   文件: BubbleActions.java
/**
 * Show the bubble actions. Internally this will do 3 things:
 * 1. Add the overlay to the root view
 * 2. Use reflection to get the last touched xy location
 * 3. Animate the overlay in
 */
public void show() {
    if (showing) {
        return;
    }

    if (overlay.getParent() == null) {
        root.addView(overlay);
    }

    if (ViewCompat.isLaidOut(overlay)) {
        showOverlay();
    } else {
        overlay.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                overlay.removeOnLayoutChangeListener(this);
                showOverlay();
            }
        });
    }
}
 
源代码7 项目: AppCompat-Extension-Library   文件: LabelView.java
/**
 * Hides the label using a translation animation
 */
public void hide() {
    if (mIsHiding || getVisibility() != VISIBLE) {
        // Already hiding or hidden, skip the call
        return;
    }
    if (!ViewCompat.isLaidOut(this)) {
        // View isn't laid out yet
        setVisibility(GONE);
    }
    // Use platform dependent animations
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        hideIceCreamSandwich();
    } else {
        hideEclairMr1();
    }
}
 
源代码8 项目: AppCompat-Extension-Library   文件: LabelView.java
/**
 * Shows the label using a translation animation
 */
public void show() {
    if (!mIsHiding && getVisibility() == VISIBLE) {
        // Already showing or shown, skip the call
        return;
    }
    if (!ViewCompat.isLaidOut(this)) {
        // View isn't laid out yet
        return;
    }
    // Use platform dependent animations
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        showIceCreamSandwich();
    } else {
        showEclairMr1();
    }
}
 
源代码9 项目: FABsMenu   文件: TitleFAB.java
private boolean shouldAnimateVisibilityChange() {
    View label = getLabelView();
    if (label != null) {
        return ViewCompat.isLaidOut(this) && ViewCompat.isLaidOut(label) && !isInEditMode();
    } else {
        return ViewCompat.isLaidOut(this) && !isInEditMode();
    }
}
 
源代码10 项目: mvvm-template   文件: AnimHelper.java
@UiThread public static void mimicFabVisibility(boolean show, @NonNull View view,
                                                @Nullable FloatingActionButton.OnVisibilityChangedListener listener) {
    if (show) {
        view.animate().cancel();
        if (ViewCompat.isLaidOut(view)) {
            if (view.getVisibility() != View.VISIBLE) {
                view.setAlpha(0f);
                view.setScaleY(0f);
                view.setScaleX(0f);
            }
            view.animate()
                    .scaleX(1f)
                    .scaleY(1f)
                    .alpha(1f)
                    .setDuration(200)
                    .setInterpolator(LINEAR_OUT_SLOW_IN_INTERPOLATOR)
                    .withStartAction(() -> {
                        view.setVisibility(View.VISIBLE);
                        if (listener != null) listener.onShown(null);
                    });
        } else {
            view.setVisibility(View.VISIBLE);
            view.setAlpha(1f);
            view.setScaleY(1f);
            view.setScaleX(1f);
            if (listener != null) listener.onShown(null);
        }
    } else {
        view.animate()
                .scaleX(0f)
                .scaleY(0f)
                .alpha(0f)
                .setDuration(40)
                .setInterpolator(FAST_OUT_LINEAR_IN_INTERPOLATOR);
        view.setVisibility(View.GONE);
        if (listener != null) listener.onHidden(null);
    }
}
 
源代码11 项目: px-android   文件: ViewUtils.java
public static void runWhenViewIsFullyMeasured(@NonNull final View view, @NonNull final Runnable runnable) {
    if (ViewCompat.isLaidOut(view)) {
        runnable.run();
    } else {
        view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(final View v, final int left, final int top, final int right,
                final int bottom, final int oldLeft, final int oldTop, final int oldRight, final int oldBottom) {
                view.removeOnLayoutChangeListener(this);
                runnable.run();
            }
        });
    }
}
 
源代码12 项目: ticdesign   文件: FloatingActionButton.java
/**
 * Return in {@code rect} the bounds of the actual floating action button content in view-local
 * coordinates. This is defined as anything within any visible shadow.
 *
 * @return true if this view actually has been laid out and has a content rect, else false.
 */
public boolean getContentRect(@NonNull Rect rect) {
    if (ViewCompat.isLaidOut(this)) {
        rect.set(0, 0, getWidth(), getHeight());
        rect.left += mProgressPadding.left;
        rect.top += mProgressPadding.top;
        rect.right -= mProgressPadding.right;
        rect.bottom -= mProgressPadding.bottom;
        return true;
    } else {
        return false;
    }
}
 
源代码13 项目: styT   文件: ViewUtil.java
/**
 * Returns whether or not the view has been laid out
 **/
private static boolean isLaidOut(View view) {
    return ViewCompat.isLaidOut(view) && view.getWidth() > 0 && view.getHeight() > 0;
}
 
 同类方法