Android Open Source - MediaCodecVideoPlayer Rounded Corner Image View






From Project

Back to project page MediaCodecVideoPlayer.

License

The source code is released under:

Apache License

If you think the Android project MediaCodecVideoPlayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jasonsoft.mediacodecvideoplayer;
//  ww w .jav a 2  s . com
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Path;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.view.View;

public class RoundedCornerImageView extends ImageView {
    private int mRoundedRadius;

    public RoundedCornerImageView(Context context) {
        super(context);
        init();
    }

    public RoundedCornerImageView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        init();
    }

    public RoundedCornerImageView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    private void init() {
        mRoundedRadius = (int) getResources().getDimension(R.dimen.rounded_radius);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
            setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
    }

    @Override
    protected void onDraw(Canvas canvas) {
        Path clipPath = new Path();
        RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
        clipPath.addRoundRect(rect, mRoundedRadius, mRoundedRadius, Path.Direction.CW);
        canvas.clipPath(clipPath);
        super.onDraw(canvas);
    }
}




Java Source Code List

com.example.hellojni.HelloJni.java
com.jasonsoft.mediacodecvideoplayer.LoadThumbnailTask.java
com.jasonsoft.mediacodecvideoplayer.MediaCodecVideoPlayerActivity.java
com.jasonsoft.mediacodecvideoplayer.MenuDrawerBaseActivity.java
com.jasonsoft.mediacodecvideoplayer.RoundedCornerImageView.java
com.jasonsoft.mediacodecvideoplayer.Utils.java
com.jasonsoft.mediacodecvideoplayer.VideoSurfaceView.java
com.jasonsoft.mediacodecvideoplayer.adapter.MenuAdapter.java
com.jasonsoft.mediacodecvideoplayer.cache.CacheManager.java
com.jasonsoft.mediacodecvideoplayer.data.AsyncDrawable.java
com.jasonsoft.mediacodecvideoplayer.data.LoadThumbnailParams.java
com.jasonsoft.mediacodecvideoplayer.data.LoadThumbnailResult.java
com.jasonsoft.mediacodecvideoplayer.data.MenuDrawerCategory.java
com.jasonsoft.mediacodecvideoplayer.data.MenuDrawerItem.java
net.simonvt.menudrawer.BuildLayerFrameLayout.java
net.simonvt.menudrawer.ColorDrawable.java
net.simonvt.menudrawer.DraggableDrawer.java
net.simonvt.menudrawer.FloatScroller.java
net.simonvt.menudrawer.MenuDrawer.java
net.simonvt.menudrawer.NoClickThroughFrameLayout.java
net.simonvt.menudrawer.OverlayDrawer.java
net.simonvt.menudrawer.PeekInterpolator.java
net.simonvt.menudrawer.Position.java
net.simonvt.menudrawer.Scroller.java
net.simonvt.menudrawer.SinusoidalInterpolator.java
net.simonvt.menudrawer.SlideDrawable.java
net.simonvt.menudrawer.SlidingDrawer.java
net.simonvt.menudrawer.SmoothInterpolator.java
net.simonvt.menudrawer.StaticDrawer.java
net.simonvt.menudrawer.ViewHelper.java
net.simonvt.menudrawer.compat.ActionBarHelperCompat.java
net.simonvt.menudrawer.compat.ActionBarHelperNative.java
net.simonvt.menudrawer.compat.ActionBarHelper.java