public static BasePlayer openFullPlayer(Context context, Class<? extends BasePlayer> _class, DataSource dataSource, int orientation) { return openFullPlayer(context, _class, dataSource, orientation, ScreenType.SCREEN_TYPE_ADAPTER); }
public static BasePlayer openTinyPlayer(Context context, Class<? extends BasePlayer> _class, String url, String title, String cover) { return openTinyPlayer(context, _class, url, title, cover, ScreenType.SCREEN_TYPE_ADAPTER); }
@Override public void run() { long position = getCurrentPositionWhenPlaying(); long duration = getDuration(); int progress = (int) (position * 100 / (duration == 0 ? 1 : duration)); onProgress(progress, position, duration); } });
@Override public void onBackPressed() { if (Player.backPress()) return; super.onBackPressed(); } }
public Player(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs); }
@Override public void run() { if (playerState == PLAYER_STATE_PLAYING || playerState == PLAYER_STATE_PAUSE) { post(new Runnable() { @Override public void run() { long position = getCurrentPositionWhenPlaying(); long duration = getDuration(); int progress = (int) (position * 100 / (duration == 0 ? 1 : duration)); onProgress(progress, position, duration); } }); } } }
@Override public void onActivityPaused(Activity activity) { Player.pause(); hashCode = activity.hashCode(); }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (containerMode == CONTAINER_MODE_FULLSCREEN || containerMode == CONTAINER_MODE_TINY) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; } if (widthRatio != 0 && heightRatio != 0) { int specWidth = MeasureSpec.getSize(widthMeasureSpec); int specHeight = (int) ((specWidth * (float) heightRatio) / widthRatio); setMeasuredDimension(specWidth, specHeight); int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(specWidth, MeasureSpec.EXACTLY); int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(specHeight, MeasureSpec.EXACTLY); getChildAt(0).measure(childWidthMeasureSpec, childHeightMeasureSpec); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }
@Override public void onBackPressed() { if (Player.backPress()) return; super.onBackPressed(); }
public Player(Context context) { super(context); init(context, null); }
public void onFullPlayClick() { Player.openFullPlayer(this, IPlayer.class, Constant.url[0], Constant.title[0], Constant.img[0]); }
public static BasePlayer openTinyPlayer(Context context, Class<? extends BasePlayer> _class, String url, String title, String cover, ScreenType type) { return openTinyPlayer(context, _class, url, title, cover, type, 0, 0); }
@Override public void onBackPressed() { if (Player.backPress()) return; super.onBackPressed(); }
public static BasePlayer openFullPlayer(Context context, Class<? extends BasePlayer> _class, String url, String title, String cover) { return openFullPlayer(context, _class, url, title, cover, ActivityInfo.SCREEN_ORIENTATION_SENSOR); }
public void onTinyPlayClick() { Player.openTinyPlayer(this, IPlayer.class, Constant.url[0], Constant.title[0], Constant.img[0]); }
} @Override public void onBackPressed() { if (Player.backPress()) return; super.onBackPressed(); } }
public static BasePlayer openFullPlayer(Context context, Class<? extends BasePlayer> _class, String url, String title, String cover, int orientation, ScreenType type) { return openFullPlayer(context, _class, new DataSource(url, title, cover), orientation, type); }
@Override public void onBackPressed() { if (Player.backPress()) return; super.onBackPressed(); } }
public static BasePlayer openFullPlayer(Context context, Class<? extends BasePlayer> _class, String url, String title, String cover, int orientation) { return openFullPlayer(context, _class, new DataSource(url, title, cover), orientation); }
@Override public void onBackPressed() { if (Player.backPress()) return; super.onBackPressed(); } }