Skip to content

Commit

Permalink
mod 兼容Android4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
KLOSWC committed Mar 1, 2024
1 parent a4addd3 commit ab0d441
Show file tree
Hide file tree
Showing 66 changed files with 5,030 additions and 66 deletions.
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ android {
exclude 'META-INF/DEPENDENCIES'
}

buildTypes {
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled true
ndk {
abiFilters 'armeabi-v7a'
abiFilters 'armeabi-v7a'
}
}
}
Expand All @@ -47,7 +47,7 @@ android {
checkReleaseBuilds false
abortOnError false
}

buildFeatures {
dataBinding = true
}
Expand Down Expand Up @@ -98,6 +98,7 @@ dependencies {
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'net.sourceforge.streamsupport:android-retrofuture:1.7.4'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.annotation:annotation:1.6.0'
implementation "androidx.media3:media3-exoplayer:1.1.1"
implementation "androidx.media3:media3-exoplayer-dash:1.1.1"
Expand All @@ -108,7 +109,7 @@ dependencies {
implementation "com.aliyun.sdk.android:AliyunPlayer:6.9.0-full"
//implementation 'com.alivc.conan:AlivcConan:0.9.5'
implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.7'
implementation 'xyz.doikki.android.dkplayer:videocache:3.3.7'
implementation 'xyz.doikki.android.dkplayer:videocache:3.3.7'

implementation('org.xwalk:xwalk_shared_library:23.53.589.4') {
exclude group: 'com.android.support'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ public boolean isTop() {

public void scrollTop() {
isTop = true;
mGridView.scrollToPosition(0);
if (mGridView != null) {
mGridView.scrollToPosition(0);
}
}

public void showFilter() {
Expand Down
32 changes: 28 additions & 4 deletions app/src/main/java/xyz/doikki/videoplayer/player/BaseVideoView.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.blankj.utilcode.util.ToastUtils;
import com.github.tvbox.osc.R;

import java.io.IOException;
Expand Down Expand Up @@ -191,6 +192,7 @@ public void start() {

/**
* 第一次播放
*
* @return 是否成功开始播放
*/
protected boolean startPlay() {
Expand Down Expand Up @@ -247,10 +249,31 @@ protected boolean isLocalDataSource() {
* 初始化播放器
*/
protected void initPlayer() {
mMediaPlayer = mPlayerFactory.createPlayer(getContext());
mMediaPlayer.setPlayerEventListener(this);
setInitOptions();
mMediaPlayer.initPlayer();
try {
mMediaPlayer = mPlayerFactory.createPlayer(getContext());
mMediaPlayer.setPlayerEventListener(this);
setInitOptions();
mMediaPlayer.initPlayer();
} catch (Throwable e) {
if (mMediaPlayer != null) {
try {
mMediaPlayer.release();
} catch (Throwable ignored) {
}
}
if (!(mPlayerFactory instanceof AndroidMediaPlayerFactory)) {
ToastUtils.showShort("播放创建失败!使用系统播放器进行播放!");
setPlayerFactory(AndroidMediaPlayerFactory.create());
} else {
ToastUtils.showShort("播放创建失败!");//一般是不太可能默认播放器也失败的
getActivity().finish();
return;
}
mMediaPlayer = mPlayerFactory.createPlayer(getContext());
mMediaPlayer.setPlayerEventListener(this);
setInitOptions();
mMediaPlayer.initPlayer();
}
setOptions();
}

Expand Down Expand Up @@ -1012,6 +1035,7 @@ protected void setPlayerState(int playerState) {
*/
public interface OnStateChangeListener {
void onPlayerStateChanged(int playerState);

void onPlayStateChanged(int playState);
}

Expand Down
16 changes: 16 additions & 0 deletions app/src/main/res/drawable-v21/button_detail_collect.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape>
<corners android:radius="@dimen/vs_20" />
<solid android:color="?attr/color_theme" />
<stroke android:width="2mm" android:color="@android:color/white" />
</shape>
</item>
<item android:state_focused="false">
<shape>
<corners android:radius="@dimen/vs_20" />
<solid android:color="?attr/color_theme" />
</shape>
</item>
</selector>
15 changes: 15 additions & 0 deletions app/src/main/res/drawable-v21/button_home_sort_focus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape>
<corners android:radius="20mm"/>
<solid android:color="?attr/color_theme_50"/>
</shape>
</item>
<item android:state_focused="false">
<shape>
<corners android:radius="20mm"/>
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</selector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable-v21/item_right_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/color_theme_40"/>
<corners android:radius="10dp"/>
</shape>
19 changes: 19 additions & 0 deletions app/src/main/res/drawable-v21/play_progress_horizontal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="@color/color_FFFFFF_80" />
<corners android:radius="2.0dip" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip
android:clipOrientation="horizontal"
android:gravity="left">
<shape>
<solid android:color="?attr/color_theme_80" />
<corners android:radius="2.0dip" />
</shape>
</clip>
</item>
</layer-list>
19 changes: 19 additions & 0 deletions app/src/main/res/drawable-v21/play_progress_vertical.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="@color/color_FFFFFF_80" />
<corners android:radius="2.0dip" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip
android:clipOrientation="vertical"
android:gravity="bottom">
<shape>
<solid android:color="?attr/color_theme_80" />
<corners android:radius="2.0dip" />
</shape>
</clip>
</item>
</layer-list>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable-v21/set_hm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="?attr/color_theme"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,5.69l5,4.5V18h-2v-6H9v6H7v-7.81l5,-4.5M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable-v21/set_play.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="?attr/color_theme"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M10,16.5l6,-4.5 -6,-4.5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable-v21/set_setting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="?attr/color_theme"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98 0,-0.34 -0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.09,-0.16 -0.26,-0.25 -0.44,-0.25 -0.06,0 -0.12,0.01 -0.17,0.03l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.06,-0.02 -0.12,-0.03 -0.18,-0.03 -0.17,0 -0.34,0.09 -0.43,0.25l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98 0,0.33 0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.09,0.16 0.26,0.25 0.44,0.25 0.06,0 0.12,-0.01 0.17,-0.03l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.06,0.02 0.12,0.03 0.18,0.03 0.17,0 0.34,-0.09 0.43,-0.25l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM17.45,11.27c0.04,0.31 0.05,0.52 0.05,0.73 0,0.21 -0.02,0.43 -0.05,0.73l-0.14,1.13 0.89,0.7 1.08,0.84 -0.7,1.21 -1.27,-0.51 -1.04,-0.42 -0.9,0.68c-0.43,0.32 -0.84,0.56 -1.25,0.73l-1.06,0.43 -0.16,1.13 -0.2,1.35h-1.4l-0.19,-1.35 -0.16,-1.13 -1.06,-0.43c-0.43,-0.18 -0.83,-0.41 -1.23,-0.71l-0.91,-0.7 -1.06,0.43 -1.27,0.51 -0.7,-1.21 1.08,-0.84 0.89,-0.7 -0.14,-1.13c-0.03,-0.31 -0.05,-0.54 -0.05,-0.74s0.02,-0.43 0.05,-0.73l0.14,-1.13 -0.89,-0.7 -1.08,-0.84 0.7,-1.21 1.27,0.51 1.04,0.42 0.9,-0.68c0.43,-0.32 0.84,-0.56 1.25,-0.73l1.06,-0.43 0.16,-1.13 0.2,-1.35h1.39l0.19,1.35 0.16,1.13 1.06,0.43c0.43,0.18 0.83,0.41 1.23,0.71l0.91,0.7 1.06,-0.43 1.27,-0.51 0.7,1.21 -1.07,0.85 -0.89,0.7 0.14,1.13zM12,8c-2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,14c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z"/>
</vector>
27 changes: 27 additions & 0 deletions app/src/main/res/drawable-v21/shape_live_focus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>
27 changes: 27 additions & 0 deletions app/src/main/res/drawable-v21/shape_live_select.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</selector>
22 changes: 22 additions & 0 deletions app/src/main/res/drawable-v21/shape_player_control_vod_seek.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="@color/color_FFFFFF_40" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="@color/color_3D3D3D_50" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="?attr/color_theme" />
</shape>
</clip>
</item>
</layer-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="?attr/color_theme_80" />
<size
android:width="@dimen/vs_20"
android:height="@dimen/vs_20" />
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="?attr/color_theme" />
<size
android:width="@dimen/vs_20"
android:height="@dimen/vs_20" />
</shape>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable-v21/shape_search_clearall.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="?attr/color_theme_70"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,19L6,19c-0.55,0 -1,-0.45 -1,-1L5,6c0,-0.55 0.45,-1 1,-1h12c0.55,0 1,0.45 1,1v12c0,0.55 -0.45,1 -1,1zM19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>
27 changes: 27 additions & 0 deletions app/src/main/res/drawable-v21/shape_source_flag_focus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40" />
</shape>
</item>
<item android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="@color/color_3D3D3D_50" />
</shape>
</item>
</selector>
8 changes: 8 additions & 0 deletions app/src/main/res/drawable-v21/shape_source_flag_line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:width="40mm"
android:height="4mm" />
<corners android:radius="2mm" />
<solid android:color="?attr/color_theme"/>
</shape>
27 changes: 27 additions & 0 deletions app/src/main/res/drawable-v21/shape_source_series_focus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40"/>
</shape>
</item>
<item android:state_focused="false" android:state_pressed="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40"/>
</shape>
</item>
<item android:state_focused="true">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="?attr/color_theme_40"/>
</shape>
</item>
<item android:state_focused="false" android:state_pressed="false">
<shape>
<corners android:radius="@dimen/vs_10" />
<solid android:color="@color/color_3D3D3D_45" />
</shape>
</item>
</selector>
Loading

0 comments on commit ab0d441

Please sign in to comment.