|
|
|
|
@ -59,6 +59,10 @@ import org.greenrobot.eventbus.Subscribe; |
|
|
|
|
import org.greenrobot.eventbus.ThreadMode; |
|
|
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
|
import java.io.ObjectInputStream; |
|
|
|
|
import java.io.ObjectOutputStream; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
@ -106,6 +110,7 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
public String sourceKey; |
|
|
|
|
boolean seriesSelect = false; |
|
|
|
|
private View seriesFlagFocus = null; |
|
|
|
|
private boolean isReverse; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected int getLayoutResID() { |
|
|
|
|
@ -152,6 +157,7 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
mGridViewFlag.setLayoutManager(new V7LinearLayoutManager(this.mContext, 0, false)); |
|
|
|
|
seriesFlagAdapter = new SeriesFlagAdapter(); |
|
|
|
|
mGridViewFlag.setAdapter(seriesFlagAdapter); |
|
|
|
|
isReverse = false; |
|
|
|
|
if (showPreview) { |
|
|
|
|
playFragment = new PlayFragment(); |
|
|
|
|
getSupportFragmentManager().beginTransaction().add(R.id.previewPlayer, playFragment).commit(); |
|
|
|
|
@ -164,7 +170,15 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
public void onClick(View v) { |
|
|
|
|
if (vodInfo != null && vodInfo.seriesMap.size() > 0) { |
|
|
|
|
vodInfo.reverseSort = !vodInfo.reverseSort; |
|
|
|
|
isReverse = !isReverse; |
|
|
|
|
// if (vodInfo.seriesMap.get(vodInfo.playFlag).size() > vodInfo.playIndex) {
|
|
|
|
|
// vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = false;
|
|
|
|
|
// }
|
|
|
|
|
vodInfo.reverse(); |
|
|
|
|
// if (vodInfo.seriesMap.get(preFlag).size() > vodInfo.playIndex) {
|
|
|
|
|
// vodInfo.seriesMap.get(preFlag).get(vodInfo.playIndex).selected = false;
|
|
|
|
|
// }
|
|
|
|
|
preFlag = ""; |
|
|
|
|
insertVod(sourceKey, vodInfo); |
|
|
|
|
seriesAdapter.notifyDataSetChanged(); |
|
|
|
|
} |
|
|
|
|
@ -248,6 +262,10 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
VodInfo.VodSeriesFlag flag = vodInfo.seriesFlags.get(position); |
|
|
|
|
flag.selected = true; |
|
|
|
|
// clean pre flag select status
|
|
|
|
|
if (vodInfo.seriesMap.get(vodInfo.playFlag).size() > vodInfo.playIndex) { |
|
|
|
|
vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = false; |
|
|
|
|
} |
|
|
|
|
vodInfo.playFlag = newFlag; |
|
|
|
|
seriesFlagAdapter.notifyItemChanged(position); |
|
|
|
|
refreshList(); |
|
|
|
|
@ -257,17 +275,19 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onItemPreSelected(TvRecyclerView parent, View itemView, int position) { |
|
|
|
|
seriesSelect = false; |
|
|
|
|
// seriesSelect = false;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onItemSelected(TvRecyclerView parent, View itemView, int position) { |
|
|
|
|
refresh(itemView, position); |
|
|
|
|
// if(isReverse)vodInfo.reverse();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onItemClick(TvRecyclerView parent, View itemView, int position) { |
|
|
|
|
refresh(itemView, position); |
|
|
|
|
// if(isReverse)vodInfo.reverse();
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
seriesAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { |
|
|
|
|
@ -285,12 +305,12 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
reload = true; |
|
|
|
|
} |
|
|
|
|
//解决当前集不刷新的BUG
|
|
|
|
|
if(!vodInfo.playFlag.equals(preFlag)) { |
|
|
|
|
if (!vodInfo.playFlag.equals(preFlag)) { |
|
|
|
|
reload = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// seriesAdapter.getData().get(vodInfo.playIndex).selected = true;
|
|
|
|
|
// seriesAdapter.notifyItemChanged(vodInfo.playIndex);
|
|
|
|
|
seriesAdapter.getData().get(vodInfo.playIndex).selected = true; |
|
|
|
|
seriesAdapter.notifyItemChanged(vodInfo.playIndex); |
|
|
|
|
//选集全屏 想选集不全屏的注释下面一行
|
|
|
|
|
if (showPreview && !fullWindows) toggleFullPreview(); |
|
|
|
|
if (!showPreview || reload) jumpToPlay(); |
|
|
|
|
@ -312,6 +332,26 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
bundle.putString("sourceKey", sourceKey); |
|
|
|
|
bundle.putSerializable("VodInfo", vodInfo); |
|
|
|
|
if (showPreview) { |
|
|
|
|
if (previewVodInfo == null) { |
|
|
|
|
try { |
|
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
|
|
|
|
ObjectOutputStream oos = new ObjectOutputStream(bos); |
|
|
|
|
oos.writeObject(vodInfo); |
|
|
|
|
oos.flush(); |
|
|
|
|
oos.close(); |
|
|
|
|
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); |
|
|
|
|
previewVodInfo = (VodInfo) ois.readObject(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (previewVodInfo != null) { |
|
|
|
|
previewVodInfo.playerCfg = vodInfo.playerCfg; |
|
|
|
|
previewVodInfo.playFlag = vodInfo.playFlag; |
|
|
|
|
previewVodInfo.playIndex = vodInfo.playIndex; |
|
|
|
|
previewVodInfo.seriesMap = vodInfo.seriesMap; |
|
|
|
|
bundle.putSerializable("VodInfo", previewVodInfo); |
|
|
|
|
} |
|
|
|
|
playFragment.setData(bundle); |
|
|
|
|
} else { |
|
|
|
|
jumpActivity(PlayActivity.class, bundle); |
|
|
|
|
@ -325,7 +365,14 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (vodInfo.seriesMap.get(vodInfo.playFlag) != null) { |
|
|
|
|
vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = true; |
|
|
|
|
boolean canSelect = true; |
|
|
|
|
for (int j = 0; j < vodInfo.seriesMap.get(vodInfo.playFlag).size(); j++) { |
|
|
|
|
if(vodInfo.seriesMap.get(vodInfo.playFlag).get(j).selected == true){ |
|
|
|
|
canSelect = false; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(canSelect)vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
seriesAdapter.setNewData(vodInfo.seriesMap.get(vodInfo.playFlag)); |
|
|
|
|
@ -479,16 +526,16 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
if (event.obj != null) { |
|
|
|
|
if (event.obj instanceof Integer) { |
|
|
|
|
int index = (int) event.obj; |
|
|
|
|
// if (index != vodInfo.playIndex) {
|
|
|
|
|
seriesAdapter.getData().get(vodInfo.playIndex).selected = false; |
|
|
|
|
seriesAdapter.notifyItemChanged(vodInfo.playIndex); |
|
|
|
|
seriesAdapter.getData().get(index).selected = true; |
|
|
|
|
seriesAdapter.notifyItemChanged(index); |
|
|
|
|
mGridView.setSelection(index); |
|
|
|
|
vodInfo.playIndex = index; |
|
|
|
|
//保存历史
|
|
|
|
|
insertVod(sourceKey, vodInfo); |
|
|
|
|
// }
|
|
|
|
|
if (index != vodInfo.playIndex) { |
|
|
|
|
seriesAdapter.getData().get(vodInfo.playIndex).selected = false; |
|
|
|
|
seriesAdapter.notifyItemChanged(vodInfo.playIndex); |
|
|
|
|
seriesAdapter.getData().get(index).selected = true; |
|
|
|
|
seriesAdapter.notifyItemChanged(index); |
|
|
|
|
mGridView.setSelection(index); |
|
|
|
|
vodInfo.playIndex = index; |
|
|
|
|
//保存历史
|
|
|
|
|
insertVod(sourceKey, vodInfo); |
|
|
|
|
} |
|
|
|
|
} else if (event.obj instanceof JSONObject) { |
|
|
|
|
vodInfo.playerCfg = ((JSONObject) event.obj).toString(); |
|
|
|
|
//保存历史
|
|
|
|
|
@ -689,6 +736,7 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// preview
|
|
|
|
|
VodInfo previewVodInfo = null; |
|
|
|
|
boolean showPreview = Hawk.get(HawkConfig.SHOW_PREVIEW, false);; // true 开启 false 关闭
|
|
|
|
|
boolean fullWindows = false; |
|
|
|
|
ViewGroup.LayoutParams windowsPreview = null; |
|
|
|
|
|