Java Code Examples for android.support.v4.view.ViewCompat#LAYER_TYPE_HARDWARE

The following examples show how to use android.support.v4.view.ViewCompat#LAYER_TYPE_HARDWARE . 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: SlidingPaneLayout.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
Example 2
Source File: SlidingPaneLayout.java    From android-recipes-app with Apache License 2.0 6 votes vote down vote up
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
Example 3
Source File: SlidingUpPaneLayout.java    From SlidingUpPaneLayout with Apache License 2.0 6 votes vote down vote up
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
Example 4
Source File: SlidingPaneLayout.java    From guideshow with MIT License 6 votes vote down vote up
private void dimChildView(View v, float mag, int fadeColor) {
    final LayoutParams lp = (LayoutParams) v.getLayoutParams();

    if (mag > 0 && fadeColor != 0) {
        final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
        int imag = (int) (baseAlpha * mag);
        int color = imag << 24 | (fadeColor & 0xffffff);
        if (lp.dimPaint == null) {
            lp.dimPaint = new Paint();
        }
        lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
        if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
            ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
        }
        invalidateChildRegion(v);
    } else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
        if (lp.dimPaint != null) {
            lp.dimPaint.setColorFilter(null);
        }
        final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
        mPostedRunnables.add(dlr);
        ViewCompat.postOnAnimation(this, dlr);
    }
}
 
Example 5
Source File: VerticalViewPager.java    From TLint with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ? ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 6
Source File: ViewPagerCompat.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 7
Source File: ViewPagerEx.java    From AndroidImageSlider with MIT License 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 8
Source File: FuckViewPager.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 9
Source File: DirectionalViewpager.java    From BookReader with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 10
Source File: ViewPager.java    From android-movies-demo with MIT License 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 11
Source File: ViewPagerEx.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 12
Source File: VerticalViewPager.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
  final int childCount = getChildCount();
  for (int i = 0; i < childCount; i++) {
    final int layerType = enable ? ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
    ViewCompat.setLayerType(getChildAt(i), layerType, null);
  }
}
 
Example 13
Source File: VerViewPager.java    From likeJDGoodsDetails with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
	final int childCount = getChildCount();
	for (int i = 0; i < childCount; i++) {
		final int layerType = enable ?
				ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
		ViewCompat.setLayerType(getChildAt(i), layerType, null);
	}
}
 
Example 14
Source File: ViewPager.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 15
Source File: ViewPager.java    From ankihelper with GNU General Public License v3.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 16
Source File: ViewPager.java    From AppCompat-Extension-Library with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 17
Source File: VerticalViewPager.java    From VerticalViewPager with MIT License 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 18
Source File: VerticalViewPager.java    From DoubleViewPager with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 19
Source File: ViewPagerCompat.java    From android-auto-scroll-viewpager with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}
 
Example 20
Source File: DirectionalViewpager.java    From fangzhuishushenqi with Apache License 2.0 5 votes vote down vote up
private void enableLayers(boolean enable) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final int layerType = enable ?
                ViewCompat.LAYER_TYPE_HARDWARE : ViewCompat.LAYER_TYPE_NONE;
        ViewCompat.setLayerType(getChildAt(i), layerType, null);
    }
}