Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions playerview/src/main/java/com/dl7/player/media/IjkPlayerView.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.dl7.player.media;

import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
Expand Down Expand Up @@ -101,6 +102,19 @@
*/
public class IjkPlayerView extends FrameLayout implements View.OnClickListener {

private boolean showFullScreen = true;

public void setShowFullScreen(boolean showFullScreen) {
this.showFullScreen = showFullScreen;
if (showFullScreen) {
mIvFullscreen.setVisibility(VISIBLE);
mIvBack.setVisibility(VISIBLE);
} else {
mIvFullscreen.setVisibility(INVISIBLE);
mIvBack.setVisibility(INVISIBLE);
}
}

// 进度条最大值
private static final int MAX_VIDEO_SEEK = 1000;
// 默认隐藏控制栏时间
Expand Down Expand Up @@ -332,8 +346,17 @@ private void _initMediaPlayer() {
mMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
// 亮度
try {
int e = Settings.System.getInt(mAttachActivity.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
float progress = 1.0F * (float) e / 255.0F;
float progress;
ContentResolver cr = mAttachActivity.getContentResolver();
boolean autoBrightness = Settings.System.getInt(cr, Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
if (autoBrightness) {
//[-1,1]
progress = Settings.System.getFloat(cr, "screen_auto_brightness_adj");
} else {
//[0,255]
int e = Settings.System.getInt(cr, Settings.System.SCREEN_BRIGHTNESS);
progress = 1.0F * (float) e / 255.0F;
}
WindowManager.LayoutParams layout = mAttachActivity.getWindow().getAttributes();
layout.screenBrightness = progress;
mAttachActivity.getWindow().setAttributes(layout);
Expand Down Expand Up @@ -2434,6 +2457,9 @@ private void _toggleDanmakuView(boolean isShow) {
* 从弹幕编辑状态复原界面
*/
private void _recoverScreen() {
if (!mIsEnableDanmaku) {
return;
}
// 清除焦点
mEditDanmakuLayout.clearFocus();
mEditDanmakuLayout.setVisibility(GONE);
Expand Down