List of usage examples for android.view View LAYER_TYPE_SOFTWARE
int LAYER_TYPE_SOFTWARE
To view the source code for android.view View LAYER_TYPE_SOFTWARE.
Click Source Link
Indicates that the view has a software layer.
From source file:cn.finalteam.loadingviewfinal.header.MaterialProgressDrawable.java
@SuppressLint("NewApi") private void setUp(final double diameter) { final int shadowYOffset = PtrLocalDisplay.dp2px(Y_OFFSET); final int shadowXOffset = PtrLocalDisplay.dp2px(X_OFFSET); int mShadowRadius = PtrLocalDisplay.dp2px(SHADOW_RADIUS); OvalShape oval = new OvalShadow(mShadowRadius, (int) diameter); mShadow = new ShapeDrawable(oval); if (Build.VERSION.SDK_INT >= 11) { mParent.setLayerType(View.LAYER_TYPE_SOFTWARE, mShadow.getPaint()); }/* ww w .j av a 2s . c o m*/ mShadow.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); }
From source file:com.yan.refreshloadlayouttest.widget.MaterialProgressDrawable.java
private void setUp(final double diameter) { final int shadowYOffset = dipToPx(mParent.getContext(), Y_OFFSET); final int shadowXOffset = dipToPx(mParent.getContext(), X_OFFSET); int mShadowRadius = dipToPx(mParent.getContext(), SHADOW_RADIUS); OvalShape oval = new OvalShadow(mShadowRadius, (int) diameter); mShadow = new ShapeDrawable(oval); if (Build.VERSION.SDK_INT >= 11) { mParent.setLayerType(View.LAYER_TYPE_SOFTWARE, mShadow.getPaint()); }/* ww w .j a v a 2s. co m*/ mShadow.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); }
From source file:com.poguico.palmabici.map.StationMapFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setHardwareAccelerationOff() { // Turn off hardware acceleration here, or in manifest if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) mMapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); }
From source file:android.wuliqing.com.mylibrary.header.MaterialProgressDrawable.java
private void setUp(final double diameter) { PtrLocalDisplay.init(mParent.getContext()); final int shadowYOffset = PtrLocalDisplay.dp2px(Y_OFFSET); final int shadowXOffset = PtrLocalDisplay.dp2px(X_OFFSET); int mShadowRadius = PtrLocalDisplay.dp2px(SHADOW_RADIUS); OvalShape oval = new OvalShadow(mShadowRadius, (int) diameter); mShadow = new ShapeDrawable(oval); if (Build.VERSION.SDK_INT >= 11) { mParent.setLayerType(View.LAYER_TYPE_SOFTWARE, mShadow.getPaint()); }/*from w w w .j a va 2s . co m*/ mShadow.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); }
From source file:cn.xiaocool.hongyunschool.view.MaterialProgressDrawable.java
private void setUp(final double diameter) { final int shadowYOffset = DensityUtil.dip2px(mParent.getContext(), Y_OFFSET); final int shadowXOffset = DensityUtil.dip2px(mParent.getContext(), X_OFFSET); int mShadowRadius = DensityUtil.dip2px(mParent.getContext(), SHADOW_RADIUS); OvalShape oval = new OvalShadow(mShadowRadius, (int) diameter); mShadow = new ShapeDrawable(oval); if (Build.VERSION.SDK_INT >= 11) { mParent.setLayerType(View.LAYER_TYPE_SOFTWARE, mShadow.getPaint()); }/* ww w.j av a 2s .c om*/ mShadow.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); }
From source file:com.hctrom.romcontrol.licenseadapter.LicenseDialogoAlerta.java
public void applyBlurMaskFilter(TextView tv, BlurMaskFilter.Blur style) { /*/*from ww w . j av a 2 s .c o m*/ MaskFilter Known Direct Subclasses BlurMaskFilter, EmbossMaskFilter MaskFilter is the base class for object that perform transformations on an alpha-channel mask before drawing it. A subclass of MaskFilter may be installed into a Paint. Blur and emboss are implemented as subclasses of MaskFilter. */ /* BlurMaskFilter This takes a mask, and blurs its edge by the specified radius. Whether or or not to include the original mask, and whether the blur goes outside, inside, or straddles, the original mask's border, is controlled by the Blur enum. */ /* public BlurMaskFilter (float radius, BlurMaskFilter.Blur style) Create a blur maskfilter. Parameters radius : The radius to extend the blur from the original mask. Must be > 0. style : The Blur to use Returns The new blur maskfilter */ /* BlurMaskFilter.Blur INNER : Blur inside the border, draw nothing outside. NORMAL : Blur inside and outside the original border. OUTER : Draw nothing inside the border, blur outside. SOLID : Draw solid inside the border, blur outside. */ /* public float getTextSize () Returns the size (in pixels) of the default text size in this TextView. */ // Define the blur effect radius float radius = tv.getTextSize() / 10; // Initialize a new BlurMaskFilter instance BlurMaskFilter filter = new BlurMaskFilter(radius, style); /* public void setLayerType (int layerType, Paint paint) Specifies the type of layer backing this view. The layer can be LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE or LAYER_TYPE_HARDWARE. A layer is associated with an optional Paint instance that controls how the layer is composed on screen. Parameters layerType : The type of layer to use with this view, must be one of LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE or LAYER_TYPE_HARDWARE paint : The paint used to compose the layer. This argument is optional and can be null. It is ignored when the layer type is LAYER_TYPE_NONE */ /* public static final int LAYER_TYPE_SOFTWARE Indicates that the view has a software layer. A software layer is backed by a bitmap and causes the view to be rendered using Android's software rendering pipeline, even if hardware acceleration is enabled. */ // Set the TextView layer type tv.setLayerType(View.LAYER_TYPE_SOFTWARE, null); /* public MaskFilter setMaskFilter (MaskFilter maskfilter) Set or clear the maskfilter object. Pass null to clear any previous maskfilter. As a convenience, the parameter passed is also returned. Parameters maskfilter : May be null. The maskfilter to be installed in the paint Returns maskfilter */ // Finally, apply the blur effect on TextView text tv.getPaint().setMaskFilter(filter); }
From source file:in.srain.cube.header.MaterialProgressDrawable.java
@SuppressLint("NewApi") private void setUp(final double diameter) { PtrLocalDisplay.init(mParent.getContext()); final int shadowYOffset = PtrLocalDisplay.dp2px(Y_OFFSET); final int shadowXOffset = PtrLocalDisplay.dp2px(X_OFFSET); int mShadowRadius = PtrLocalDisplay.dp2px(SHADOW_RADIUS); OvalShape oval = new OvalShadow(mShadowRadius, (int) diameter); mShadow = new ShapeDrawable(oval); if (Build.VERSION.SDK_INT >= 11) { mParent.setLayerType(View.LAYER_TYPE_SOFTWARE, mShadow.getPaint()); }//from ww w. j a va 2 s .c om mShadow.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR); }
From source file:org.zywx.wbpalmstar.engine.EBrowserView.java
private void closeHardwareForSpecificString() { String[] strs = EUExUtil.getStringArray("platform_close_hardware"); if (strs != null) { for (int i = 0; i < strs.length; i++) { String str = strs[i].trim(); // ??Android? if (Build.MODEL.trim().equals(str) || Build.BRAND.trim().equals(str) || Build.MANUFACTURER.trim().equals(str)) { setLayerType(View.LAYER_TYPE_SOFTWARE, null); BDebug.i("setLayerType", "LAYER_TYPE_SOFTWARE"); break; }// w w w .j av a 2s .com } } }
From source file:com.miz.mizuu.fragments.ShowEpisodeDetailsFragment.java
public void onViewCreated(View v, Bundle savedInstanceState) { super.onViewCreated(v, savedInstanceState); if (thisEpisode != null) { cover = (ImageView) v.findViewById(R.id.traktIcon); playbutton = (ImageView) v.findViewById(R.id.imageView2); title = (TextView) v.findViewById(R.id.overviewMessage); plot = (TextView) v.findViewById(R.id.textView2); airdate = (TextView) v.findViewById(R.id.textView9); rating = (TextView) v.findViewById(R.id.textView11); director = (TextView) v.findViewById(R.id.textView7); writer = (TextView) v.findViewById(R.id.textView3); gueststars = (TextView) v.findViewById(R.id.TextView04); file = (TextView) v.findViewById(R.id.TextView07); // Set the episode details title.setText(thisEpisode.getTitle()); title.setTypeface(tf);//from ww w. j a v a 2 s . c o m if (MizLib.isGoogleTV(getActivity())) title.setTextSize(28f); title.setLayerType(View.LAYER_TYPE_SOFTWARE, null); if (!thisEpisode.getDescription().equals(getString(R.string.stringNA)) && !MizLib.isEmpty(thisEpisode.getDescription())) plot.setText(thisEpisode.getDescription()); else plot.setText(getString(R.string.stringNoPlot)); if (MizLib.isEmpty(thisEpisode.getReleasedate()) || thisEpisode.getReleasedate().equals(getString(R.string.stringNA))) { v.findViewById(R.id.tableRow1).setVisibility(View.GONE); } else { // Set the genre first aired date try { String[] date = thisEpisode.getReleasedate().split("-"); Calendar cal = Calendar.getInstance(); cal.set(Integer.parseInt(date[0]), Integer.parseInt(date[1]) - 1, Integer.parseInt(date[2])); airdate.setText(DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault()) .format(cal.getTime())); } catch (Exception e) { // Fall back if something goes wrong airdate.setText(thisEpisode.getReleasedate()); } } if (!thisEpisode.getRating().equals("0/10")) rating.setText(thisEpisode.getRating()); else v.findViewById(R.id.tableRow2).setVisibility(View.GONE); if (MizLib.isEmpty(thisEpisode.getDirector()) || thisEpisode.getDirector().equals(getString(R.string.stringNA))) { v.findViewById(R.id.tableRow3).setVisibility(View.GONE); } else { director.setText(thisEpisode.getDirector()); } if (MizLib.isEmpty(thisEpisode.getWriter()) || thisEpisode.getWriter().equals(getString(R.string.stringNA))) { v.findViewById(R.id.tableRow4).setVisibility(View.GONE); } else { writer.setText(thisEpisode.getWriter()); } if (MizLib.isEmpty(thisEpisode.getGuestStars()) || thisEpisode.getGuestStars().equals(getString(R.string.stringNA))) { v.findViewById(R.id.tableRow5).setVisibility(View.GONE); } else { gueststars.setText(thisEpisode.getGuestStars()); } file.setText(thisEpisode.getFilepath()); playbutton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { play(); } }); mPicasso.load(thisEpisode.getEpisodePhoto()).skipMemoryCache().placeholder(R.drawable.bg).into(cover, new Callback() { @Override public void onError() { if (isAdded()) mPicasso.load(MizLib.getTvShowThumbFolder(getActivity()) + "/" + thisEpisode.getShowId() + ".jpg").skipMemoryCache() .placeholder(R.drawable.bg).error(R.drawable.nobackdrop).into(cover); } @Override public void onSuccess() { } }); } }
From source file:com.abct.tljr.news.widget.ZoomableImageView.java
public void setImageBitmap(final Bitmap bitmap) { final int viewWidth = getWidth(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && bitmap != null && bitmap.getHeight() > 1800) setLayerType(View.LAYER_TYPE_SOFTWARE, null); if (viewWidth <= 0) { mOnLayoutRunnable = new Runnable() { public void run() { setImageBitmap(bitmap);/*from w w w. j a v a 2s. com*/ } }; return; } if (bitmap != null) { setBaseMatrix(bitmap, mBaseMatrix); this.mBitmap = bitmap; } else { mBaseMatrix.reset(); this.mBitmap = bitmap; } mSuppMatrix.reset(); setImageMatrix(getImageViewMatrix()); mMaxZoom = maxZoom(); // Set the image to fit the screen zoomTo(zoomDefault()); }