code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.save(); canvas.rotate(count, centerX, centerY); for (int i = 0; i < CIRCLE_COUNT; i++) { canvas.drawCircle(centerX + offsetX, centerY, radiusArray[i], paint); canvas.rotate(40, cent...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/3/17
onDraw
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
Apache-2.0
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); exit = false; startAnimation(); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/3/17
onAttachedToWindow
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
Apache-2.0
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); exit = true; handler.removeCallbacksAndMessages(null); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/3/17
onDetachedFromWindow
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
Apache-2.0
private void startAnimation() { handler.post(new AnimationRunnable(this)); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/3/17
startAnimation
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
Apache-2.0
private int dip2px(float dpValue) { return (int) (dpValue * getResources().getDisplayMetrics().density + 0.5f); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/3/17
dip2px
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
Apache-2.0
@Override public void run() { WlCircleLoadView view = viewRef.get(); if (view == null || view.exit) return; view.count = (view.count + 5) % 360; view.invalidate(); view.handler.postDelayed(this, FRAME_DELAY); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/3/17
run
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlCircleLoadView.java
Apache-2.0
public void setBgHeight(int bgheight) { if (bgheight <= 0) { return; } this.w_bg = dip2px(getContext(), bgheight); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setBgHeight
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setThumbRadius(int radius) { if (radius <= 0) { return; } this.radius = dip2px(getContext(), radius); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setThumbRadius
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setColorBg(int color) { color_bg = getResources().getColor(color); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setColorBg
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setColorBuffer(int colorBuffer) { color_buffer = getResources().getColor(colorBuffer); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setColorBuffer
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setColorProgress(int color) { color_progress = getResources().getColor(color); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setColorProgress
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setColorThumbNormal(int color) { color_thumb_normal = getResources().getColor(color); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setColorThumbNormal
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setColorThumbTouch(int color) { color_thumb_touch = getResources().getColor(color); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setColorThumbTouch
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setOnWlSeekBarChangeListener(OnWlSeekBarChangeListener onWlSeekBarChangeListener) { this.onWlSeekBarChangeListener = onWlSeekBarChangeListener; }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setOnWlSeekBarChangeListener
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); width = getMeasuredWidth(); height = getMeasuredHeight(); top = (height - w_bg) / 2; bottom = (height - w_bg) / 2 + w_bg; cy = heigh...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
onMeasure
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
@Override public boolean onTouchEvent(MotionEvent event) { synchronized (syncAction) { int action = event.getAction(); touch = true; switch (action) { case MotionEvent.ACTION_DOWN: moveX = event.getX(); setProgressIn...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
onTouchEvent
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setRound(boolean isRound) { this.isRound = isRound; invalidate(); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setRound
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setProgress(double progress) { setProgress(progress, progress_buffer); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setProgress
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setProgress(double progress, double progress_buffer) { synchronized (syncAction) { if (!touch) { setProgressInner(progress, progress_buffer); } } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setProgress
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
private void setProgressInner(double progress) { setProgressInner(progress, progress_buffer); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setProgressInner
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
private synchronized void setProgressInner(double progress, double progress_buffer) { if (progress < 0f) { progress = 0f; } if (progress > 1f) { progress = 1f; } if (progress_buffer < 0f) { progress_buffer = 0f; } if (progress_...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
setProgressInner
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public static int dip2px(Context context, float dipValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dipValue * scale + 0.5f); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/8/18
dip2px
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSeekBar.java
Apache-2.0
public void setWlPlayer(WlPlayer wlPlayer) { this.wlPlayer = wlPlayer; }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setWlPlayer
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setWlPlayer(WlPlayer wlPlayer, String rgba) { this.wlPlayer = wlPlayer; if (WlColorUtil.isRGBAColor(rgba)) { this.rgba = rgba; } else { this.rgba = "#000000FF"; } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setWlPlayer
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setAlphaVideoType(WlAlphaVideoType alphaVideoType) { if (wlPlayer == null) { return; } if (alphaVideoType == WlAlphaVideoType.WL_ALPHA_VIDEO_DEFAULT) { setZOrderOnTop(false); } else { setZOrderOnTop(true); } this.wlPlayer.se...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setAlphaVideoType
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setVideoScale(WlScaleType scaleType) { if (wlPlayer != null) { wlPlayer.setVideoScale(getUniqueNum(), scaleType); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setVideoScale
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setVideoScale(int scaleWidth, int scaleHeight) { if (wlPlayer != null) { wlPlayer.setVideoScale(getUniqueNum(), scaleWidth, scaleHeight); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setVideoScale
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setVideoRotate(WlRotateType rotateType) { if (wlPlayer != null) { wlPlayer.setVideoRotate(getUniqueNum(), rotateType); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setVideoRotate
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setVideoMirror(WlMirrorType mirrorType) { if (wlPlayer != null) { wlPlayer.setVideoMirror(getUniqueNum(), mirrorType); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setVideoMirror
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public long getUniqueNum() { return hashCode(); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
getUniqueNum
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setClearLastVideoFrame(boolean clear){ if(wlPlayer != null){ wlPlayer.setClearLastVideoFrame(getUniqueNum(), clear); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setClearLastVideoFrame
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setOnVideoViewListener(WlOnVideoViewListener onVideoViewListener) { this.wlOnVideoViewListener = onVideoViewListener; }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
setOnVideoViewListener
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
@Override public void surfaceCreated(SurfaceHolder holder) { if (!isInit) { if (wlOnVideoViewListener != null) { isInit = true; wlOnVideoViewListener.initSuccess(); } } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
surfaceCreated
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
@Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if (wlPlayer != null) { wlPlayer.setSurface(holder.getSurface(), rgba, hashCode()); } if (wlOnVideoViewListener != null) { wlOnVideoViewListener.onSurfaceChange(width, heig...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
surfaceChanged
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
@Override public void surfaceDestroyed(SurfaceHolder holder) { if (wlPlayer != null) { wlPlayer.setSurface(null, rgba, hashCode()); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
surfaceDestroyed
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
@Override public boolean onTouchEvent(MotionEvent event) { if (wlPlayer == null) { return super.onTouchEvent(event); } int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: isXMoving = false; isMove =...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
onTouchEvent
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
@Override public void run() { if (clickCount == 1) { if (wlOnVideoViewListener != null) { wlOnVideoViewListener.onSingleClick(); } } else if (clickCount == 2) { if (wlOnVideoViewListener != null) { wl...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
run
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
private int dip2px(Context context, float dipValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dipValue * scale + 0.5f); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/1/24
dip2px
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlSurfaceView.java
Apache-2.0
public void setWlPlayer(WlPlayer wlPlayer) { this.wlPlayer = wlPlayer; }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setWlPlayer
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setWlPlayer(WlPlayer wlPlayer, String rgba) { this.wlPlayer = wlPlayer; if (WlColorUtil.isRGBAColor(rgba)) { this.rgba = rgba; } else { this.rgba = "#000000FF"; } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setWlPlayer
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setAlphaVideoType(WlAlphaVideoType alphaVideoType) { if (wlPlayer == null) { return; } if (alphaVideoType == WlAlphaVideoType.WL_ALPHA_VIDEO_DEFAULT) { setOpaque(true); } else { setOpaque(false); } this.wlPlayer.setAlphaVide...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setAlphaVideoType
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setVideoScale(WlScaleType scaleType) { if (wlPlayer != null) { wlPlayer.setVideoScale(getUniqueNum(), scaleType); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setVideoScale
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setVideoScale(int scaleWidth, int scaleHeight) { if (wlPlayer != null) { wlPlayer.setVideoScale(getUniqueNum(), scaleWidth, scaleHeight); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setVideoScale
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setVideoRotate(WlRotateType rotateType) { if (wlPlayer != null) { wlPlayer.setVideoRotate(getUniqueNum(), rotateType); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setVideoRotate
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setVideoMirror(WlMirrorType mirrorType) { if (wlPlayer != null) { wlPlayer.setVideoMirror(getUniqueNum(), mirrorType); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setVideoMirror
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public long getUniqueNum() { return hashCode(); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
getUniqueNum
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setClearLastVideoFrame(boolean clear) { if (wlPlayer != null) { wlPlayer.setClearLastVideoFrame(getUniqueNum(), clear); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setClearLastVideoFrame
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void setOnVideoViewListener(WlOnVideoViewListener onVideoViewListener) { this.wlOnVideoViewListener = onVideoViewListener; }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
setOnVideoViewListener
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { Matrix matrix = new Matrix(); matrix.setScale(1.001f, 1.001f); setTransform(matrix); if (this.surfaceTextur == null) { this.surfaceTextur = surfaceTexture; } el...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
onSurfaceTextureAvailable
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int width, int height) { if (wlPlayer != null) { wlPlayer.setSurface(surface, rgba, getUniqueNum()); } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
onSurfaceTextureSizeChanged
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { if (wlPlayer != null) { wlPlayer.setSurface(null, rgba, getUniqueNum()); } return false; }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
onSurfaceTextureDestroyed
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
onSurfaceTextureUpdated
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public boolean onTouchEvent(MotionEvent event) { if (wlPlayer == null) { return super.onTouchEvent(event); } int action = event.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: isXMoving = false; isMove = ...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
onTouchEvent
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public void run() { if (clickCount == 1) { if (wlOnVideoViewListener != null) { wlOnVideoViewListener.onSingleClick(); } } else if (clickCount == 2) { if (wlOnVideoViewListener != null) { wl...
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
run
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
public void release() { if (surfaceTextur != null) { surfaceTextur.release(); surfaceTextur = null; } if (surface != null) { surface.release(); surface = null; } if (wlPlayer != null) { wlPlayer = null; } }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
release
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
private int dip2px(Context context, float dipValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dipValue * scale + 0.5f); }
author : ywl5320 e-mail : ywl5320@163.com desc : wlmedia date : 2024/5/19
dip2px
java
ywl5320/wlmedia
wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
https://github.com/ywl5320/wlmedia/blob/master/wlmedia_android/wlmedia/src/main/java/com/ywl5320/wlmedia/widget/WlTextureView.java
Apache-2.0
@Override public void onCreate() { super.onCreate(); httpRequestFactory = createRequestFactory(); }
This class offers a {@link SpiceService} that injects a {@link HttpRequestFactory} from Google Http Client into every {@link GoogleHttpClientSpiceRequest} it has to execute. Developpers can override {@link #createRequestFactory()} in addition to the usual {@link #createCacheManager(android.app.Application)} methods to ...
onCreate
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GoogleHttpClientSpiceService.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GoogleHttpClientSpiceService.java
Apache-2.0
public static HttpRequestFactory createRequestFactory() { HttpTransport httpTransport = AndroidHttp.newCompatibleTransport(); return httpTransport.createRequestFactory(); }
This class offers a {@link SpiceService} that injects a {@link HttpRequestFactory} from Google Http Client into every {@link GoogleHttpClientSpiceRequest} it has to execute. Developpers can override {@link #createRequestFactory()} in addition to the usual {@link #createCacheManager(android.app.Application)} methods to ...
createRequestFactory
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GoogleHttpClientSpiceService.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GoogleHttpClientSpiceService.java
Apache-2.0
@Override public void addRequest(CachedSpiceRequest<?> request, Set<RequestListener<?>> listRequestListener) { if (request.getSpiceRequest() instanceof GoogleHttpClientSpiceRequest) { ((GoogleHttpClientSpiceRequest<?>) request.getSpiceRequest()).setHttpRequestFactory(httpRequestFactory); ...
This class offers a {@link SpiceService} that injects a {@link HttpRequestFactory} from Google Http Client into every {@link GoogleHttpClientSpiceRequest} it has to execute. Developpers can override {@link #createRequestFactory()} in addition to the usual {@link #createCacheManager(android.app.Application)} methods to ...
addRequest
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GoogleHttpClientSpiceService.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GoogleHttpClientSpiceService.java
Apache-2.0
@Override public CacheManager createCacheManager(Application application) throws CacheCreationException { CacheManager cacheManager = new CacheManager(); cacheManager.addPersister(new GsonObjectPersisterFactory(application)); return cacheManager; }
A {@link GoogleHttpClientSpiceService} dedicated to json web services via gson. Provides caching. @author sni
createCacheManager
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GsonGoogleHttpClientSpiceService.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/GsonGoogleHttpClientSpiceService.java
Apache-2.0
@Override public CacheManager createCacheManager(Application application) throws CacheCreationException { CacheManager cacheManager = new CacheManager(); cacheManager.addPersister(new Jackson2ObjectPersisterFactory(application)); return cacheManager; }
A {@link GoogleHttpClientSpiceService} dedicated to json web services via Jackson. Provides caching. @author sni
createCacheManager
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/Jackson2GoogleHttpClientSpiceService.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/Jackson2GoogleHttpClientSpiceService.java
Apache-2.0
@Override public CacheManager createCacheManager(Application application) throws CacheCreationException { CacheManager cacheManager = new CacheManager(); cacheManager.addPersister(new JacksonObjectPersisterFactory(application)); return cacheManager; }
A {@link GoogleHttpClientSpiceService} dedicated to json web services via Jackson. Provides caching. @author sni
createCacheManager
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/JacksonGoogleHttpClientSpiceService.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client/src/main/java/com/octo/android/robospice/JacksonGoogleHttpClientSpiceService.java
Apache-2.0
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("id=").append(id); sb.append(", ").append("string=").append(string); sb.append(", ").append("millis=").append(millis); SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yyyy HH:m...
A simple demonstration object we are creating and persisting to the database.
toString
java
stephanenicolas/robospice
extensions/robospice-google-http-client-parent/robospice-google-http-client-test/src/main/java/com/octo/android/robospice/googlehttpclient/test/model/SimpleData.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-google-http-client-parent/robospice-google-http-client-test/src/main/java/com/octo/android/robospice/googlehttpclient/test/model/SimpleData.java
Apache-2.0
public void setOkHttpClient(OkHttpClient okHttpClient) { this.okHttpClient = okHttpClient; }
A simplified {@link SpiceRequest} that makes it even easier to use a OkHttpClient. @author SNI @param <T> the result type of this request.
setOkHttpClient
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/OkHttpSpiceRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/OkHttpSpiceRequest.java
Apache-2.0
public OkHttpClient getOkHttpClient() { return okHttpClient; }
A simplified {@link SpiceRequest} that makes it even easier to use a OkHttpClient. @author SNI @param <T> the result type of this request.
getOkHttpClient
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/OkHttpSpiceRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/OkHttpSpiceRequest.java
Apache-2.0
@Override public InputStream processStream(final int contentLength, final InputStream inputStream) throws IOException { OutputStream fileOutputStream = null; try { // touch boolean isTouchedNow = cacheFile.setLastModified(System .currentTimeMillis()); ...
Creates a OkHttpBigBinaryRequest using its own cache file to prevent any downloaded data to be stored in memory. All file received from the network (via a simple http GET request) will be stored directly in the cache file to prevent memory loss. @param url the url to get the image data from. @param cacheFile a file use...
processStream
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBigBinaryRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBigBinaryRequest.java
Apache-2.0
public File getCacheFile() { return cacheFile; }
Creates a OkHttpBigBinaryRequest using its own cache file to prevent any downloaded data to be stored in memory. All file received from the network (via a simple http GET request) will be stored directly in the cache file to prevent memory loss. @param url the url to get the image data from. @param cacheFile a file use...
getCacheFile
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBigBinaryRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBigBinaryRequest.java
Apache-2.0
@Override public final InputStream loadDataFromNetwork() throws Exception { try { OkUrlFactory urlFactory = new OkUrlFactory(getOkHttpClient()); HttpURLConnection connection = urlFactory.open(new URL(url)); return processStream(connection.getContentLength(), connection.ge...
Abstract class used to download binaries. See {@link OkHttpSmallBinaryRequest} and {@link OkHttpBigBinaryRequest} @author jva
loadDataFromNetwork
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBinaryRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBinaryRequest.java
Apache-2.0
protected final String getUrl() { return this.url; }
Abstract class used to download binaries. See {@link OkHttpSmallBinaryRequest} and {@link OkHttpBigBinaryRequest} @author jva
getUrl
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBinaryRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBinaryRequest.java
Apache-2.0
protected void readBytes(final InputStream in, final ProgressByteProcessor processor) throws IOException { final byte[] buf = new byte[BUF_SIZE]; try { int amt; do { amt = in.read(buf); if (amt == -1) { break; } ...
Inspired from Guava com.google.common.io.ByteStreams
readBytes
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBinaryRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBinaryRequest.java
Apache-2.0
@Override public Bitmap loadDataFromNetwork() throws Exception { try { OkUrlFactory urlFactory = new OkUrlFactory(getOkHttpClient()); HttpURLConnection connection = urlFactory.open(new URL(url)); processStream(connection.getContentLength(), connection.getInputStream()); ...
Creates a OkHttpBitmapRequest able to fetch a {@link Bitmap} from the network. @param url the url of the bitmap to fetch. @param width the requested width of the image. @param height the requested height of the image. @param cacheFile a file used to store data during download...
loadDataFromNetwork
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
Apache-2.0
protected final String getUrl() { return this.url; }
Creates a OkHttpBitmapRequest able to fetch a {@link Bitmap} from the network. @param url the url of the bitmap to fetch. @param width the requested width of the image. @param height the requested height of the image. @param cacheFile a file used to store data during download...
getUrl
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
Apache-2.0
@Override public File getCacheFile() { return cacheFile; }
Creates a OkHttpBitmapRequest able to fetch a {@link Bitmap} from the network. @param url the url of the bitmap to fetch. @param width the requested width of the image. @param height the requested height of the image. @param cacheFile a file used to store data during download...
getCacheFile
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
Apache-2.0
public void processStream(int contentLength, final InputStream inputStream) throws IOException { OutputStream fileOutputStream = null; try { // touch boolean isTouchedNow = cacheFile.setLastModified(System.currentTimeMillis()); if (!isTouchedNow) { Ln....
Creates a OkHttpBitmapRequest able to fetch a {@link Bitmap} from the network. @param url the url of the bitmap to fetch. @param width the requested width of the image. @param height the requested height of the image. @param cacheFile a file used to store data during download...
processStream
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
Apache-2.0
protected void readBytes(final InputStream in, final ProgressByteProcessor processor) throws IOException { final byte[] buf = new byte[BUF_SIZE]; try { int amt; do { amt = in.read(buf); if (amt == -1) { break; } ...
Inspired from Guava com.google.common.io.ByteStreams
readBytes
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
Apache-2.0
private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { ...
Inspired from Guava com.google.common.io.ByteStreams
calculateInSampleSize
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpBitmapRequest.java
Apache-2.0
@Override public InputStream processStream(final int contentLength, final InputStream inputStream) throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); readBytes(inputStream, new ProgressByteProcessor(this, bos, contentLength)); final byte[...
Downloads small images in size. All data is passed to the listener using memory. This class is meant to help download small images (like thumbnails). If you wish to download bigger documents (or if you don't know the size of your documents), you would be better using {@link OkHttpBigBinaryRequest}. @author sni & jva
processStream
java
stephanenicolas/robospice
extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpSmallBinaryRequest.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-okhttp-parent/robospice-okhttp/src/main/java/com/octo/android/robospice/request/okhttp/simple/OkHttpSmallBinaryRequest.java
Apache-2.0
public static Map<Class<?>, Uri> getContractClasses(List<Class<?>> classList) { Map<Class<?>, Uri> mapHandledClassesToNotificationUri = new HashMap<Class<?>, Uri>(); for (Class<?> clazz : classList) { Uri uri = null; try { Class<?> contractClass = getContractClass...
Helper to get contract class and relevent fields. @author SNI
getContractClasses
java
stephanenicolas/robospice
extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
Apache-2.0
public static Class<?> getContractClassForClass(Class<?> clazz) throws ClassNotFoundException { String className; if (clazz.isAnnotationPresent(Contract.class)) { className = clazz.getAnnotation(Contract.class).contractClassName(); if (className == null || className.isEmpty()) { ...
Helper to get contract class and relevent fields. @author SNI
getContractClassForClass
java
stephanenicolas/robospice
extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
Apache-2.0
public static Uri getContentUri(Class<?> contractClass) throws IllegalAccessException, NoSuchFieldException { return (Uri) contractClass.getField("CONTENT_URI").get(null); }
Helper to get contract class and relevent fields. @author SNI
getContentUri
java
stephanenicolas/robospice
extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
Apache-2.0
public static int getContentUriPatternMany(Class<?> contractClass) throws IllegalAccessException, NoSuchFieldException { return contractClass.getField("CONTENT_URI_PATTERN_MANY").getInt(null); }
Helper to get contract class and relevent fields. @author SNI
getContentUriPatternMany
java
stephanenicolas/robospice
extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
Apache-2.0
public static int getContentUriPatternOne(Class<?> contractClass) throws IllegalAccessException, NoSuchFieldException { return contractClass.getField("CONTENT_URI_PATTERN_ONE").getInt(null); }
Helper to get contract class and relevent fields. @author SNI
getContentUriPatternOne
java
stephanenicolas/robospice
extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider/src/main/java/com/octo/android/robospice/persistence/ormlite/ContractHelper.java
Apache-2.0
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("id=").append(id); sb.append(", ").append("string=").append(string); sb.append(", ").append("millis=").append(millis); SimpleDateFormat dateFormatter = new SimpleDateFormat( "MM...
A simple demonstration object we are creating and persisting to the database.
toString
java
stephanenicolas/robospice
extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider-test/src/main/java/com/octo/android/robospice/ormlite/test/model/SimpleData.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-content-provider-parent/robospice-ormlite-content-provider-test/src/main/java/com/octo/android/robospice/ormlite/test/model/SimpleData.java
Apache-2.0
@Override public T loadDataFromCache(Object cacheKey, long maxTimeInCache) throws CacheLoadingException { T result = null; try { CacheEntry cacheEntry = databaseHelper.queryCacheKeyForIdFromDatabase(String.valueOf(cacheKey)); if (cacheEntry == null) { return ...
@param application the android context needed to access android file system or databases to store.
loadDataFromCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public T saveDataToCacheAndReturnData(final T data, final Object cacheKey) throws CacheSavingException { try { dao.callBatchTasks(new Callable<Void>() { @Override public Void call() throws Exception { try { dat...
@param application the android context needed to access android file system or databases to store.
saveDataToCacheAndReturnData
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public Void call() throws Exception { try { databaseHelper.createOrUpdateInDatabase(data, getHandledClass()); saveAllForeignObjectsToCache(data); Object id = getIdField(data.getClass()).extractJavaField...
@param application the android context needed to access android file system or databases to store.
call
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public boolean isDataInCache(Object cacheKey, long maxTimeInCache) { try { CacheEntry cacheEntry = databaseHelper.queryCacheKeyForIdFromDatabase(String.valueOf(cacheKey)); if (cacheEntry == null) { return false; } long timeInCache = S...
@param application the android context needed to access android file system or databases to store.
isDataInCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public long getCreationDateInCache(Object cacheKey) throws CacheLoadingException { CacheEntry cacheEntry = null; try { cacheEntry = databaseHelper.queryCacheKeyForIdFromDatabase(String.valueOf(cacheKey)); } catch (SQLException e) { throw new CacheLoadingExce...
@param application the android context needed to access android file system or databases to store.
getCreationDateInCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@SuppressWarnings({ "unchecked", "rawtypes" }) protected <E> void saveAllForeignObjectsToCache(E data) throws SQLException, IllegalAccessException, InvocationTargetException { // copy children on memory // set children to null on parents so that we can save the parent // without cascade ...
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
saveAllForeignObjectsToCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public boolean removeDataFromCache(Object cacheKey) { try { String id = cacheKey.toString(); CacheEntry cacheEntry = databaseHelper.queryCacheKeyForIdFromDatabase(id); if (cacheEntry == null) { return false; } Class<?> cla...
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
removeDataFromCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public void removeAllDataFromCache() { try { databaseHelper.clearTableFromDataBase(getHandledClass()); databaseHelper.clearTableFromDataBase(CacheEntry.class); } catch (SQLException e) { Ln.d(e, "SQL Error"); } }
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
removeAllDataFromCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public List<T> loadAllDataFromCache() throws CacheLoadingException { try { List<CacheEntry> listCacheEntry = databaseHelper.queryForAllFromDatabase(CacheEntry.class); List<T> listObjectInCache = new ArrayList<T>(); for (CacheEntry cacheEntry : listCacheEntry) { ...
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
loadAllDataFromCache
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
@Override public List<Object> getAllCacheKeys() { try { List<CacheEntry> listCacheEntry = databaseHelper.queryForAllFromDatabase(CacheEntry.class); List<Object> listCacheKey = new ArrayList<Object>(); for (CacheEntry cacheEntry : listCacheEntry) { listCach...
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
getAllCacheKeys
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
protected FieldType getIdField(Class clazz) throws SQLException { DatabaseTableConfig config = getDatabaseTableConfig(clazz); FieldType[] fieldTypes = config.getFieldTypes(databaseHelper.getConnectionSource().getDatabaseType()); FieldType idFieldType = null; for (FieldType fieldType : f...
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
getIdField
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
protected DatabaseTableConfig getDatabaseTableConfig(Class clazz) throws SQLException { DatabaseTableConfig config = mTableConfigs.get(clazz); if (config == null) { config = DatabaseTableConfigUtil.fromClass(databaseHelper.getConnectionSource(), clazz); if (config != null) { ...
During this operation, we must save a new POJO (parent) into the database. The problem is that is the POJO contains children POJOs, then saving the parent would not work as the parent must exist in the database prior to saving the children. SO : <ul> <li>we copy the children into memory, <li>put the children to null on...
getDatabaseTableConfig
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/InDatabaseObjectPersister.java
Apache-2.0
public static String getCacheKeyForId(String id, Class<?> clazz) { return clazz.getSimpleName() + "_" + id.toString(); }
Helper class which creates/updates our database and provides the DAOs.
getCacheKeyForId
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
Apache-2.0
public static String getIdForCacheKey(String cacheKey) { return cacheKey.substring(cacheKey.indexOf('_') + 1); }
Helper class which creates/updates our database and provides the DAOs.
getIdForCacheKey
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
Apache-2.0
public <T> void updateObjectInDatabase(T modelObject, Class<T> modelObjectClass) throws SQLException { if (modelObject != null) { Dao<T, ?> dao = getDao(modelObjectClass); dao.update(modelObject); } }
Helper class which creates/updates our database and provides the DAOs.
updateObjectInDatabase
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
Apache-2.0
public <T> void refreshFromDatabase(T modelObject, Class<T> modelObjectClass) throws SQLException { if (modelObject != null) { Dao<T, ?> dao = getDao(modelObjectClass); dao.refresh(modelObject); } }
Helper class which creates/updates our database and provides the DAOs.
refreshFromDatabase
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
Apache-2.0
public <T> void createOrUpdateInDatabase(T modelObject, Class<T> modelObjectClass) throws SQLException { if (modelObject != null) { Dao<T, ?> dao = getDao(modelObjectClass); dao.createOrUpdate(modelObject); } }
Helper class which creates/updates our database and provides the DAOs.
createOrUpdateInDatabase
java
stephanenicolas/robospice
extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
https://github.com/stephanenicolas/robospice/blob/master/extensions/robospice-ormlite-parent/robospice-ormlite/src/main/java/com/octo/android/robospice/persistence/ormlite/RoboSpiceDatabaseHelper.java
Apache-2.0