List of usage examples for android.view View getHeight
@ViewDebug.ExportedProperty(category = "layout") public final int getHeight()
From source file:com.dante.girl.lib.MorphFabToDialog.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override// w ww . j a v a2 s .c om public void captureEndValues(TransitionValues transitionValues) { super.captureEndValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return; } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), android.R.color.white)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius); }
From source file:com.amitupadhyay.aboutexample.ui.transitions.MorphDialogToFab.java
@Override public void captureEndValues(TransitionValues transitionValues) { super.captureEndValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return;/*from ww w. j a v a 2 s. c o m*/ } transitionValues.values.put(PROPERTY_COLOR, endColor); transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius >= 0 ? endCornerRadius : view.getHeight() / 2); }
From source file:com.amitupadhyay.aboutexample.ui.transitions.MorphDialogToFab.java
@Override public void captureStartValues(TransitionValues transitionValues) { super.captureStartValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return;/*from w w w . j a v a 2 s. c o m*/ } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.background_light)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources().getDimensionPixelSize(R.dimen.dialog_corners)); }
From source file:com.caij.codehub.ui.transitions.MorphFabToDialog.java
@Override public void captureStartValues(TransitionValues transitionValues) { super.captureStartValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return;// w w w. j a v a 2 s .c o m } transitionValues.values.put(PROPERTY_COLOR, startColor); transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getHeight() / 2); }
From source file:com.caij.codehub.ui.transitions.MorphFabToDialog.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override// w w w . ja v a 2 s .c o m public void captureEndValues(TransitionValues transitionValues) { super.captureEndValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return; } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.background_light)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius); }
From source file:ca.farrelltonsolar.classic.MonthPager.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View theView = inflater.inflate(R.layout.day_logs_chart_pager, container, false); VerticalViewPager verticalViewPager = (VerticalViewPager) theView.findViewById(R.id.verticalviewpager); verticalViewPager.setAdapter(getAdapter()); verticalViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.pagemargin)); verticalViewPager//from w w w . j a v a2 s. c o m .setPageMarginDrawable(new ColorDrawable(getResources().getColor(android.R.color.holo_green_dark))); verticalViewPager.setPageTransformer(true, new ViewPager.PageTransformer() { @Override public void transformPage(View view, float position) { int pageWidth = view.getWidth(); int pageHeight = view.getHeight(); if (position < -1) { // [-Infinity,-1) // This page is way off-screen to the left. view.setAlpha(0); } else if (position <= 1) { // [-1,1] // Modify the default slide transition to shrink the page as well float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position)); float vertMargin = pageHeight * (1 - scaleFactor) / 2; float horzMargin = pageWidth * (1 - scaleFactor) / 2; if (position < 0) { view.setTranslationY(vertMargin - horzMargin / 2); } else { view.setTranslationY(-vertMargin + horzMargin / 2); } // Scale the page down (between MIN_SCALE and 1) view.setScaleX(scaleFactor); view.setScaleY(scaleFactor); // Fade the page relative to its size. view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA)); } else { // (1,+Infinity] // This page is way off-screen to the right. view.setAlpha(0); } } }); return theView; }
From source file:cn.edu.zucc.list.FabAnimation.MorphDialogToFab.java
@Override public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {//w w w . j ava2 s. co m Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues); if (startValues == null || endValues == null || changeBounds == null) { return null; } Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR); Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS); Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR); Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS); if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) { return null; } MorphDrawable background = new MorphDrawable(startColor, startCornerRadius); endValues.view.setBackground(background); Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor); Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius); // hide child views (offset down & fade out) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L) .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)) .start(); } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setInterpolator( AnimationUtils.loadInterpolator(sceneRoot.getContext(), android.R.interpolator.fast_out_slow_in)); transition.setDuration(300); return transition; }
From source file:android.support.design.testutils.TestUtilsMatchers.java
/** * Returns a matcher that matches FloatingActionButtons with the specified background * fill color./*from ww w. j a v a 2 s . com*/ */ public static Matcher withFabBackgroundFill(final @ColorInt int fillColor) { return new BoundedMatcher<View, View>(View.class) { private String failedCheckDescription; @Override public void describeTo(final Description description) { description.appendText(failedCheckDescription); } @Override public boolean matchesSafely(final View view) { if (!(view instanceof FloatingActionButton)) { return false; } final FloatingActionButton fab = (FloatingActionButton) view; // Since the FAB background is round, and may contain the shadow, we'll look at // just the center half rect of the content area final Rect area = new Rect(); fab.getContentRect(area); final int rectHeightQuarter = area.height() / 4; final int rectWidthQuarter = area.width() / 4; area.left += rectWidthQuarter; area.top += rectHeightQuarter; area.right -= rectWidthQuarter; area.bottom -= rectHeightQuarter; try { TestUtils.assertAllPixelsOfColor("", fab.getBackground(), view.getWidth(), view.getHeight(), false, fillColor, area, 0, true); } catch (Throwable t) { failedCheckDescription = t.getMessage(); return false; } return true; } }; }
From source file:com.caij.codehub.ui.transitions.MorphDialogToFab.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override/*from w w w.j ava 2s.com*/ public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) { Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues); if (startValues == null || endValues == null || changeBounds == null) { return null; } Integer startColor = (Integer) startValues.values.get(PROPERTY_COLOR); Integer startCornerRadius = (Integer) startValues.values.get(PROPERTY_CORNER_RADIUS); Integer endColor = (Integer) endValues.values.get(PROPERTY_COLOR); Integer endCornerRadius = (Integer) endValues.values.get(PROPERTY_CORNER_RADIUS); if (startColor == null || startCornerRadius == null || endColor == null || endCornerRadius == null) { return null; } MorphDrawable background = new MorphDrawable(startColor, startCornerRadius); endValues.view.setBackground(background); Animator color = ObjectAnimator.ofArgb(background, background.COLOR, endColor); Animator corners = ObjectAnimator.ofFloat(background, background.CORNER_RADIUS, endCornerRadius); // hide child views (offset down & fade out) if (endValues.view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) endValues.view; for (int i = 0; i < vg.getChildCount(); i++) { View v = vg.getChildAt(i); v.animate().alpha(0f).translationY(v.getHeight() / 3).setStartDelay(0L).setDuration(50L) .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(), android.R.interpolator.fast_out_linear_in)) .start(); } } AnimatorSet transition = new AnimatorSet(); transition.playTogether(changeBounds, corners, color); transition.setDuration(300); transition.setInterpolator(AnimUtils.getMaterialInterpolator(sceneRoot.getContext())); return transition; }
From source file:ca.barrenechea.widget.recyclerview.decoration.StickyHeaderDecoration.java
private int getHeaderHeightForLayout(View header) { return mRenderInline ? 0 : header.getHeight(); }