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:com.medhdj.pagergallery.PagerGalleryContainer.java

private void init() {
    // Disable clipping of children so non-selected pages are visible
    setClipChildren(false);//from   w  w w  . j  av a2 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.vivavu.dream.view.PagerContainer.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);/*ww  w.  ja va2  s.  co  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 && Build.VERSION.SDK_INT < 19) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}

From source file:cn.edu.zafu.easemob.CoverFlowLib.CoverFlowContainer.java

private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);//  w ww. j av  a2  s .  com

    //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 (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
}

From source file:org.zywx.wbpalmstar.plugin.uexiconlist.IconListActivity.java

@SuppressLint("NewApi")
@Override/*from  w  w w .jav a  2s .c  o m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mainView = LayoutInflater.from(this).inflate(EUExUtil.getResLayoutID("plugin_iconlist_main_layout"), null);
    if (IconListOption.isInvalidateChild()) {
        mainView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    setContentView(mainView);
    Intent intent = getIntent();
    String itemInfo = intent.getStringExtra(ITEM_INFO);
    widgetInfo = intent.getStringExtra(WIDGET_INFO);
    mContainer = (ScrollLayout) findViewById(EUExUtil.getResIdID("icon_list_scrolllayout"));
    pageIndicator = (PageIndicator) findViewById(EUExUtil.getResIdID("icon_list_page_indictor"));
    defIconUrl = IconListUtils.getDefaultIconUrl(itemInfo);
    /** ?mIconList */
    mIconList = IconListUtils.parseIconBeanList(itemInfo);
}

From source file:devlight.io.library.TintLayout.java

public TintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setWillNotDraw(false);/*from ww w  .  j av  a  2 s . co  m*/
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, null);

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TintLayout);
    try {
        setAngle(typedArray.getFloat(R.styleable.TintLayout_tl_angle, DEFAULT_ANGLE));
        setColor(typedArray.getColor(R.styleable.TintLayout_tl_color, DEFAULT_COLOR));

        // Retrieve colors
        String[] stringColors = null;
        try {
            final int colorsId = typedArray.getResourceId(R.styleable.TintLayout_tl_colors, 0);
            stringColors = colorsId == 0 ? null : getResources().getStringArray(colorsId);
        } catch (Exception exception) {
            stringColors = null;
            exception.printStackTrace();
        } finally {
            if (stringColors == null)
                setColors(null);
            else {
                final int[] colors = new int[stringColors.length];
                for (int i = 0; i < stringColors.length; i++)
                    colors[i] = Color.parseColor(stringColors[i]);
                setColors(colors);
            }
        }
    } finally {
        typedArray.recycle();
    }
}

From source file:com.kanhan.widget.PagerContainer.java

private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);//from   w  ww .  ja va2s .  co  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.miz.mizuu.fragments.ActorBiographyFragment.java

public void onViewCreated(View v, Bundle savedInstanceState) {
    super.onViewCreated(v, savedInstanceState);

    if (MizLib.isPortrait(getActivity()))
        MizLib.addActionBarPadding(getActivity(), v.findViewById(R.id.linearLayout1));
    else//  www  . j  a v  a  2  s .  co  m
        MizLib.addActionBarMargin(getActivity(), v.findViewById(R.id.linearLayout1));

    mActorBirthday = (TextView) v.findViewById(R.id.overviewMessage);
    mActorBirth = (TextView) v.findViewById(R.id.textView2);
    mActorName = (TextView) v.findViewById(R.id.textView3);
    mActorName.setTypeface(tf);
    mActorName.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    if (MizLib.isTablet(getActivity()))
        mActorName.setTextSize(48f);
    mActorBio = (TextView) v.findViewById(R.id.textView4);
    mActorImage = (ImageView) v.findViewById(R.id.traktIcon);
    mActorImageBackground = (ImageView) v.findViewById(R.id.imageView2);

    if (!MizLib.isPortrait(getActivity())) {
        mActorImageBackground.setImageResource(R.drawable.bg);
    }

    loadData();
}

From source file:com.purchasingpower.inappbrowser.WebViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //setContentView(R.layout.activity_main);
    setContentView(getResources().getIdentifier("nativebrowserplugin", "layout", getPackageName()));
    if (!checkPermission()) {
        requestPermission();/*from ww w .  java  2 s . co  m*/
    }
    Intent intent = getIntent();
    String url = intent.getExtras().getString("url");
    final WebView myWebView = (WebView) findViewById(
            getResources().getIdentifier("webview", "id", getPackageName()));
    myWebView.setWebViewClient(new MyWebViewClient());

    webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setAllowFileAccess(true);
    myWebView.setWebChromeClient(new PQChromeClient());
    //if SDK version is greater of 19 then activate hardware acceleration otherwise activate software acceleration
    if (Build.VERSION.SDK_INT >= 19) {
        myWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    } else if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT < 19) {
        myWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

    myWebView.loadUrl(url);

    back = (ImageView) findViewById(getResources().getIdentifier("back", "id", getPackageName()));
    back.setImageResource(getResources().getIdentifier("back_gray", "drawable", getPackageName()));
    forward = (ImageView) findViewById(getResources().getIdentifier("forward", "id", getPackageName()));
    forward.setImageResource(getResources().getIdentifier("forward_gray", "drawable", getPackageName()));
    done = (TextView) findViewById(getResources().getIdentifier("done", "id", getPackageName()));
    pbar = (ProgressBar) findViewById(getResources().getIdentifier("pbar", "id", getPackageName()));
    pbar.setVisibility(View.VISIBLE);
    back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (myWebView.canGoBack()) {
                myWebView.goBack();
            }
        }
    });
    forward.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (myWebView.canGoForward()) {
                myWebView.goForward();
            }
        }
    });
    done.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.v("Done", "Clicked");
            finish();
        }
    });
}

From source file:com.android.madpausa.cardnotificationviewer.CardElementHolder.java

private void initAnimator() {
    scroller = new Scroller(root.getContext());
    animator = ValueAnimator.ofFloat(1, 0);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override// w  w w  . j  a v  a2 s.  c om
        public void onAnimationUpdate(ValueAnimator animation) {
            animateScroll();
            if (cancel)
                root.setAlpha((Float) animation.getAnimatedValue());
        }
    });
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {
            root.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            endAnimation();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            endAnimation();
        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }

        private void endAnimation() {
            root.setTranslationX(scroller.getFinalX());
            root.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            if (cancel)
                nService.cancelNotification(sbn);
        }
    });
}

From source file:jp.co.recruit_lifestyle.android.widget.ColoringLoadingView.java

public ColoringLoadingView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    initView();// ww  w.j  a  v a 2  s.com

    mLoadingHandler = new Handler();
    mCharacterHandler = new Handler();
    mRectF = new RectF();
    mRegion = new Region();
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}