Skip to content

Commit

Permalink
-optimised show gprs dialog opportunity
Browse files Browse the repository at this point in the history
  • Loading branch information
tohodog committed Jan 28, 2018
1 parent 7bf4314 commit 95be6a2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public ImageView getCoverImageView() {
//移动网络提示框
@Override
protected boolean showWifiDialog() {
if (!isShowWifiDialog)
if (!isShowWifiDialog || urlMode == 1 || urlMode == 2)
return false;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage(getResources().getString(R.string.tips_not_wifi));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class QSVideoView extends FrameLayout implements IVideoPlayer, IMediaCall
protected boolean isMute;

protected PlayListener playListener;
public int urlMode;
public int urlMode;//0网络 1本地 2直播流


public QSVideoView(Context context) {
Expand Down Expand Up @@ -78,9 +78,8 @@ private void init(Context context) {
public void setUp(String url, Object... objects) {
release();
this.url = url;
urlMode = Util.PaserUrl(url);
setStateAndMode(STATE_NORMAL, currentMode);
if (url.startsWith("file"))
urlMode = 1;
}

@Override
Expand Down
11 changes: 11 additions & 0 deletions qsvideoplayer/src/main/java/org/song/videoplayer/Util.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.song.videoplayer;

import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.ActivityInfo;
Expand Down Expand Up @@ -170,6 +171,16 @@ public static Activity scanForActivity(Context context) {
throw new IllegalStateException("context得不到activity");
}

//url类型 0网络 1本地 2直播流
public static int PaserUrl(String url) {
int mode = 0;
if (url.startsWith("file") || url.startsWith(ContentResolver.SCHEME_CONTENT) || url.startsWith(ContentResolver.SCHEME_ANDROID_RESOURCE))
mode = 1;
if (url.endsWith("m3u8"))//...
mode = 3;
return mode;
}

/**
* 实例化
*/
Expand Down

0 comments on commit 95be6a2

Please sign in to comment.