android.view.View#LAYER_TYPE_SOFTWARE源码实例Demo

下面列出了android.view.View#LAYER_TYPE_SOFTWARE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Lassi-Android   文件: CropOverlayView.java
/**
 * The shape of the cropping area - rectangle/circular.
 */
public void setCropShape(CropImageView.CropShape cropShape) {
    if (mCropShape != cropShape) {
        mCropShape = cropShape;
        if (Build.VERSION.SDK_INT <= 17) {
            if (mCropShape == CropImageView.CropShape.OVAL) {
                mOriginalLayerType = getLayerType();
                if (mOriginalLayerType != View.LAYER_TYPE_SOFTWARE) {
                    // TURN off hardware acceleration
                    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                } else {
                    mOriginalLayerType = null;
                }
            } else if (mOriginalLayerType != null) {
                // return hardware acceleration back
                setLayerType(mOriginalLayerType, null);
                mOriginalLayerType = null;
            }
        }
        invalidate();
    }
}
 
源代码2 项目: giffun   文件: CropOverlayView.java
/** The shape of the cropping area - rectangle/circular. */
public void setCropShape(CropImageView.CropShape cropShape) {
  if (mCropShape != cropShape) {
    mCropShape = cropShape;
    if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 17) {
      if (mCropShape == CropImageView.CropShape.OVAL) {
        mOriginalLayerType = getLayerType();
        if (mOriginalLayerType != View.LAYER_TYPE_SOFTWARE) {
          // TURN off hardware acceleration
          setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        } else {
          mOriginalLayerType = null;
        }
      } else if (mOriginalLayerType != null) {
        // return hardware acceleration back
        setLayerType(mOriginalLayerType, null);
        mOriginalLayerType = null;
      }
    }
    invalidate();
  }
}
 
源代码3 项目: timecat   文件: CropOverlayView.java
/**
 * The shape of the cropping area - rectangle/circular.
 */
public void setCropShape(CropImageView.CropShape cropShape) {
    if (mCropShape != cropShape) {
        mCropShape = cropShape;
        if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 17) {
            if (mCropShape == CropImageView.CropShape.OVAL) {
                mOriginalLayerType = getLayerType();
                if (mOriginalLayerType != View.LAYER_TYPE_SOFTWARE) {
                    // TURN off hardware acceleration
                    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                } else {
                    mOriginalLayerType = null;
                }
            } else if (mOriginalLayerType != null) {
                // return hardware acceleration back
                setLayerType(mOriginalLayerType, null);
                mOriginalLayerType = null;
            }
        }
        invalidate();
    }
}
 
private void configLayerType(ViewHolder holder) {

        boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
        if (!disableHardAccelerated) {
            return;
        }

        int currentWidgetLayerType = holder.username.getLayerType();

        if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
            holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            if (holder.weiboTextContent != null) {
                holder.weiboTextContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }

            if (holder.time != null) {
                holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }

        }

    }
 
void updateFromViewRotation() {
  if (Build.VERSION.SDK_INT == 19) {
    // KitKat seems to have an issue with views which are rotated with angles which are
    // not divisible by 90. Worked around by moving to software rendering in these cases.
    if ((rotation % 90) != 0) {
      if (view.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
      }
    } else {
      if (view.getLayerType() != View.LAYER_TYPE_NONE) {
        view.setLayerType(View.LAYER_TYPE_NONE, null);
      }
    }
  }

  // Offset any View rotation
  if (shapeDrawable != null) {
    shapeDrawable.setShadowCompatRotation((int) rotation);
  }
}
 
源代码6 项目: Android-Image-Cropper   文件: CropOverlayView.java
/** The shape of the cropping area - rectangle/circular. */
public void setCropShape(CropImageView.CropShape cropShape) {
  if (mCropShape != cropShape) {
    mCropShape = cropShape;
      if (Build.VERSION.SDK_INT <= 17) {
      if (mCropShape == CropImageView.CropShape.OVAL) {
        mOriginalLayerType = getLayerType();
        if (mOriginalLayerType != View.LAYER_TYPE_SOFTWARE) {
          // TURN off hardware acceleration
          setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        } else {
          mOriginalLayerType = null;
        }
      } else if (mOriginalLayerType != null) {
        // return hardware acceleration back
        setLayerType(mOriginalLayerType, null);
        mOriginalLayerType = null;
      }
    }
    invalidate();
  }
}
 
源代码7 项目: iBeebo   文件: UserListAdapter.java
private void configLayerType(ViewHolder holder) {

        boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
        if (!disableHardAccelerated) {
            return;
        }

        int currentWidgetLayerType = holder.username.getLayerType();

        if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
            holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            if (holder.content != null) {
                holder.content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }

        }

    }
 
源代码8 项目: iBeebo   文件: UserListAdapter.java
private void configLayerType(ViewHolder holder) {

        boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
        if (!disableHardAccelerated) {
            return;
        }

        int currentWidgetLayerType = holder.username.getLayerType();

        if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
            holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            if (holder.content != null) {
                holder.content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }

        }

    }
 
