|
|
|
|
@ -5,12 +5,16 @@ import android.content.Intent; |
|
|
|
|
import android.os.Bundle; |
|
|
|
|
import android.text.Html; |
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
import android.view.KeyEvent; |
|
|
|
|
import android.view.View; |
|
|
|
|
import android.view.ViewGroup; |
|
|
|
|
import android.widget.FrameLayout; |
|
|
|
|
import android.widget.ImageView; |
|
|
|
|
import android.widget.LinearLayout; |
|
|
|
|
import android.widget.TextView; |
|
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
|
|
import androidx.fragment.app.FragmentContainerView; |
|
|
|
|
import androidx.lifecycle.Observer; |
|
|
|
|
import androidx.lifecycle.ViewModelProvider; |
|
|
|
|
|
|
|
|
|
@ -28,6 +32,7 @@ import com.github.tvbox.osc.picasso.RoundTransformation; |
|
|
|
|
import com.github.tvbox.osc.ui.adapter.SeriesAdapter; |
|
|
|
|
import com.github.tvbox.osc.ui.adapter.SeriesFlagAdapter; |
|
|
|
|
import com.github.tvbox.osc.ui.dialog.QuickSearchDialog; |
|
|
|
|
import com.github.tvbox.osc.ui.fragment.PlayFragment; |
|
|
|
|
import com.github.tvbox.osc.util.DefaultConfig; |
|
|
|
|
import com.github.tvbox.osc.util.FastClickCheckUtil; |
|
|
|
|
import com.github.tvbox.osc.util.MD5; |
|
|
|
|
@ -63,6 +68,10 @@ import me.jessyan.autosize.utils.AutoSizeUtils; |
|
|
|
|
*/ |
|
|
|
|
public class DetailActivity extends BaseActivity { |
|
|
|
|
private LinearLayout llLayout; |
|
|
|
|
private FragmentContainerView llPlayerFragmentContainer; |
|
|
|
|
private View llPlayerFragmentContainerBlock; |
|
|
|
|
private View llPlayerPlace; |
|
|
|
|
private PlayFragment playFragment = null; |
|
|
|
|
private ImageView ivThumb; |
|
|
|
|
private TextView tvName; |
|
|
|
|
private TextView tvYear; |
|
|
|
|
@ -105,7 +114,12 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
|
private void initView() { |
|
|
|
|
llLayout = findViewById(R.id.llLayout); |
|
|
|
|
llPlayerPlace = findViewById(R.id.previewPlayerPlace); |
|
|
|
|
llPlayerFragmentContainer = findViewById(R.id.previewPlayer); |
|
|
|
|
llPlayerFragmentContainerBlock = findViewById(R.id.previewPlayerBlock); |
|
|
|
|
ivThumb = findViewById(R.id.ivThumb); |
|
|
|
|
llPlayerPlace.setVisibility(showPreview ? View.VISIBLE : View.GONE); |
|
|
|
|
ivThumb.setVisibility(!showPreview ? View.VISIBLE : View.GONE); |
|
|
|
|
tvName = findViewById(R.id.tvName); |
|
|
|
|
tvYear = findViewById(R.id.tvYear); |
|
|
|
|
tvSite = findViewById(R.id.tvSite); |
|
|
|
|
@ -130,6 +144,12 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
mGridViewFlag.setLayoutManager(new V7LinearLayoutManager(this.mContext, 0, false)); |
|
|
|
|
seriesFlagAdapter = new SeriesFlagAdapter(); |
|
|
|
|
mGridViewFlag.setAdapter(seriesFlagAdapter); |
|
|
|
|
if (showPreview) { |
|
|
|
|
playFragment = new PlayFragment(); |
|
|
|
|
getSupportFragmentManager().beginTransaction().add(R.id.previewPlayer, playFragment).commit(); |
|
|
|
|
getSupportFragmentManager().beginTransaction().show(playFragment).commitAllowingStateLoss(); |
|
|
|
|
tvPlay.setText("全屏"); |
|
|
|
|
} |
|
|
|
|
tvSort.setOnClickListener(new View.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(View v) { |
|
|
|
|
@ -145,7 +165,11 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
@Override |
|
|
|
|
public void onClick(View v) { |
|
|
|
|
FastClickCheckUtil.check(v); |
|
|
|
|
jumpToPlay(); |
|
|
|
|
if (showPreview) { |
|
|
|
|
toggleFullPreview(); |
|
|
|
|
} else { |
|
|
|
|
jumpToPlay(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
tvQuickSearch.setOnClickListener(new View.OnClickListener() { |
|
|
|
|
@ -253,6 +277,8 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
seriesAdapter.getData().get(vodInfo.playIndex).selected = true; |
|
|
|
|
seriesAdapter.notifyItemChanged(vodInfo.playIndex); |
|
|
|
|
jumpToPlay(); |
|
|
|
|
if (showPreview && !fullWindows) |
|
|
|
|
toggleFullPreview(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@ -268,7 +294,11 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
insertVod(sourceKey, vodInfo); |
|
|
|
|
bundle.putString("sourceKey", sourceKey); |
|
|
|
|
bundle.putSerializable("VodInfo", vodInfo); |
|
|
|
|
jumpActivity(PlayActivity.class, bundle); |
|
|
|
|
if (showPreview) { |
|
|
|
|
playFragment.setData(bundle); |
|
|
|
|
} else { |
|
|
|
|
jumpActivity(PlayActivity.class, bundle); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -381,6 +411,11 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
mGridViewFlag.scrollToPosition(flagScrollTo); |
|
|
|
|
|
|
|
|
|
refreshList(); |
|
|
|
|
if (showPreview) { |
|
|
|
|
jumpToPlay(); |
|
|
|
|
llPlayerFragmentContainer.setVisibility(View.VISIBLE); |
|
|
|
|
llPlayerFragmentContainerBlock.setVisibility(View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
// startQuickSearch();
|
|
|
|
|
} else { |
|
|
|
|
mGridViewFlag.setVisibility(View.GONE); |
|
|
|
|
@ -390,6 +425,8 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
showEmpty(); |
|
|
|
|
llPlayerFragmentContainer.setVisibility(View.GONE); |
|
|
|
|
llPlayerFragmentContainerBlock.setVisibility(View.GONE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@ -425,7 +462,7 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
if (event.obj != null) { |
|
|
|
|
if (event.obj instanceof Integer) { |
|
|
|
|
int index = (int) event.obj; |
|
|
|
|
if (index != vodInfo.playIndex) { |
|
|
|
|
// if (index != vodInfo.playIndex) {
|
|
|
|
|
seriesAdapter.getData().get(vodInfo.playIndex).selected = false; |
|
|
|
|
seriesAdapter.notifyItemChanged(vodInfo.playIndex); |
|
|
|
|
seriesAdapter.getData().get(index).selected = true; |
|
|
|
|
@ -434,7 +471,7 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
vodInfo.playIndex = index; |
|
|
|
|
//保存历史
|
|
|
|
|
insertVod(sourceKey, vodInfo); |
|
|
|
|
} |
|
|
|
|
// }
|
|
|
|
|
} else if (event.obj instanceof JSONObject) { |
|
|
|
|
vodInfo.playerCfg = ((JSONObject) event.obj).toString(); |
|
|
|
|
//保存历史
|
|
|
|
|
@ -596,6 +633,12 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onBackPressed() { |
|
|
|
|
if (fullWindows) { |
|
|
|
|
if (playFragment.onBackPressed()) |
|
|
|
|
return; |
|
|
|
|
toggleFullPreview(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (seriesSelect) { |
|
|
|
|
if (seriesFlagFocus != null && !seriesFlagFocus.isFocused()) { |
|
|
|
|
seriesFlagFocus.requestFocus(); |
|
|
|
|
@ -604,4 +647,32 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
} |
|
|
|
|
super.onBackPressed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean dispatchKeyEvent(KeyEvent event) { |
|
|
|
|
if (event != null && playFragment != null && fullWindows) { |
|
|
|
|
if (playFragment.dispatchKeyEvent(event)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return super.dispatchKeyEvent(event); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// preview
|
|
|
|
|
boolean showPreview = true; // true 开启 false 关闭
|
|
|
|
|
boolean fullWindows = false; |
|
|
|
|
ViewGroup.LayoutParams windowsPreview = null; |
|
|
|
|
ViewGroup.LayoutParams windowsFull = null; |
|
|
|
|
|
|
|
|
|
void toggleFullPreview() { |
|
|
|
|
if (windowsPreview == null) { |
|
|
|
|
windowsPreview = llPlayerFragmentContainer.getLayoutParams(); |
|
|
|
|
} |
|
|
|
|
if (windowsFull == null) { |
|
|
|
|
windowsFull = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); |
|
|
|
|
} |
|
|
|
|
fullWindows = !fullWindows; |
|
|
|
|
llPlayerFragmentContainer.setLayoutParams(fullWindows ? windowsFull : windowsPreview); |
|
|
|
|
llPlayerFragmentContainerBlock.setVisibility(fullWindows ? View.GONE : View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|