|
|
|
|
@ -49,9 +49,7 @@ import com.github.tvbox.osc.ui.adapter.LiveSettingGroupAdapter; |
|
|
|
|
import com.github.tvbox.osc.ui.adapter.LiveSettingItemAdapter; |
|
|
|
|
import com.github.tvbox.osc.ui.adapter.MyEpgAdapter; |
|
|
|
|
import com.github.tvbox.osc.ui.dialog.LivePasswordDialog; |
|
|
|
|
import com.github.tvbox.osc.ui.tv.widget.ChannelListView; |
|
|
|
|
import com.github.tvbox.osc.ui.tv.widget.ViewObj; |
|
|
|
|
import com.github.tvbox.osc.util.EpgNameFuzzyMatch; |
|
|
|
|
import com.github.tvbox.osc.util.EpgUtil; |
|
|
|
|
import com.github.tvbox.osc.util.FastClickCheckUtil; |
|
|
|
|
import com.github.tvbox.osc.util.HawkConfig; |
|
|
|
|
@ -60,9 +58,10 @@ import com.github.tvbox.osc.util.PlayerHelper; |
|
|
|
|
import com.github.tvbox.osc.util.live.TxtSubscribe; |
|
|
|
|
import com.github.tvbox.osc.util.urlhttp.CallBackUtil; |
|
|
|
|
import com.github.tvbox.osc.util.urlhttp.UrlHttpUtil; |
|
|
|
|
import com.google.gson.Gson; |
|
|
|
|
import com.google.gson.JsonArray; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
|
|
import com.google.gson.JsonObject; |
|
|
|
|
import com.lzy.okgo.OkGo; |
|
|
|
|
import com.lzy.okgo.callback.AbsCallback; |
|
|
|
|
import com.lzy.okgo.model.Response; |
|
|
|
|
@ -75,8 +74,6 @@ import org.json.JSONArray; |
|
|
|
|
import org.json.JSONException; |
|
|
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
@ -665,6 +662,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showChannelList() { |
|
|
|
|
if(liveChannelGroupList.isEmpty()) return; |
|
|
|
|
if (tvRightSettingLayout.getVisibility() == View.VISIBLE) { |
|
|
|
|
mHandler.removeCallbacks(mHideSettingLayoutRun); |
|
|
|
|
mHandler.post(mHideSettingLayoutRun); |
|
|
|
|
@ -1181,7 +1179,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
case VideoView.STATE_ERROR: |
|
|
|
|
case VideoView.STATE_PLAYBACK_COMPLETED: |
|
|
|
|
mHandler.removeCallbacks(mConnectTimeoutChangeSourceRun); |
|
|
|
|
mHandler.postDelayed(mConnectTimeoutChangeSourceRun, 6000); |
|
|
|
|
mHandler.postDelayed(mConnectTimeoutChangeSourceRun, 1500); |
|
|
|
|
break; |
|
|
|
|
case VideoView.STATE_PREPARING: |
|
|
|
|
case VideoView.STATE_BUFFERING: |
|
|
|
|
@ -1484,7 +1482,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
case 3://超时换源
|
|
|
|
|
Hawk.put(HawkConfig.LIVE_CONNECT_TIMEOUT, position); |
|
|
|
|
break; |
|
|
|
|
case 4://超时换源
|
|
|
|
|
case 4://偏好设置
|
|
|
|
|
boolean select = false; |
|
|
|
|
switch (position) { |
|
|
|
|
case 0: |
|
|
|
|
@ -1508,6 +1506,23 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
liveSettingItemAdapter.selectItem(position, select, false); |
|
|
|
|
break; |
|
|
|
|
case 5://多源切换
|
|
|
|
|
//TODO
|
|
|
|
|
if(position==Hawk.get(HawkConfig.LIVE_GROUP_INDEX, 0))break; |
|
|
|
|
liveSettingItemAdapter.selectItem(position, true, true); |
|
|
|
|
JsonArray live_groups=Hawk.get(HawkConfig.LIVE_GROUP_LIST,new JsonArray()); |
|
|
|
|
JsonObject livesOBJ = live_groups.get(position).getAsJsonObject(); |
|
|
|
|
String type= livesOBJ.get("type").getAsString(); |
|
|
|
|
if(!type.equals("0")){ |
|
|
|
|
Toast.makeText(App.getInstance(), "暂不支持该直播类型", Toast.LENGTH_SHORT).show(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
Hawk.put(HawkConfig.LIVE_GROUP_INDEX, position); |
|
|
|
|
mVideoView.release(); |
|
|
|
|
ApiConfig.get().loadLiveApi(livesOBJ); |
|
|
|
|
// init();
|
|
|
|
|
recreate(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
mHandler.removeCallbacks(mHideSettingLayoutRun); |
|
|
|
|
mHandler.postDelayed(mHideSettingLayoutRun, 6000); |
|
|
|
|
@ -1516,6 +1531,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
private void initLiveChannelList() { |
|
|
|
|
List<LiveChannelGroup> list = ApiConfig.get().getChannelGroupList(); |
|
|
|
|
if (list.isEmpty()) { |
|
|
|
|
Hawk.put(HawkConfig.LIVE_GROUP_INDEX, 0); |
|
|
|
|
Toast.makeText(App.getInstance(), "频道列表为空", Toast.LENGTH_SHORT).show(); |
|
|
|
|
finish(); |
|
|
|
|
return; |
|
|
|
|
@ -1542,6 +1558,8 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
showLoading(); |
|
|
|
|
|
|
|
|
|
LOG.i("echo-live-url:"+url); |
|
|
|
|
OkGo.<String>get(url).execute(new AbsCallback<String>() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -1575,6 +1593,17 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void onError(Response<String> response) { |
|
|
|
|
Toast.makeText(App.getInstance(), "加载错误,自动回退到主页", Toast.LENGTH_SHORT).show(); |
|
|
|
|
Hawk.put(HawkConfig.LIVE_GROUP_INDEX, 0); |
|
|
|
|
mHandler.post(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
jumpActivity(HomeActivity.class); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1615,18 +1644,35 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initLiveSettingGroupList() { |
|
|
|
|
ArrayList<String> groupNames = new ArrayList<>(Arrays.asList("线路选择", "画面比例", "播放解码", "超时换源", "偏好设置")); |
|
|
|
|
ArrayList<String> groupNames = new ArrayList<>(Arrays.asList("线路选择", "画面比例", "播放解码", "超时换源", "偏好设置", "多源切换")); |
|
|
|
|
ArrayList<ArrayList<String>> itemsArrayList = new ArrayList<>(); |
|
|
|
|
ArrayList<String> sourceItems = new ArrayList<>(); |
|
|
|
|
ArrayList<String> scaleItems = new ArrayList<>(Arrays.asList("默认", "16:9", "4:3", "填充", "原始", "裁剪")); |
|
|
|
|
ArrayList<String> playerDecoderItems = new ArrayList<>(Arrays.asList("系统", "ijk硬解", "ijk软解", "exo")); |
|
|
|
|
ArrayList<String> timeoutItems = new ArrayList<>(Arrays.asList("5s", "10s", "15s", "20s", "25s", "30s")); |
|
|
|
|
ArrayList<String> personalSettingItems = new ArrayList<>(Arrays.asList("显示时间", "显示网速", "换台反转", "跨选分类")); |
|
|
|
|
// ArrayList<String> yumItems = new ArrayList<>(Arrays.asList("线路1", "线路2", "线路3"));
|
|
|
|
|
ArrayList<String> yumItems = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
JsonArray jsonArray = Hawk.get(HawkConfig.LIVE_GROUP_LIST,new JsonArray()); |
|
|
|
|
for (int i=0; i< jsonArray.size();i++) { |
|
|
|
|
JsonObject jsonObject = jsonArray.get(i).getAsJsonObject(); |
|
|
|
|
String name = jsonObject.has("name")?jsonObject.get("name").getAsString():"线路"+(i+1); |
|
|
|
|
yumItems.add(name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
// 捕获任何可能发生的异常
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
itemsArrayList.add(sourceItems); |
|
|
|
|
itemsArrayList.add(scaleItems); |
|
|
|
|
itemsArrayList.add(playerDecoderItems); |
|
|
|
|
itemsArrayList.add(timeoutItems); |
|
|
|
|
itemsArrayList.add(personalSettingItems); |
|
|
|
|
itemsArrayList.add(yumItems); |
|
|
|
|
|
|
|
|
|
liveSettingGroupList.clear(); |
|
|
|
|
for (int i = 0; i < groupNames.size(); i++) { |
|
|
|
|
@ -1648,6 +1694,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
liveSettingGroupList.get(4).getLiveSettingItems().get(1).setItemSelected(Hawk.get(HawkConfig.LIVE_SHOW_NET_SPEED, false)); |
|
|
|
|
liveSettingGroupList.get(4).getLiveSettingItems().get(2).setItemSelected(Hawk.get(HawkConfig.LIVE_CHANNEL_REVERSE, false)); |
|
|
|
|
liveSettingGroupList.get(4).getLiveSettingItems().get(3).setItemSelected(Hawk.get(HawkConfig.LIVE_CROSS_GROUP, false)); |
|
|
|
|
liveSettingGroupList.get(5).getLiveSettingItems().get(Hawk.get(HawkConfig.LIVE_GROUP_INDEX, 0)).setItemSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void loadCurrentSourceList() { |
|
|
|
|
|