|
|
|
|
@ -4,6 +4,7 @@ import android.animation.Animator; |
|
|
|
|
import android.animation.AnimatorListenerAdapter; |
|
|
|
|
import android.animation.IntEvaluator; |
|
|
|
|
import android.animation.ObjectAnimator; |
|
|
|
|
import android.annotation.SuppressLint; |
|
|
|
|
import android.content.Context; |
|
|
|
|
import android.net.Uri; |
|
|
|
|
import android.os.CountDownTimer; |
|
|
|
|
@ -427,7 +428,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
UrlHttpUtil.get(url, new CallBackUtil.CallBackString() { |
|
|
|
|
public void onFailure(int i, String str) { |
|
|
|
|
showEpg(date, new ArrayList()); |
|
|
|
|
// showBottomEpg();
|
|
|
|
|
showBottomEpg(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void onResponse(String paramString) { |
|
|
|
|
@ -452,36 +453,43 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
String savedEpgKey = channelName + "_" + liveEpgDateAdapter.getItem(liveEpgDateAdapter.getSelectedIndex()).getDatePresented(); |
|
|
|
|
if (!hsEpg.contains(savedEpgKey)) |
|
|
|
|
hsEpg.put(savedEpgKey, arrayList); |
|
|
|
|
// showBottomEpg();
|
|
|
|
|
showBottomEpg(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//显示底部EPG
|
|
|
|
|
@SuppressLint("SetTextI18n") |
|
|
|
|
private void showBottomEpg() { |
|
|
|
|
if (isSHIYI) |
|
|
|
|
return; |
|
|
|
|
if (channel_Name.getChannelName() != null) { |
|
|
|
|
((TextView) findViewById(R.id.tv_channel_bar_name)).setText(channel_Name.getChannelName()); |
|
|
|
|
((TextView) findViewById(R.id.tv_channel_bottom_number)).setText("" + channel_Name.getChannelNum()); |
|
|
|
|
tip_chname.setText(channel_Name.getChannelName()); |
|
|
|
|
tv_channelnum.setText("" + channel_Name.getChannelNum()); |
|
|
|
|
TextView tv_current_program_name = findViewById(R.id.tv_current_program_name); |
|
|
|
|
TextView tv_next_program_name = findViewById(R.id.tv_next_program_name); |
|
|
|
|
tip_epg1.setText("暂无信息"); |
|
|
|
|
((TextView) findViewById(R.id.tv_current_program_name)).setText(""); |
|
|
|
|
tip_epg2.setText("开源测试软件,请勿商用以及播放违法内容"); |
|
|
|
|
((TextView) findViewById(R.id.tv_next_program_name)).setText(""); |
|
|
|
|
tv_current_program_name.setText(""); |
|
|
|
|
tip_epg2.setText("开源测试软件"); |
|
|
|
|
tv_next_program_name.setText(""); |
|
|
|
|
String savedEpgKey = channel_Name.getChannelName() + "_" + liveEpgDateAdapter.getItem(liveEpgDateAdapter.getSelectedIndex()).getDatePresented(); |
|
|
|
|
if (hsEpg.containsKey(savedEpgKey)) { |
|
|
|
|
String[] epgInfo = EpgUtil.getEpgInfo(channel_Name.getChannelName()); |
|
|
|
|
updateChannelIcon(channel_Name.getChannelName(), epgInfo == null ? null : epgInfo[0]); |
|
|
|
|
ArrayList arrayList = (ArrayList) hsEpg.get(savedEpgKey); |
|
|
|
|
if (arrayList != null && arrayList.size() > 0) { |
|
|
|
|
Date date = new Date(); |
|
|
|
|
int size = arrayList.size() - 1; |
|
|
|
|
while (size >= 0) { |
|
|
|
|
if (new Date().compareTo(((Epginfo) arrayList.get(size)).startdateTime) >= 0) { |
|
|
|
|
tip_epg1.setText(((Epginfo) arrayList.get(size)).start + "--" + ((Epginfo) arrayList.get(size)).end); |
|
|
|
|
((TextView) findViewById(R.id.tv_current_program_name)).setText(((Epginfo) arrayList.get(size)).title); |
|
|
|
|
if (date.after(((Epginfo) arrayList.get(size)).startdateTime) & date.before(((Epginfo) arrayList.get(size)).enddateTime)) { |
|
|
|
|
tip_epg1.setText(((Epginfo) arrayList.get(size)).start + " - " + ((Epginfo) arrayList.get(size)).end); |
|
|
|
|
tv_current_program_name.setText(((Epginfo) arrayList.get(size)).title); |
|
|
|
|
if (size != arrayList.size() - 1) { |
|
|
|
|
tip_epg2.setText(((Epginfo) arrayList.get(size + 1)).start + "--" + ((Epginfo) arrayList.get(size)).end); |
|
|
|
|
((TextView) findViewById(R.id.tv_next_program_name)).setText(((Epginfo) arrayList.get(size + 1)).title); |
|
|
|
|
tip_epg2.setText(((Epginfo) arrayList.get(size + 1)).start + " - " + ((Epginfo) arrayList.get(size + 1)).end); |
|
|
|
|
tv_next_program_name.setText(((Epginfo) arrayList.get(size + 1)).title); |
|
|
|
|
} else { |
|
|
|
|
tip_epg2.setText("00:00 - 23:59"); |
|
|
|
|
tv_next_program_name.setText("No Information"); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} else { |
|
|
|
|
@ -1512,19 +1520,18 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
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(); |
|
|
|
|
return; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
liveSettingItemAdapter.selectItem(position, true, true); |
|
|
|
|
Hawk.put(HawkConfig.LIVE_GROUP_INDEX, position); |
|
|
|
|
ApiConfig.get().loadLiveApi(livesOBJ); |
|
|
|
|
if (mVideoView != null) { |
|
|
|
|
mVideoView.release(); |
|
|
|
|
mVideoView.resume(); |
|
|
|
|
mVideoView=null; |
|
|
|
|
} |
|
|
|
|
recreate(); |
|
|
|
|
@ -1650,51 +1657,7 @@ public class LivePlayActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initLiveSettingGroupList() { |
|
|
|
|
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++) { |
|
|
|
|
LiveSettingGroup liveSettingGroup = new LiveSettingGroup(); |
|
|
|
|
ArrayList<LiveSettingItem> liveSettingItemList = new ArrayList<>(); |
|
|
|
|
liveSettingGroup.setGroupIndex(i); |
|
|
|
|
liveSettingGroup.setGroupName(groupNames.get(i)); |
|
|
|
|
for (int j = 0; j < itemsArrayList.get(i).size(); j++) { |
|
|
|
|
LiveSettingItem liveSettingItem = new LiveSettingItem(); |
|
|
|
|
liveSettingItem.setItemIndex(j); |
|
|
|
|
liveSettingItem.setItemName(itemsArrayList.get(i).get(j)); |
|
|
|
|
liveSettingItemList.add(liveSettingItem); |
|
|
|
|
} |
|
|
|
|
liveSettingGroup.setLiveSettingItems(liveSettingItemList); |
|
|
|
|
liveSettingGroupList.add(liveSettingGroup); |
|
|
|
|
} |
|
|
|
|
liveSettingGroupList=ApiConfig.get().getLiveSettingGroupList(); |
|
|
|
|
liveSettingGroupList.get(3).getLiveSettingItems().get(Hawk.get(HawkConfig.LIVE_CONNECT_TIMEOUT, 1)).setItemSelected(true); |
|
|
|
|
liveSettingGroupList.get(4).getLiveSettingItems().get(0).setItemSelected(Hawk.get(HawkConfig.LIVE_SHOW_TIME, false)); |
|
|
|
|
liveSettingGroupList.get(4).getLiveSettingItems().get(1).setItemSelected(Hawk.get(HawkConfig.LIVE_SHOW_NET_SPEED, false)); |
|
|
|
|
|