Example usage for android.view View LAYER_TYPE_SOFTWARE

List of usage examples for android.view View LAYER_TYPE_SOFTWARE

Introduction

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

Prototype

int LAYER_TYPE_SOFTWARE

To view the source code for android.view View LAYER_TYPE_SOFTWARE.

Click Source Link

Document

Indicates that the view has a software layer.

Usage

From source file:adapters.PagerContainer.java

private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);//from w  w w .  j  a v  a 2 s .c o  m

    //Child clipping doesn't work with hardware acceleration in Android 3.x/4.x
    //You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

From source file:com.techfiesta.stickyviewpager.view.PagerContainer.java

@SuppressLint("NewApi")
private void init() {
    // Disable clipping of children so non-selected pages are visible
    setClipChildren(false);/*  ww w .j  av  a  2  s .c  om*/

    // Child clipping doesn't work with hardware acceleration in Android
    // 3.x/4.x
    // You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

From source file:com.cdv.GalleryPager.PagerContainer.java

private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);/*from   w w  w . ja  v  a  2 s.c om*/

    //Child clipping doesn't work with hardware acceleration in Android 3.x/4.x
    //You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}

From source file:com.appsynth.pagercontainer.PagerContainer.java

@SuppressLint("NewApi")
private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);/*  ww w  .ja v a  2s  . c  o  m*/

    //Child clipping doesn't work with hardware acceleration in Android 3.x/4.x
    //You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    if (Build.VERSION.SDK_INT >= 11) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}

From source file:com.blueprint.widget.CircleImageView.java

CircleImageView(Context context, int color) {
    super(context);
    final float density = getContext().getResources().getDisplayMetrics().density;
    final int shadowYOffset = (int) (density * Y_OFFSET);
    final int shadowXOffset = (int) (density * X_OFFSET);

    mShadowRadius = (int) (density * SHADOW_RADIUS);

    ShapeDrawable circle;/*  w ww  .  j  a va 2 s .c o m*/
    if (elevationSupported()) {
        circle = new ShapeDrawable(new OvalShape());
        ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
    } else {
        OvalShape oval = new OvalShadow(mShadowRadius);
        circle = new ShapeDrawable(oval);
        setLayerType(View.LAYER_TYPE_SOFTWARE, circle.getPaint());
        circle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR);
        final int padding = mShadowRadius;
        // set padding so the inner image sits correctly within the shadow.
        setPadding(padding, padding, padding, padding);
    }
    circle.getPaint().setColor(color);
    ViewCompat.setBackground(this, circle);
}

From source file:com.makinacorpus.meteofrance.ui.PagerContainer.java

private void init() {
    // Disable clipping of children so non-selected pages are visible
    setClipChildren(false);//  www.j a  va2 s. c  o  m

    // Child clipping doesn't work with hardware acceleration in Android
    // 3.x/4.x
    // You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

}

From source file:com.cocosw.accessory.views.layout.PagerContainer.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void init() {
    // Disable clipping of children so non-selected pages are visible
    setClipChildren(false);//from   www  .j  a va 2  s  .  c  om

    // Child clipping doesn't work with hardware acceleration in Android
    // 3.x/4.x
    // You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    if (isHoneycombOrHigher()) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}

From source file:com.ruesga.rview.widget.MergedStatusChart.java

public MergedStatusChart(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    final Resources res = getResources();
    mHeightBarPadding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, res.getDisplayMetrics());
    mMinBarWidth = 0f;/*from   w w w .j  ava2  s  .  c o m*/
    int openColor = Color.DKGRAY;
    int mergedColor = Color.DKGRAY;
    int abandonedColor = Color.DKGRAY;
    int textColor = Color.WHITE;

    Resources.Theme theme = context.getTheme();
    TypedArray a = theme.obtainStyledAttributes(attrs, R.styleable.MergedStatusChart, defStyleAttr, 0);
    int n = a.getIndexCount();
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
        case R.styleable.MergedStatusChart_heightBarPadding:
            mHeightBarPadding = a.getDimension(attr, mHeightBarPadding);
            break;

        case R.styleable.MergedStatusChart_minBarWidth:
            mMinBarWidth = a.getDimension(attr, mMinBarWidth);
            break;

        case R.styleable.MergedStatusChart_openColor:
            openColor = a.getColor(attr, openColor);
            break;

        case R.styleable.MergedStatusChart_mergedColor:
            mergedColor = a.getColor(attr, mergedColor);
            break;

        case R.styleable.MergedStatusChart_abandonedColor:
            abandonedColor = a.getColor(attr, abandonedColor);
            break;

        case R.styleable.MergedStatusChart_statusLabelTextColor:
            textColor = a.getColor(attr, textColor);
            break;
        }
    }
    a.recycle();

    mOpenPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mOpenPaint.setStyle(Paint.Style.FILL);
    mMergedPaint = new Paint(mOpenPaint);
    mAbandonedPaint = new Paint(mOpenPaint);
    mOpenPaint.setColor(openColor);
    mMergedPaint.setColor(mergedColor);
    mAbandonedPaint.setColor(abandonedColor);

    mLabelPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mLabelPaint.setTextAlign(Paint.Align.LEFT);
    mLabelPaint.setFakeBoldText(true);
    mLabelPaint.setColor(textColor);
    mLabelPaint
            .setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10f, res.getDisplayMetrics()));
    mLabelPadding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 2f, res.getDisplayMetrics());
    Rect bounds = new Rect();
    mLabelPaint.getTextBounds("0", 0, 1, bounds);
    mLabelHeight = bounds.height();

    if (getBackground() == null) {
        setBackgroundColor(Color.TRANSPARENT);
    }
}

From source file:com.wetongji_android.ui.widgets.PagerContainer.java

@SuppressLint("NewApi")
private void init() {
    // Disable clipping of children so non-selected pages are visible
    setClipChildren(false);/*from   w w w.  j a  va 2s. c o  m*/

    // Child clipping doesn't work with hardware acceleration in Android
    // 3.x/4.x
    // You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    if (VERSION.SDK_INT > 10) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}

From source file:com.barchart.tester.pager.PagerContainer.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupHoneyCombAnUp() {
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}