Java Code Examples for android.widget.FrameLayout#getHeight()

The following examples show how to use android.widget.FrameLayout#getHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreviewMorphAnimator.java    From PreviewSeekBar with Apache License 2.0 5 votes vote down vote up
/**
 * Starts the circular reveal of the preview with an overlay above that fades out
 */
private void startCircularReveal(final FrameLayout previewView,
                                 final View overlayView,
                                 final View morphView) {
    isMorphingToShow = true;

    float startRadius = previewView.getHeight() / 2f;
    float endRadius = getRadius(previewView);
    long duration = morphShowDuration;

    morphAnimator = ViewAnimationUtils.createCircularReveal(previewView,
            getCenterX(previewView),
            getCenterY(previewView),
            startRadius,
            endRadius);
    morphAnimator.setTarget(previewView);
    morphAnimator.setInterpolator(new AccelerateInterpolator());
    morphAnimator.setDuration(duration);
    morphAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            isMorphingToShow = false;
            isShowing = false;
            overlayView.setAlpha(0.0f);
            overlayView.setVisibility(View.INVISIBLE);
        }
    });
    morphAnimator.start();
    previewView.setVisibility(View.VISIBLE);
    overlayView.setVisibility(View.VISIBLE);
    morphView.setVisibility(View.INVISIBLE);
    overlayView.animate()
            .alpha(0f)
            .setDuration(morphShowDuration / 2);

}
 
Example 2
Source File: PreviewMorphAnimator.java    From PreviewSeekBar with Apache License 2.0 5 votes vote down vote up
private void startReverseCircularReveal(final FrameLayout previewView,
                                        final PreviewBar previewBar,
                                        final View overlayView,
                                        final View morphView) {
    isMorphingToHide = true;

    float startRadius = getRadius(previewView);
    float endRadius = previewView.getHeight() / 2f;
    long duration = morphHideDuration;

    morphAnimator = ViewAnimationUtils.createCircularReveal(previewView,
            getCenterX(previewView),
            getCenterY(previewView),
            startRadius,
            endRadius);
    morphAnimator.setDuration(duration);
    morphAnimator.setInterpolator(new AccelerateInterpolator());
    morphAnimator.setTarget(previewView);
    morphAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            isMorphingToHide = false;
            startHideTranslation(previewView, previewBar, overlayView, morphView);
        }
    });
    overlayView.setVisibility(View.VISIBLE);
    overlayView.animate().alpha(1f).setDuration(morphHideDuration / 2)
            .setInterpolator(new AccelerateInterpolator()).start();
    morphAnimator.start();
}
 
Example 3
Source File: AttachFragment.java    From actor-platform with GNU Affero General Public License v3.0 5 votes vote down vote up
@Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup fcontainer, @Nullable Bundle savedInstanceState) {

        if (savedInstanceState == null) {
            getChildFragmentManager().beginTransaction()
                    .add(new MediaPickerFragment(), "picker")
                    .commitNow();
        }

        root = new FrameLayout(getContext()) {
            @Override
            protected void onSizeChanged(int w, int h, int oldw, int oldh) {
                super.onSizeChanged(w, h, oldw, oldh);
                if (h != oldh && shareButtons != null) {
                    shareButtons.getLayoutParams().height = root.getHeight() - Screen.dp(135);
                    shareButtons.requestLayout();
                }
            }
        };
        root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        root.setBackgroundColor(getActivity().getResources().getColor(R.color.dialog_overlay));
        root.setVisibility(View.INVISIBLE);

        isLoaded = false;
//        messenger().getGalleryScannerActor().send(new GalleryScannerActor.Show());
//        messenger().getGalleryScannerActor().send(new GalleryScannerActor.Hide());

        return root;
    }
 
Example 4
Source File: CurtainViewController.java    From KJFrameForAndroid with Apache License 2.0 5 votes vote down vote up
public static final CurtainViewController.SlidingStatus getSlidingStatus(
        CurtainViewController mCurtainViewController) {

    FrameLayout slidingParent = mCurtainViewController.getSlidingParent();
    FrameLayout.LayoutParams slidingLayoutParams = (FrameLayout.LayoutParams) slidingParent
            .getLayoutParams();

    if (mCurtainViewController.getSlidingItem().getSlidingType() == SlidingType.SIZE) {

        int currentSlidingHeight = slidingParent.getHeight();

        if (currentSlidingHeight == 0) {
            return CurtainViewController.SlidingStatus.COLLAPSED;

        } else if (currentSlidingHeight >= mCurtainViewController
                .getSlidingHeight()) {
            return CurtainViewController.SlidingStatus.EXPANDED;

        } else {
            return CurtainViewController.SlidingStatus.ANIMATING;
        }

    } else if (mCurtainViewController.getSlidingItem().getSlidingType() == SlidingType.MOVE) {

        int currentSlidingTop = slidingLayoutParams.topMargin;

        if (currentSlidingTop <= -mCurtainViewController.getSlidingHeight()) {
            return CurtainViewController.SlidingStatus.COLLAPSED;

        } else if (currentSlidingTop >= 0) {
            return CurtainViewController.SlidingStatus.EXPANDED;

        } else {
            return CurtainViewController.SlidingStatus.ANIMATING;
        }

    } else {
        return CurtainViewController.SlidingStatus.ANIMATING;
    }
}
 
Example 5
Source File: PreviewMorphAnimator.java    From PreviewSeekBar with Apache License 2.0 4 votes vote down vote up
private float getMorphScale(FrameLayout previewView, View morphView) {
    return (float) (previewView.getHeight() / morphView.getLayoutParams().height);
}
 
Example 6
Source File: PreviewMorphAnimator.java    From PreviewSeekBar with Apache License 2.0 4 votes vote down vote up
/**
 * The destination Y of the view that'll morph into the preview
 */
private float getMorphEndY(FrameLayout previewView, View morphView) {
    return (int) (previewView.getY()
            + previewView.getHeight() / 2f)
            - morphView.getHeight() / 2f;
}