Example usage for android.view View getHeight

List of usage examples for android.view View getHeight

Introduction

In this page you can find the example usage for android.view View getHeight.

Prototype

@ViewDebug.ExportedProperty(category = "layout")
public final int getHeight() 

Source Link

Document

Return the height of your view.

Usage

From source file:android.support.v7.widget.BaseWrapContentWithAspectRatioTest.java

int getSize(View view, int orientation) {
    if (orientation == VERTICAL) {
        return view.getHeight();
    }/* w  w w . j a v a2s. c om*/
    return view.getWidth();
}

From source file:ca.barrenechea.widget.recyclerview.decoration.DoubleHeaderDecoration.java

private int getSubHeaderHeightForLayout(View header) {
    return mRenderInline ? 0 : header.getHeight();
}

From source file:cn.androidy.materialdesignsample.immersivemode.ImmersiveModeFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final View decorView = getActivity().getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override/*w  w  w  .  j  ava 2s. c  o  m*/
        public void onSystemUiVisibilityChange(int i) {
            int height = decorView.getHeight();
            Log.i(TAG, "Current height: " + height);
        }
    });
}

From source file:ameircom.keymedia.Activity.transition.FabTransform.java

private void captureValues(TransitionValues transitionValues) {
    final View view = transitionValues.view;
    if (view == null || view.getWidth() <= 0 || view.getHeight() <= 0)
        return;/*ww w . ja  va 2 s .  c  o m*/

    transitionValues.values.put(PROP_BOUNDS,
            new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()));
}

From source file:android.improving.utils.views.cardsview.StackPageTransformer.java

@Override
public void transformPage(View view, float position) {

    int dimen = 0;
    switch (mOrientation) {
    case VERTICAL:
        dimen = view.getHeight();
        break;//from w w w .j a va2 s . co  m
    case HORIZONTAL:
        dimen = view.getWidth();
        break;
    }

    if (!mInitialValuesCalculated) {
        mInitialValuesCalculated = true;
        calculateInitialValues(dimen);
    }

    switch (mOrientation) {
    case VERTICAL:
        view.setRotationX(0);
        view.setPivotY(dimen / 2f);
        view.setPivotX(view.getWidth() / 2f);
        break;
    case HORIZONTAL:
        view.setRotationY(0);
        view.setPivotX(dimen / 2f);
        view.setPivotY(view.getHeight() / 2f);
        break;
    }

    if (position < -mNumberOfStacked - 1) {
        view.setAlpha(0f);
    } else if (position <= 0) {
        float scale = mZeroPositionScale + (position * mStackedScaleFactor);
        float baseTranslation = (-position * dimen);
        float shiftTranslation = calculateShiftForScale(position, scale, dimen);
        view.setScaleX(scale);
        view.setScaleY(scale);
        view.setAlpha(1.0f + (position * mAlphaFactor));
        switch (mOrientation) {
        case VERTICAL:
            view.setTranslationY(baseTranslation + shiftTranslation);
            break;
        case HORIZONTAL:
            view.setTranslationX(baseTranslation + shiftTranslation);
            break;
        }
    } else if (position <= 1) {
        float scale = mZeroPositionScale + (position * mStackedScaleFactor);
        view.setScaleX(scale);
        view.setScaleY(scale);
        view.setAlpha(1.0f + (position * mAlphaFactor));
        view.setTranslationY(position);
    } else if (position > 1) {
        view.setAlpha(0f);
    }
}

From source file:com.android.wneng.widget.vertcalViewPager.transforms.DefaultTransformer.java

@Override
public void transformPage(View view, float position) {
    float alpha = 0;
    if (0 <= position && position <= 1) {
        alpha = 1 - position;//from w w w  .  ja v a2s .c  om
    } else if (-1 < position && position < 0) {
        alpha = position + 1;
    }
    view.setAlpha(alpha);
    view.setTranslationX(view.getWidth() * -position);
    float yPosition = position * view.getHeight();
    view.setTranslationY(yPosition);
}

From source file:com.example.client.fragment.imported.ViewPagerTabFragmentParentFragment.java

private void adjustToolbar(ScrollState scrollState) {
    View toolbarView = getActivity().findViewById(R.id.toolbar);
    int toolbarHeight = toolbarView.getHeight();
    final Scrollable scrollable = getCurrentScrollable();
    if (scrollable == null) {
        return;//from   w ww  .  ja v  a 2 s.  c  om
    }
    int scrollY = scrollable.getCurrentScrollY();
    if (scrollState == ScrollState.DOWN) {
        showToolbar();
    } else if (scrollState == ScrollState.UP) {
        if (toolbarHeight <= scrollY) {
            hideToolbar();
        } else {
            showToolbar();
        }
    } else if (!toolbarIsShown() && !toolbarIsHidden()) {
        // Toolbar is moving but doesn't know which to move:
        // you can change this to hideToolbar()
        showToolbar();
    }
}

From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java

static void setBackground(View v, Bitmap bm) {

    if (bm == null) {
        v.setBackgroundResource(0);/* w  w w  .ja  va2  s.  c  o  m*/
        return;
    }

    int vwidth = v.getWidth();
    int vheight = v.getHeight();
    int bwidth = bm.getWidth();
    int bheight = bm.getHeight();
    float scalex = (float) vwidth / bwidth;
    float scaley = (float) vheight / bheight;
    float scale = Math.max(scalex, scaley) * 1.3f;

    Bitmap.Config config = Bitmap.Config.ARGB_8888;
    Bitmap bg = Bitmap.createBitmap(vwidth, vheight, config);
    Canvas c = new Canvas(bg);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setFilterBitmap(true);
    ColorMatrix greymatrix = new ColorMatrix();
    greymatrix.setSaturation(0);
    ColorMatrix darkmatrix = new ColorMatrix();
    darkmatrix.setScale(.3f, .3f, .3f, 1.0f);
    greymatrix.postConcat(darkmatrix);
    ColorFilter filter = new ColorMatrixColorFilter(greymatrix);
    paint.setColorFilter(filter);
    Matrix matrix = new Matrix();
    matrix.setTranslate(-bwidth / 2, -bheight / 2); // move bitmap center to origin
    matrix.postRotate(10);
    matrix.postScale(scale, scale);
    matrix.postTranslate(vwidth / 2, vheight / 2); // Move bitmap center to view center
    c.drawBitmap(bm, matrix, paint);
    v.setBackgroundDrawable(new BitmapDrawable(bg));
}

From source file:cf.obsessiveorange.rhcareerfairlayout.ui.fragments.VPParentFragment.java

/**
 * Hide the toolbar/*from   w ww  .j a v  a2s .c  om*/
 * @param completionHandlers any handlers to be fired after completion of the animation
 */
public void hideToolbar(Runnable... completionHandlers) {
    View toolbarView = getActivity().findViewById(R.id.toolbar);
    animateToolbar(-toolbarView.getHeight(), completionHandlers);
}

From source file:android.support.transition.ChangeClipBounds.java

private void captureValues(TransitionValues values) {
    View view = values.view;
    if (view.getVisibility() == View.GONE) {
        return;//from www. ja va  2  s .  c  o m
    }

    Rect clip = ViewCompat.getClipBounds(view);
    values.values.put(PROPNAME_CLIP, clip);
    if (clip == null) {
        Rect bounds = new Rect(0, 0, view.getWidth(), view.getHeight());
        values.values.put(PROPNAME_BOUNDS, bounds);
    }
}