源代码9 项目: Genius-Android   文件: Button.java
/**
 * In this, you can set TouchEffectDrawable,
 * to init TouchEffectDrawable.
 * <p>
 * If you not need touch effect,
 * you should set NULL.
 * <p>
 * But, if need it,
 * you should call {@link TouchEffectDrawable#setEffect(Effect)}
 *
 * @param touchDrawable TouchEffectDrawable
 */
public void setTouchDrawable(TouchEffectDrawable touchDrawable) {
    if (mTouchDrawable != touchDrawable) {
        if (mTouchDrawable != null) {
            mTouchDrawable.setCallback(null);
        }
        if (touchDrawable != null) {
            touchDrawable.setCallback(this);
            // We must set layer type is View.LAYER_TYPE_SOFTWARE,
            // to support Canvas.clipPath()
            // on Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
            if (getLayerType() != View.LAYER_TYPE_SOFTWARE)
                setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        mTouchDrawable = touchDrawable;
    }
}
 
源代码10 项目: Genius-Android   文件: ImageView.java
/**
 * In this, you can set TouchEffectDrawable,
 * to init TouchEffectDrawable.
 * <p>
 * If you not need touch effect,
 * you should set NULL.
 * <p>
 * But, if need it,
 * you should call {@link TouchEffectDrawable#setEffect(Effect)}
 *
 * @param touchDrawable TouchEffectDrawable
 */
public void setTouchDrawable(TouchEffectDrawable touchDrawable) {
    if (mTouchDrawable != touchDrawable) {
        if (mTouchDrawable != null) {
            mTouchDrawable.setCallback(null);
        }
        if (touchDrawable != null) {
            touchDrawable.setCallback(this);
            // We must set layer type is View.LAYER_TYPE_SOFTWARE,
            // to support Canvas.clipPath()
            // on Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
            if (getLayerType() != View.LAYER_TYPE_SOFTWARE)
                setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
        mTouchDrawable = touchDrawable;
    }
}
 
源代码11 项目: Genius-Android   文件: FloatActionButton.java
@Override
public void setLayerType(int layerType, Paint paint) {
    // In this, to support Canvas.clipPath(),
    // must set layerType is View.LAYER_TYPE_SOFTWARE
    layerType = View.LAYER_TYPE_SOFTWARE;
    super.setLayerType(layerType, paint);
}
 
源代码12 项目: pandroid   文件: CircularFrameLayout.java
public void setClipOutEnable(boolean clip) {
    if (mClipOutEnable != clip) {
        if (mLayerType != View.LAYER_TYPE_SOFTWARE) {
            setLayerType(clip ? View.LAYER_TYPE_SOFTWARE : mLayerType, null);
        }
        mClipOutEnable = clip;
        invalidate();
    }
}
 
源代码13 项目: iBeebo   文件: AbstractAppListAdapter.java
private void configLayerType(ViewHolder holder) {

        boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
        if (!disableHardAccelerated) {
            return;
        }

        int currentWidgetLayerType = holder.username.getLayerType();

        if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
            holder.username.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            if (holder.weiboTextContent != null) {
                holder.weiboTextContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
            if (holder.repost_content != null) {
                holder.repost_content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
            if (holder.time != null) {
                holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
            if (holder.repost_count != null) {
                holder.repost_count.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
            if (holder.comment_count != null) {
                holder.comment_count.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
        }

    }
 
源代码14 项目: Nibo   文件: CircularRevealAnimator.java
RevealFinishedIceCreamSandwich(CircularRevealAnimator target) {
    super(target);

    mLayerType = ((View) target).getLayerType();
    mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
 
源代码15 项目: fab-toolbar   文件: RevealAnimator.java
RevealFinishedIceCreamSandwich(RevealAnimator target) {
    super(target);

    mLayerType = ((View) target).getLayerType();
    mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
 
源代码16 项目: PersistentSearchView   文件: RevealAnimator.java
RevealFinishedIceCreamSandwich(RevealAnimator target) {
    super(target);

    mLayerType = ((View) target).getLayerType();
    mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
 
RevealFinishedIceCreamSandwich(RevealAnimator target) {
    super(target);

    mLayerType = ((View) target).getLayerType();
    mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
 
源代码18 项目: fab-transformation   文件: RevealAnimator.java
RevealFinishedIceCreamSandwich(RevealAnimator target) {
    super(target);

    mLayerType = ((View) target).getLayerType();
    mFeaturedLayerType = View.LAYER_TYPE_SOFTWARE;
}
 
源代码19 项目: iBeebo   文件: DMConversationAdapter.java
private void configLayerType(ViewHolder holder) {

        boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
        if (!disableHardAccelerated)
            return;

        int currentWidgetLayerType = holder.content.getLayerType();

        if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
            holder.content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

            if (holder.time != null)
                holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }

    }
 
源代码20 项目: iBeebo   文件: DMConversationAdapter.java
private void configLayerType(ViewHolder holder) {

        boolean disableHardAccelerated = SettingUtils.disableHardwareAccelerated();
        if (!disableHardAccelerated)
            return;

        int currentWidgetLayerType = holder.content.getLayerType();

        if (View.LAYER_TYPE_SOFTWARE != currentWidgetLayerType) {
            holder.content.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

            if (holder.time != null)
                holder.time.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }

    }
 
 方法所在类
 同类方法