| | |
| | | android:value="570f28a578d6e12cba6f7f200b8d1c83"></meta-data> |
| | | <meta-data |
| | | android:name="UMENG_CHANNEL" |
| | | android:value="qq"></meta-data> |
| | | android:value="vivo"></meta-data> |
| | | |
| | | |
| | | <provider |
| | |
| | | android:gravity="center" |
| | | android:lines="1" |
| | | android:minWidth="52dp" |
| | | android:maxWidth="150dp" |
| | | android:padding="8dp" |
| | | /> |
| | | </LinearLayout> |
| | |
| | | <TextView xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:id="@+id/tv_notice" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:background="#fffcf0a4" |
| | | android:layout_height="37dp" |
| | | android:background="#FFE84A" |
| | | android:gravity="center" |
| | | android:text="@string/msg_no_network" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="#ff028cf7" |
| | | android:textColor="#0052F6" |
| | | android:textSize="15sp" |
| | | android:visibility="gone" /> |
| | |
| | | |
| | | |
| | | public static void getHomeConfig(Context context, |
| | | ResponseHandlerInterface handler) { |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("Method", "getHomeConfig"); |
| | | commonPost(context, BASE_URL + "config", params, null, handler, true, true); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取剧集列表 |
| | | * |
| | | * @param context |
| | | * @param uid |
| | | * @param ResourceId |
| | | * @param videoId |
| | | * @param page |
| | | * @param handler |
| | | */ |
| | | public static void getVideoEpisodeList(Context context, String uid, |
| | | String ResourceId, String videoId, int page, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "getVideoEpisodeList"); |
| | | params.put("Uid", uid); |
| | | params.put("Page", page + ""); |
| | | params.put("VideoId", videoId); |
| | | params.put("ResourceId", ResourceId); |
| | | commonPost(context, BASE_URL + "recommend", params, handler); |
| | | |
| | | } |
| | | |
| | | public static void advice(Context context, String uid, String content, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | public static void getBaiDuNewsTypeList(Context context, |
| | | ResponseHandlerInterface handler) { |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("Method", "getNewsTypeList"); |
| | | commonPost(context, BASE_URL + "baidu", params, handler); |
| | | } |
| | | |
| | | public static void getBaiDuVideoTypeList(Context context, |
| | | ResponseHandlerInterface handler) { |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("Method", "getVideoTypeList"); |
| | | commonPost(context, BASE_URL + "baidu", params, handler); |
| | | } |
| | | |
| | | |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | |
| | | BeibeiConstant.GDT_RECOMMAND_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | BeibeiConstant.GDT_RECOMMEND_CATEGORY_MIN_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | BeibeiConstant.GDT_PLAYER_NATIVE1 = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | BeibeiConstant.GDT_SEARCH_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | BeibeiConstant.GDT_DISCOVER_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | BeibeiConstant.GDT_GUESS_LIKE_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | | BeibeiConstant.GDT_RECOMMEND_CATEGORY_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; |
| | |
| | | * |
| | | * @param adType |
| | | */ |
| | | private void loadSplashAd(final AdUtil.AD_TYPE adType) { |
| | | SplashAdUtil.loadAD(adType, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | private void loadSplashAd(final AdUtil.AD_TYPE adType, final String pid) { |
| | | SplashAdUtil.loadAD(pid, adType, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | @Override |
| | | public void close() { |
| | | runOnUiThread(new Runnable() { |
| | |
| | | public void noAd() {//初次加载未加载出广告 |
| | | if (AdUtil.AD_TYPE.csj == adType) { |
| | | //再次加载广点通广告 |
| | | SplashAdUtil.loadAD(AdUtil.AD_TYPE.gdt, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | SplashAdUtil.loadAD(pid, AdUtil.AD_TYPE.gdt, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | @Override |
| | | public void close() { |
| | | runOnUiThread(new Runnable() { |
| | |
| | | } else if (AdUtil.AD_TYPE.gdt == adType) { |
| | | //再次加载穿山甲广告 |
| | | //再次加载广点通广告 |
| | | SplashAdUtil.loadAD(AdUtil.AD_TYPE.csj, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | SplashAdUtil.loadAD(pid, AdUtil.AD_TYPE.csj, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | @Override |
| | | public void close() { |
| | | runOnUiThread(new Runnable() { |
| | |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | JSONObject ad = data.optJSONObject("ad"); |
| | | JSONObject ad = data.optJSONObject("adNew"); |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | AdUtil.AD_TYPE splash = AdUtil.getAdType(getApplicationContext(), AdUtil.POSITION_SPLASH); |
| | | loadSplashAd(splash); |
| | | String pid = AdUtil.getAdPid(getApplicationContext(), AdUtil.POSITION_SPLASH); |
| | | if (StringUtils.isBlank(pid)) { |
| | | if (splash != null) { |
| | | if (splash == AdUtil.AD_TYPE.csj) { |
| | | pid = CSJConstant.SPLASH_AD; |
| | | } else if (splash == AdUtil.AD_TYPE.gdt) { |
| | | pid = BeibeiConstant.GDT_SPLASH_POSITION_ID; |
| | | } |
| | | } |
| | | } |
| | | |
| | | loadSplashAd(splash, pid); |
| | | } |
| | | } else { |
| | | loadSplashAd(AdUtil.AD_TYPE.gdt); |
| | | loadSplashAd(AdUtil.AD_TYPE.csj, CSJConstant.SPLASH_AD); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | loadSplashAd(AdUtil.AD_TYPE.gdt); |
| | | loadSplashAd(AdUtil.AD_TYPE.csj, CSJConstant.SPLASH_AD); |
| | | } |
| | | }); |
| | | |
| | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | /** |
| | | * 查看更多时的剧集适配器 |
| | |
| | | @Override |
| | | public int getCount() { |
| | | if (mVideoInfo.getShowType() == 1) {// 综艺 |
| | | if (VideoEpisodeFragment.page_varietyshow * 10 <= mVideoInfo |
| | | .getVideoDetailList().size()) { |
| | | if (VideoEpisodeFragment.page_varietyshow * 10 <= VideoUtil.videoEpisodeList.size()) { |
| | | return VideoEpisodeFragment.page_varietyshow * 10; |
| | | } else { |
| | | return mVideoInfo.getVideoDetailList().size(); |
| | | return VideoUtil.videoEpisodeList.size(); |
| | | } |
| | | } |
| | | return mVideoInfo.getVideoDetailList().size(); |
| | | return VideoUtil.videoEpisodeList.size(); |
| | | } |
| | | |
| | | @Override |
| | | public Object getItem(int position) { |
| | | return mVideoInfo.getVideoDetailList().get(position); |
| | | return VideoUtil.videoEpisodeList.get(position); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | /** |
| | | * 收起时显示的剧集适配器 |
| | |
| | | @Override |
| | | public int getCount() { |
| | | mList.clear(); |
| | | mList.addAll(mVideoInfo.getVideoDetailList()); |
| | | mList.addAll(VideoUtil.videoEpisodeList); |
| | | int count = mList.size(); |
| | | if (mVideoInfo.getShowType() == 1) {// 电影 |
| | | // return count; |
| | |
| | | if (mPlayingPosition >= 10) {// 从1开始到12结束 |
| | | mList.clear(); |
| | | for (int i = mPlayingPosition - 9; i <= mPlayingPosition; i++) { |
| | | mList.add(mVideoInfo.getVideoDetailList().get(i)); |
| | | mList.add(VideoUtil.videoEpisodeList.get(i)); |
| | | } |
| | | // 再重新赋值 |
| | | count = mList.size(); |
| | |
| | | import com.weikou.beibeivideo.ui.video.EpisodeNewAdapter; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.GlideCircleTransform; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | import com.weikou.beibeivideo.util.ad.AdUtil; |
| | | import com.weikou.beibeivideo.util.ad.ExpressAdManager; |
| | |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | private EpisodeNewAdapter episodeAdapter; |
| | | |
| | | final String TAG = "EpisodeFragment"; |
| | | |
| | | private boolean episodeLoading = false;//剧集是否正在加载更多 |
| | | |
| | | private boolean episodeHasMore = true;//是否还有更多的剧集 |
| | | |
| | | private int episodePage = 2;//当前页 |
| | | |
| | | public static DisplayImageOptions option = new DisplayImageOptions.Builder() |
| | | .showImageForEmptyUri(R.drawable.from_other) |
| | |
| | | RecyclerView parent, RecyclerView.State state) { |
| | | int position = parent.getChildAdapterPosition(view); |
| | | outRect.left = space; |
| | | if (mVideoInfo != null && position == mVideoInfo.getVideoDetailList().size() - 1) |
| | | if (mVideoInfo != null && position == VideoUtil.videoEpisodeList.size() - 1) |
| | | outRect.right = space; |
| | | } |
| | | } |
| | |
| | | isCollect(); |
| | | loadAD1(); |
| | | setFrom(mVideoInfo); |
| | | if (mVideoInfo.getVideoDetailList() != null && mVideoInfo.getVideoDetailList().size() > 1) { |
| | | if (VideoUtil.videoEpisodeList != null && VideoUtil.videoEpisodeList.size() > 1) { |
| | | rv_episode.setVisibility(View.VISIBLE); |
| | | } else |
| | | rv_episode.setVisibility(View.GONE); |
| | | |
| | | // |
| | | rv_episode.addOnScrollListener(new RecyclerView.OnScrollListener() { |
| | | @Override |
| | | public void onScrollStateChanged(RecyclerView recyclerView, int newState) { |
| | | super.onScrollStateChanged(recyclerView, newState); |
| | | LinearLayoutManager manager = (LinearLayoutManager) recyclerView.getLayoutManager(); |
| | | int first = manager.findFirstVisibleItemPosition(); |
| | | int last = manager.findLastVisibleItemPosition(); |
| | | int total = manager.getItemCount(); |
| | | if (newState == RecyclerView.SCROLL_STATE_IDLE) { |
| | | if (mVideoInfo == null) |
| | | return; |
| | | if (!episodeLoading && episodeHasMore && last == total - 1) {//加载更多 |
| | | VideoResource checkedResource = null; |
| | | for (VideoResource vr : mVideoInfo.getResourceList()) { |
| | | checkedResource = vr; |
| | | break; |
| | | } |
| | | if (checkedResource != null) { |
| | | loadMoreEpisode(mVideoInfo.getId(), checkedResource.getId(), episodePage); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onScrolled(RecyclerView recyclerView, int dx, final int dy) { |
| | | super.onScrolled(recyclerView, dx, dy); |
| | | } |
| | | }); |
| | | |
| | | |
| | | EventBus.getDefault().register(this); |
| | | } |
| | |
| | | |
| | | public void onEventMainThread(VideoInfo videoInfo) { |
| | | mVideoInfo = videoInfo; |
| | | if (mVideoInfo.getVideoDetailList() != null && mVideoInfo.getVideoDetailList().size() > 1) { |
| | | if (VideoUtil.videoEpisodeList != null && VideoUtil.videoEpisodeList.size() > 1) { |
| | | rv_episode.setVisibility(View.VISIBLE); |
| | | } else |
| | | rv_episode.setVisibility(View.GONE); |
| | |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | if (videoInfo != null) { |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | if (videoInfo.getVideoDetailList() != null) |
| | | VideoUtil.videoEpisodeList.addAll(videoInfo.getVideoDetailList()); |
| | | } |
| | | // 附加字段 |
| | | if (jsonObject.optJSONObject("Extra1") != null) { |
| | | if (jsonObject.optJSONObject("Extra1").optJSONObject("Attention") != null) { |
| | |
| | | if (extraData != null) |
| | | videoInfo.setExtraData(extraData.toString()); |
| | | |
| | | if (videoInfo.getVideoDetailList() == null |
| | | || videoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList == null |
| | | || VideoUtil.videoEpisodeList.isEmpty()) { |
| | | Toast.makeText(getContext(), "影片已删除", |
| | | Toast.LENGTH_LONG).show(); |
| | | getActivity().finish(); |
| | | return; |
| | | } |
| | | |
| | | if (rv_episode.getAdapter() != null) |
| | | rv_episode.getAdapter().notifyDataSetChanged(); |
| | | // videoInfo.setSave(jsonObject.getJSONObject("Data").optBoolean("Save")); |
| | | if (isSetup) { |
| | | mVideoInfo.getVideoDetailList().clear(); |
| | | mVideoInfo.setVideoDetailList(videoInfo |
| | | .getVideoDetailList()); |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | VideoUtil.videoEpisodeList.addAll(videoInfo.getVideoDetailList()); |
| | | EventBus.getDefault().post(videoInfo); |
| | | int position = 0; |
| | | // boolean isFromWatchHistory = false; |
| | |
| | | "playing_position", 0); |
| | | } |
| | | // if (isFromWatchHistory) { |
| | | getUrl(videoInfo.getVideoDetailList().get(position)); |
| | | getUrl(VideoUtil.videoEpisodeList.get(position)); |
| | | EventBus.getDefault() |
| | | .post(videoInfo |
| | | .getVideoDetailList() |
| | | .post(VideoUtil.videoEpisodeList |
| | | .get(position)); |
| | | // } else {// 不是从观看记录点击过来 --跳到当前播放的集数 |
| | | // getUrl(videoInfo.getVideoDetailList().get(position)); |
| | |
| | | public void run() { |
| | | EventBus.getDefault().post(videoInfo); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList() |
| | | VideoUtil.videoEpisodeList |
| | | .get(0)); |
| | | } |
| | | }, 200); |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 加载更多剧集 |
| | | * |
| | | * @param videoId |
| | | * @param resourceId |
| | | */ |
| | | private synchronized void loadMoreEpisode(String videoId, String resourceId, int page) { |
| | | BeibeiVideoAPI.getVideoEpisodeList(ll_add_attention.getContext(), UserUtil.getUid(getContext()), resourceId, videoId, page, new |
| | | |
| | | BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws |
| | | Exception { |
| | | if (jsonObject.optBoolean("IsPost")) { |
| | | JSONObject data = jsonObject.optJSONObject("Data"); |
| | | episodeHasMore = data.optBoolean("hasMore"); |
| | | JSONArray array = data.optJSONArray("list"); |
| | | if (array != null && array.length() > 0) {// |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoDetailInfo> list = gson.fromJson(array.toString(), new TypeToken<List<VideoDetailInfo>>() { |
| | | }.getType()); |
| | | if (list != null && list.size() > 0) { |
| | | episodePage++; |
| | | VideoUtil.videoEpisodeList.addAll(list); |
| | | rv_episode.getAdapter().notifyDataSetChanged(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onStart() { |
| | | super.onStart(); |
| | | episodeLoading = true; |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | episodeLoading = false; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onStop() { |
| | | super.onStop(); |
| | |
| | | import android.support.v4.app.FragmentPagerAdapter; |
| | | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class EpisodePagerAdapter extends FragmentPagerAdapter { |
| | | |
| | |
| | | public EpisodePagerAdapter(FragmentManager fm, VideoInfo videoInfo, |
| | | int playingPosition) { |
| | | super(fm); |
| | | // Log.i("result", "EpisodePagerAdapter 中电视剧的长度为:" + videoInfo.getVideoDetailList().size()); |
| | | this.mVideoInfo = videoInfo; |
| | | this.mPlayingPosition = playingPosition; |
| | | } |
| | |
| | | public Fragment getItem(int position) { |
| | | int start = position * 20; |
| | | int end = start + 20; |
| | | if (end > mVideoInfo.getVideoDetailList().size()) { |
| | | end = mVideoInfo.getVideoDetailList().size(); |
| | | if (end > VideoUtil.videoEpisodeList.size()) { |
| | | end = VideoUtil.videoEpisodeList.size(); |
| | | } |
| | | return EpisodeFragment.newInstance(mVideoInfo, getPlayingPosition(), start, |
| | | end); |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class GridEpisodeAdapter2 extends BaseAdapter { |
| | | |
| | |
| | | @Override |
| | | public int getCount() { |
| | | return mVideoInfo == null ? 0 |
| | | : (mVideoInfo.getVideoDetailList() == null ? 0 : mVideoInfo |
| | | .getVideoDetailList().size()); |
| | | : (VideoUtil.videoEpisodeList == null ? 0 : VideoUtil.videoEpisodeList.size()); |
| | | } |
| | | |
| | | @Override |
| | | public Object getItem(int position) { |
| | | return mVideoInfo.getVideoDetailList().get(position); |
| | | return VideoUtil.videoEpisodeList.get(position); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class GridEpisodeAdapter3 extends BaseAdapter { |
| | | |
| | |
| | | @Override |
| | | public int getCount() { |
| | | return mVideoInfo == null ? 0 |
| | | : (mVideoInfo.getVideoDetailList() == null ? 0 : mVideoInfo |
| | | .getVideoDetailList().size()); |
| | | : (VideoUtil.videoEpisodeList == null ? 0 : VideoUtil.videoEpisodeList.size()); |
| | | } |
| | | |
| | | @Override |
| | | public Object getItem(int position) { |
| | | return mVideoInfo.getVideoDetailList().get(position); |
| | | return VideoUtil.videoEpisodeList.get(position); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class GridEpisodeAdapter4 extends BaseAdapter { |
| | | |
| | |
| | | @Override |
| | | public int getCount() { |
| | | return mVideoInfo == null ? 0 |
| | | : (mVideoInfo.getVideoDetailList() == null ? 0 : mVideoInfo.getVideoDetailList().size()); |
| | | : (VideoUtil.videoEpisodeList == null ? 0 : VideoUtil.videoEpisodeList.size()); |
| | | } |
| | | |
| | | @Override |
| | | public Object getItem(int position) { |
| | | return mVideoInfo.getVideoDetailList().get(position); |
| | | return VideoUtil.videoEpisodeList.get(position); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.weikou.beibeivideo.ui.mine.FXBrowserActivity; |
| | | import com.weikou.beibeivideo.ui.video.VideoPlayerActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | import com.weikou.beibeivideo.util.ad.FullVideoAdManager; |
| | | import com.weikou.beibeivideo.R; |
| | | |
| | |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.video_detail_activity); |
| | | |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | |
| | | if (videoInfo != null) { |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | VideoUtil.videoEpisodeList.addAll(videoInfo.getVideoDetailList()); |
| | | } |
| | | // 附加字段 |
| | | if (jsonObject.optJSONObject("Extra1") != null) { |
| | | if (jsonObject.optJSONObject("Extra1").optJSONObject("Attention") != null) { |
| | |
| | | resource = videoInfo.getResourceList().get(i); |
| | | } |
| | | } |
| | | if (videoInfo.getVideoDetailList() == null |
| | | || videoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList == null |
| | | || VideoUtil.videoEpisodeList.isEmpty()) { |
| | | Toast.makeText(VideoDetailActivity.this, |
| | | "影片已删除", Toast.LENGTH_LONG).show(); |
| | | finish(); |
| | |
| | | if (isFromWatchHistory || position > 0) { |
| | | mPosition = getIntent().getIntExtra("playing_position", 0); |
| | | EventBus.getDefault().post(videoInfo); |
| | | getUrl(videoInfo.getVideoDetailList().get(mPosition), isSetup); |
| | | EventBus.getDefault().post(videoInfo.getVideoDetailList().get(mPosition)); |
| | | getUrl(VideoUtil.videoEpisodeList.get(mPosition), isSetup); |
| | | EventBus.getDefault().post(VideoUtil.videoEpisodeList.get(mPosition)); |
| | | } else {// 不是从观看记录点击过来 --跳到当前播放的集数 |
| | | // position = VideoPlayUrlUtil |
| | | // .getVideoDetailPosition(context, |
| | | // videoInfo); |
| | | EventBus.getDefault().post(videoInfo); |
| | | if (StringUtils.isEmpty(detailid)) { |
| | | getUrl(videoInfo.getVideoDetailList().get( |
| | | getUrl(VideoUtil.videoEpisodeList.get( |
| | | position), isSetup); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList().get( |
| | | VideoUtil.videoEpisodeList.get( |
| | | position)); |
| | | } else { |
| | | if (videoInfo.getVideoDetailList() != null) |
| | | for (int i = 0; i < videoInfo.getVideoDetailList().size(); i++) { |
| | | if (detailid.equalsIgnoreCase(videoInfo.getVideoDetailList().get(i).getId())) { |
| | | getUrl(videoInfo.getVideoDetailList().get( |
| | | if (VideoUtil.videoEpisodeList != null) |
| | | for (int i = 0; i <VideoUtil.videoEpisodeList.size(); i++) { |
| | | if (detailid.equalsIgnoreCase(VideoUtil.videoEpisodeList.get(i).getId())) { |
| | | getUrl(VideoUtil.videoEpisodeList.get( |
| | | i), false); |
| | | PushEpisode info = new PushEpisode(); |
| | | info.setEpisodeNum(i); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList().get( |
| | | VideoUtil.videoEpisodeList.get( |
| | | i)); |
| | | } |
| | | } |
| | |
| | | resource = videoInfo.getResourceList().get(i); |
| | | } |
| | | } |
| | | getUrl(videoInfo.getVideoDetailList().get(0), |
| | | getUrl(VideoUtil.videoEpisodeList.get(0), |
| | | isSetup); |
| | | findViewById(android.R.id.content).postDelayed( |
| | | new Runnable() { |
| | |
| | | EventBus.getDefault().post( |
| | | videoInfo); |
| | | EventBus.getDefault() |
| | | .post(videoInfo |
| | | .getVideoDetailList() |
| | | .post(VideoUtil.videoEpisodeList |
| | | .get(0)); |
| | | } |
| | | }, 200); |
| | |
| | | * video网络数据请求 |
| | | */ |
| | | private void iNet() { |
| | | if (videoInfo.getVideoDetailList() == null |
| | | || videoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList == null |
| | | || VideoUtil.videoEpisodeList.isEmpty()) { |
| | | getVideoDetail(this, videoInfo.getId(), videoInfo.getThirdType(), |
| | | true); |
| | | } else { |
| | |
| | | public void run() { |
| | | EventBus.getDefault().post(videoInfo); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList().get( |
| | | VideoUtil.videoEpisodeList.get( |
| | | getIntent().getIntExtra("playing_position", |
| | | 0))); |
| | | } |
| | |
| | | private void saveWatchHistory(String from) { |
| | | if (videoInfo != null) { |
| | | String videoDetailId = ""; |
| | | if (videoInfo.getVideoDetailList() == null || videoInfo.getVideoDetailList().size() == 0) |
| | | if (VideoUtil.videoEpisodeList == null || VideoUtil.videoEpisodeList.size() == 0) |
| | | return; |
| | | if (mPosition >= videoInfo.getVideoDetailList().size()) { |
| | | videoDetailId = videoInfo.getVideoDetailList().get(0) |
| | | if (mPosition >= VideoUtil.videoEpisodeList.size()) { |
| | | videoDetailId = VideoUtil.videoEpisodeList.get(0) |
| | | .getId(); |
| | | } else { |
| | | videoDetailId = videoInfo.getVideoDetailList().get(mPosition) |
| | | videoDetailId = VideoUtil.videoEpisodeList.get(mPosition) |
| | | .getId(); |
| | | } |
| | | String resoureID = ""; |
| | |
| | | import com.weikou.beibeivideo.ui.video.FunshionPlayerFragment; |
| | | import com.weikou.beibeivideo.ui.video.VideoPlayerActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | import com.weikou.beibeivideo.util.ad.FullVideoAdManager; |
| | | import com.weikou.beibeivideo.util.ui.IPageEventListener; |
| | | |
| | |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.video_detail_activity); |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | /* |
| | | * 计算状态栏高度并设置 |
| | | */ |
| | |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | if (videoInfo != null) { |
| | | VideoUtil.videoEpisodeList.clear(); |
| | | VideoUtil.videoEpisodeList.addAll(videoInfo.getVideoDetailList()); |
| | | } |
| | | // 附加字段 |
| | | if (jsonObject.optJSONObject("Extra1") != null) { |
| | | if (jsonObject.optJSONObject("Extra1").optJSONObject("Attention") != null) { |
| | |
| | | resource = videoInfo.getResourceList().get(i); |
| | | } |
| | | } |
| | | if (videoInfo.getVideoDetailList() == null |
| | | || videoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList == null |
| | | || VideoUtil.videoEpisodeList.isEmpty()) { |
| | | Toast.makeText(VideoDetailActivity2.this, |
| | | "影片已删除", Toast.LENGTH_LONG).show(); |
| | | finish(); |
| | |
| | | if (isFromWatchHistory || position > 0) { |
| | | mPosition = getIntent().getIntExtra("playing_position", 0); |
| | | EventBus.getDefault().post(videoInfo); |
| | | getUrl(videoInfo.getVideoDetailList().get(mPosition), isSetup); |
| | | EventBus.getDefault().post(videoInfo.getVideoDetailList().get(mPosition)); |
| | | getUrl(VideoUtil.videoEpisodeList.get(mPosition), isSetup); |
| | | EventBus.getDefault().post(VideoUtil.videoEpisodeList.get(mPosition)); |
| | | } else {// 不是从观看记录点击过来 --跳到当前播放的集数 |
| | | // position = VideoPlayUrlUtil |
| | | // .getVideoDetailPosition(context, |
| | | // videoInfo); |
| | | EventBus.getDefault().post(videoInfo); |
| | | if (StringUtils.isEmpty(detailid)) { |
| | | getUrl(videoInfo.getVideoDetailList().get( |
| | | getUrl(VideoUtil.videoEpisodeList.get( |
| | | position), isSetup); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList().get( |
| | | VideoUtil.videoEpisodeList.get( |
| | | position)); |
| | | } else { |
| | | if (videoInfo.getVideoDetailList() != null) |
| | | for (int i = 0; i < videoInfo.getVideoDetailList().size(); i++) { |
| | | if (detailid.equalsIgnoreCase(videoInfo.getVideoDetailList().get(i).getId())) { |
| | | getUrl(videoInfo.getVideoDetailList().get( |
| | | if (VideoUtil.videoEpisodeList != null) |
| | | for (int i = 0; i < VideoUtil.videoEpisodeList.size(); i++) { |
| | | if (detailid.equalsIgnoreCase(VideoUtil.videoEpisodeList.get(i).getId())) { |
| | | getUrl(VideoUtil.videoEpisodeList.get( |
| | | i), false); |
| | | PushEpisode info = new PushEpisode(); |
| | | info.setEpisodeNum(i); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList().get( |
| | | VideoUtil.videoEpisodeList.get( |
| | | i)); |
| | | } |
| | | } |
| | |
| | | resource = videoInfo.getResourceList().get(i); |
| | | } |
| | | } |
| | | getUrl(videoInfo.getVideoDetailList().get(0), |
| | | getUrl(VideoUtil.videoEpisodeList.get(0), |
| | | isSetup); |
| | | findViewById(android.R.id.content).postDelayed( |
| | | new Runnable() { |
| | |
| | | EventBus.getDefault().post( |
| | | videoInfo); |
| | | EventBus.getDefault() |
| | | .post(videoInfo |
| | | .getVideoDetailList() |
| | | .post(VideoUtil.videoEpisodeList |
| | | .get(0)); |
| | | } |
| | | }, 200); |
| | |
| | | * video网络数据请求 |
| | | */ |
| | | private void iNet() { |
| | | if (videoInfo.getVideoDetailList() == null |
| | | || videoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList == null |
| | | || VideoUtil.videoEpisodeList.isEmpty()) { |
| | | getVideoDetail(this, videoInfo.getId(), videoInfo.getThirdType(), |
| | | true); |
| | | } else { |
| | |
| | | public void run() { |
| | | EventBus.getDefault().post(videoInfo); |
| | | EventBus.getDefault().post( |
| | | videoInfo.getVideoDetailList().get( |
| | | VideoUtil.videoEpisodeList.get( |
| | | getIntent().getIntExtra("playing_position", |
| | | 0))); |
| | | } |
| | |
| | | private void saveWatchHistory(String from) { |
| | | if (videoInfo != null) { |
| | | String videoDetailId = ""; |
| | | if (videoInfo.getVideoDetailList() == null || videoInfo.getVideoDetailList().size() == 0) |
| | | if (VideoUtil.videoEpisodeList == null || VideoUtil.videoEpisodeList.size() == 0) |
| | | return; |
| | | if (mPosition >= videoInfo.getVideoDetailList().size()) { |
| | | videoDetailId = videoInfo.getVideoDetailList().get(0) |
| | | if (mPosition >= VideoUtil.videoEpisodeList.size()) { |
| | | videoDetailId = VideoUtil.videoEpisodeList.get(0) |
| | | .getId(); |
| | | } else { |
| | | videoDetailId = videoInfo.getVideoDetailList().get(mPosition) |
| | | videoDetailId = VideoUtil.videoEpisodeList.get(mPosition) |
| | | .getId(); |
| | | } |
| | | String resoureID = ""; |
| | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.entity.VideoResource; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | public void onEventMainThread(VideoDetailInfo videoDetailInfo) { |
| | | mVideoDetailInfo = videoDetailInfo; |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < mVideoInfo.getVideoDetailList().size(); i++) { |
| | | for (int i = 0; i < VideoUtil.videoEpisodeList.size(); i++) { |
| | | if (videoDetailInfo.getId().equals( |
| | | mVideoInfo.getVideoDetailList().get(i).getId())) { |
| | | VideoUtil.videoEpisodeList.get(i).getId())) { |
| | | playingPosition = i; |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | public void onEventMainThread(VideoInfo info) { |
| | | // Log.i("result", "收到来源点击产生的列表EventBus-------------1,电视剧的长度为:" + mVideoInfo.getVideoDetailList().size()); |
| | | int playingPosition = 0; |
| | | if (mPlayingPosition != playingPosition) { |
| | | mPlayingPosition = playingPosition; |
| | |
| | | public void onEventMainThread(PushEpisode info) { |
| | | if (mVideoInfo == null) |
| | | return; |
| | | // Log.i("result", "收到来源点击产生的列表EventBus-------------1,电视剧的长度为:" + mVideoInfo.getVideoDetailList().size()); |
| | | if (mVideoInfo.getShowType() == 1) {// 综艺 如果是综艺的话就分页加载 |
| | | if (info.getEpisodeNum() > 10) { |
| | | page_varietyshow = info.getEpisodeNum() / 10 + 1; |
| | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.entity.VideoResource; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | gv_episode2.setNumColumns(5); |
| | | } |
| | | |
| | | if (mVideoInfo.getVideoDetailList() != null |
| | | && !mVideoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList != null |
| | | && !VideoUtil.videoEpisodeList.isEmpty()) { |
| | | gv_episode2.setAdapter(new GridEpisodeAdapter2(mVideoInfo, |
| | | mPlayingPosition)); |
| | | gv_episode2.setOnItemClickListener(new OnItemClickListener() { |
| | |
| | | |
| | | public void onEventMainThread(VideoDetailInfo videoDetailInfo) { |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < mVideoInfo.getVideoDetailList().size(); i++) { |
| | | for (int i = 0; i < VideoUtil.videoEpisodeList.size(); i++) { |
| | | if (videoDetailInfo.getId().equals( |
| | | mVideoInfo.getVideoDetailList().get(i).getId())) { |
| | | VideoUtil.videoEpisodeList.get(i).getId())) { |
| | | playingPosition = i; |
| | | break; |
| | | } |
| | |
| | | import com.weikou.beibeivideo.util.SDCardUtil; |
| | | import com.weikou.beibeivideo.util.VideoPlayUrlUtil; |
| | | import com.weikou.beibeivideo.util.VideoTypeUtil; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | |
| | | gv_episode3.setNumColumns(5); |
| | | } |
| | | |
| | | if (mVideoInfo.getVideoDetailList() != null |
| | | && !mVideoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList != null |
| | | && !VideoUtil.videoEpisodeList.isEmpty()) { |
| | | mGridEpisodeAdapter3 = new GridEpisodeAdapter3(mVideoInfo); |
| | | gv_episode3.setAdapter(mGridEpisodeAdapter3); |
| | | } else { |
| | |
| | | import com.weikou.beibeivideo.util.GetRealPathTask; |
| | | import com.weikou.beibeivideo.util.SDCardUtil; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | |
| | | gv_episode4.setNumColumns(5); |
| | | } |
| | | |
| | | if (mVideoInfo.getVideoDetailList() != null |
| | | && !mVideoInfo.getVideoDetailList().isEmpty()) { |
| | | if (VideoUtil.videoEpisodeList != null |
| | | && !VideoUtil.videoEpisodeList.isEmpty()) { |
| | | mGridEpisodeAdapter4 = new GridEpisodeAdapter4(mVideoInfo); |
| | | gv_episode4.setAdapter(mGridEpisodeAdapter4); |
| | | } else { |
| | |
| | | import com.weikou.beibeivideo.entity.Comment; |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | } |
| | | |
| | | public void onEventMainThread(VideoDetailInfo videoDetailInfo) { |
| | | for (int i = 0; i < mVideoInfo.getVideoDetailList().size(); i++) { |
| | | for (int i = 0; i < VideoUtil.videoEpisodeList.size(); i++) { |
| | | if (videoDetailInfo.getId().equals( |
| | | mVideoInfo.getVideoDetailList().get(i).getId())) { |
| | | VideoUtil.videoEpisodeList.get(i).getId())) { |
| | | break; |
| | | } |
| | | } |
| | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class DownLoadAdapter extends CursorAdapter { |
| | | public interface IGetDeleteCallback { |
| | |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < videoInfo.getVideoDetailList() |
| | | .size(); i++) { |
| | | VideoDetailInfo item = videoInfo |
| | | .getVideoDetailList().get(i); |
| | | VideoDetailInfo item =videoInfo.getVideoDetailList().get(i); |
| | | if (item.getId().equals(videoDetailId)) { |
| | | playingPosition = i; |
| | | break; |
| | |
| | | .get(videoDetailId); |
| | | if (videoInfo != null) { |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < videoInfo |
| | | .getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo item = videoInfo |
| | | .getVideoDetailList().get(i); |
| | | for (int i = 0; i < videoInfo.getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo item = videoInfo.getVideoDetailList().get(i); |
| | | if (item.getId().equals(videoDetailId)) { |
| | | playingPosition = i; |
| | | break; |
| | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity; |
| | | import com.weikou.beibeivideo.util.DownloadUtils; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class DownloadAdapter2 extends BaseAdapter { |
| | | |
| | |
| | | videoDetailId); |
| | | if (videoInfo != null) { |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < videoInfo |
| | | .getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo item = videoInfo |
| | | .getVideoDetailList().get(i); |
| | | for (int i = 0; i < videoInfo.getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo item = videoInfo.getVideoDetailList().get(i); |
| | | if (item.getId().equals(videoDetailId)) { |
| | | playingPosition = i; |
| | | break; |
| | |
| | | .get(videoDetailId); |
| | | if (videoInfo != null) { |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < videoInfo |
| | | .getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo item = videoInfo |
| | | .getVideoDetailList().get(i); |
| | | for (int i = 0; i < videoInfo.getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo item = videoInfo.getVideoDetailList().get(i); |
| | | if (item.getId().equals(videoDetailId)) { |
| | | playingPosition = i; |
| | | break; |
| | |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Formatter; |
| | |
| | | int playingPosition = 0; |
| | | for (int i = 0; i < videoInfo.getVideoDetailList() |
| | | .size(); i++) { |
| | | VideoDetailInfo item = videoInfo |
| | | .getVideoDetailList().get(i); |
| | | VideoDetailInfo item =videoInfo.getVideoDetailList().get(i); |
| | | if (item.getId().equals(videoDetailId)) { |
| | | playingPosition = i; |
| | | break; |
| | |
| | | mAdapter.swapCursor(null); |
| | | } |
| | | |
| | | // @Override |
| | | // public void onItemClick(AdapterView<?> parent, View view, int position, |
| | | // long id) { |
| | | // Cursor cursor = (Cursor) parent.getItemAtPosition(position); |
| | | // Map<String, VideoInfo> videoInfos = mAdapter.getVideoInfos(); |
| | | // String videoId = cursor.getString(cursor |
| | | // .getColumnIndex(WatchHistoryTable.VIDEO_ID)); |
| | | // String videoDetailId = cursor.getString(cursor |
| | | // .getColumnIndex(WatchHistoryTable.VIDEO_DETAIL_ID)); |
| | | // VideoInfo videoInfo = videoInfos.get(videoId); |
| | | // if (videoInfo != null) { |
| | | // int playingPosition = 0; |
| | | // for (int i = 0; i < videoInfo.getVideoDetailList().size(); i++) { |
| | | // VideoDetailInfo item = videoInfo.getVideoDetailList().get(i); |
| | | // if (item.getId().equals(videoDetailId)) { |
| | | // playingPosition = i; |
| | | // break; |
| | | // } |
| | | // } |
| | | // Intent intent = new Intent(view.getContext(), |
| | | // VideoDetailActivity.class); |
| | | // intent.putExtra("video_info", videoInfo); |
| | | // intent.putExtra("playing_position", playingPosition); |
| | | // intent.putExtra("isFromWatchHistory", true); |
| | | // view.getContext().startActivity(intent); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | public void deleteWatchHistory() { |
| | | List<Long> selectedIds = mAdapter.getSelectedIds(); |
| | |
| | | // 0-不显示 |
| | | // 1-显示 |
| | | final String url = obj.optString("Url"); |
| | | if (position > 0)//只有第一页才显示通知 |
| | | content = null; |
| | | if (!StringUtils.isBlank(content)) { |
| | | tv_notice.setVisibility(View.VISIBLE); |
| | | tv_notice.setText(content); |
| | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.entity.ad.ExpressAdContainer; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.video.SuggestKeysAdapter; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.weikou.beibeivideo.util.ad.AdUtil; |
| | | import com.weikou.beibeivideo.util.ad.ExpressAdManager; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | |
| | | // 1.加载广告,先设置加载上下文环境和条件 |
| | | private void initAdvertisement() { |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(SearchActivity.this, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | BeibeiConstant.GDT_ID, BeibeiConstant.GDT_SEARCH_NATIVE, new NativeExpressAD.NativeExpressADListener() { |
| | | AdUtil.AD_TYPE adType = AdUtil.getAdType(getApplicationContext(), AdUtil.POSITION_SEARCH); |
| | | fl_advertisement.post(new Runnable() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | runOnUiThread(new Runnable() { |
| | | public void run() { |
| | | int width = fl_advertisement.getWidth()-fl_advertisement.getPaddingLeft()-fl_advertisement.getPaddingRight(); |
| | | new ExpressAdManager(adType, getApplicationContext()).loadSearchAd(DimenUtils.px2dip(getApplicationContext(), width), new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void run() { |
| | | if (null != list && list.size() > 0) { |
| | | NativeExpressADView adView = list.get(0); |
| | | adView.render(); |
| | | FrameLayout parent = (FrameLayout) adView.getParent(); |
| | | if (parent != null) { |
| | | parent.removeAllViews(); |
| | | } |
| | | fl_advertisement.addView(adView); |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) { |
| | | ExpressAdManager.renderAndFillAd(SearchActivity.this, adList.get(0), fl_advertisement, new ExpressAdManager.IAdEventListener() { |
| | | @Override |
| | | public void closeAd(ExpressAdContainer ad) { |
| | | fl_advertisement.removeAllViews(); |
| | | } |
| | | }); |
| | | } else if (adType != null) { |
| | | AdUtil.AD_TYPE newAdType = null; |
| | | if (adType == AdUtil.AD_TYPE.gdt) { |
| | | newAdType = AdUtil.AD_TYPE.csj; |
| | | } else |
| | | newAdType = AdUtil.AD_TYPE.gdt; |
| | | |
| | | new ExpressAdManager(newAdType, getApplicationContext()).loadSearchAd(DimenUtils.px2dip(getApplicationContext(), width), new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) { |
| | | ExpressAdManager.renderAndFillAd(SearchActivity.this, adList.get(0), fl_advertisement, new ExpressAdManager.IAdEventListener() { |
| | | @Override |
| | | public void closeAd(ExpressAdContainer ad) { |
| | | fl_advertisement.removeAllViews(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADExposure(NativeExpressADView nativeExpressADView) { |
| | | } |
| | | |
| | | @Override |
| | | public void onADClicked(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClosed(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADLeftApplication(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADOpenOverlay(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADCloseOverlay(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | } |
| | | }); // 传入Activity |
| | | // 注意:如果您在联盟平台上新建原生模板广告位时,选择了支持视频,那么可以进行个性化设置(可选) |
| | | nativeExpressAD.setVideoOption(new VideoOption.Builder() |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // WIFI 环境下可以自动播放视频 |
| | | .setAutoPlayMuted(true) // 自动播放时为静音 |
| | | .build()); // |
| | | nativeExpressAD.loadAD(2); |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | |
| | | public class EpisodeNewAdapter extends RecyclerView.Adapter { |
| | | |
| | |
| | | @Override |
| | | |
| | | public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) { |
| | | final VideoDetailInfo info = videoInfo.getVideoDetailList().get(position); |
| | | final VideoDetailInfo info = VideoUtil.videoEpisodeList.get(position); |
| | | EpisodeViewHolder viewHolder = (EpisodeViewHolder) holder; |
| | | setDisplaySize(viewHolder.tv_episode); |
| | | if (position == playingPosition) { |
| | |
| | | |
| | | @Override |
| | | public int getItemCount() { |
| | | if (videoInfo != null && videoInfo.getVideoDetailList() != null) |
| | | return videoInfo.getVideoDetailList().size(); |
| | | if (videoInfo != null && VideoUtil.videoEpisodeList != null) |
| | | return VideoUtil.videoEpisodeList.size(); |
| | | else |
| | | return 0; |
| | | } |
| | |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.weikou.beibeivideo.util.FunshionConstant; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | import com.weikou.beibeivideo.util.VideoUtil; |
| | | import com.weikou.beibeivideo.util.downutil.StringUtils; |
| | | import com.weikou.beibeivideo.util.ui.IPageEventListener; |
| | | |
| | |
| | | Log.i(TAG, "onEventMainThread:FunshionPlayInfo"); |
| | | mCurrentPosition = info.getPosition(); |
| | | List<VideoEpisode> episodes = new ArrayList<>(); |
| | | for (int i = 0; i < info.getVideoInfo().getVideoDetailList().size(); i++) { |
| | | VideoDetailInfo detail = info.getVideoInfo().getVideoDetailList().get(i); |
| | | for (int i = 0; i < VideoUtil.videoEpisodeList.size(); i++) { |
| | | VideoDetailInfo detail = VideoUtil.videoEpisodeList.get(i); |
| | | VideoEpisode es = new VideoEpisode(); |
| | | es.setId(detail.getId()); |
| | | es.setTag(detail.getTag()); |
| | |
| | | //监听 |
| | | @Override |
| | | public void onNext() { |
| | | if (mCurrentPosition >= mVideoInfo.getVideoDetailList().size() - 1) { |
| | | if (mCurrentPosition >= VideoUtil.videoEpisodeList.size() - 1) { |
| | | Toast.makeText(getContext(), "没有下一集了", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | |
| | | playInfo.setVideoInfo(mVideoInfo); |
| | | playInfo.setPosition(p); |
| | | playInfo.setCollected(collected); |
| | | VideoDetailInfo detailInfo = mVideoInfo.getVideoDetailList().get(p); |
| | | VideoDetailInfo detailInfo = VideoUtil.videoEpisodeList.get(p); |
| | | String uid = UserUtil.getUid(BeibeiVideoApplication.application); |
| | | if (mVideoPlayer != null && mVideoPlayer.isPlaying()) |
| | | mVideoPlayer.pause(); |
| | |
| | | |
| | | public static boolean AD_CLICK_DOWNLOAD = false;//广告下载提示框是否展示 |
| | | |
| | | public static final boolean DEBUG = false; |
| | | public static final boolean DEBUG = true; |
| | | } |
| | |
| | | if (StringUtils.isBlank(detailId)) { |
| | | return 0; |
| | | } else { |
| | | for (int i = 0; i < info.getVideoDetailList().size(); i++) { |
| | | if (info.getVideoDetailList().get(i).getId() |
| | | for (int i = 0; i < VideoUtil.videoEpisodeList.size(); i++) { |
| | | if (VideoUtil.videoEpisodeList.get(i).getId() |
| | | .equalsIgnoreCase(detailId)) |
| | | return i; |
| | | } |
| | |
| | | package com.weikou.beibeivideo.util; |
| | | |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.weikou.beibeivideo.entity.VideoDetailInfo; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class VideoUtil { |
| | | |
| | | public final static List<VideoDetailInfo> videoEpisodeList = new ArrayList<>(); |
| | | |
| | | |
| | | public static String getWatchCountShortName(String watchCount) { |
| | | DecimalFormat df = new DecimalFormat("###.0"); |
| | | try { |
| | |
| | | public final static String POSITION_SPLASH = "splash";//开屏 |
| | | public final static String POSITION_VIDEO_PLAY_PRE = "videoPlayPre";//视频播放前贴 |
| | | public final static String POSITION_EXIT_APP = "exitApp";//APP退出广告 |
| | | public final static String POSITION_SEARCH = "videoSearch";//搜索页广告 |
| | | |
| | | public static AD_TYPE getSmallExpressAdType() { |
| | | if (BeibeiConstant.AD_TYPE != null && AdTypeVO.TYPE_CSJ.equalsIgnoreCase(BeibeiConstant.AD_TYPE.getExpressSmallType())) { |
| | |
| | | if (!StringUtils.isNullOrEmpty(config)) {//万一没设置起就用广点通 |
| | | try { |
| | | JSONObject object = new JSONObject(config); |
| | | return AD_TYPE.valueOf(object.optString(positionName)); |
| | | object = object.optJSONObject(positionName); |
| | | if (object != null) |
| | | return AD_TYPE.valueOf(object.optString("type")); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e1) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static String getAdPid(Context context, String positionName) { |
| | | SharedPreferences share = context.getSharedPreferences("adConfig", Context.MODE_PRIVATE); |
| | | String config = share.getString("config", ""); |
| | | if (!StringUtils.isNullOrEmpty(config)) {//万一没设置起就用广点通 |
| | | try { |
| | | JSONObject object = new JSONObject(config); |
| | | object = object.optJSONObject(positionName); |
| | | if (object != null) |
| | | return object.optString("pid"); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e1) { |
| | | return null; |
| | | } |
| | | } else { |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | //视频详情页猜你喜欢底部 |
| | | public static String VIDEO_DETAIL_GUESSLIKE_TOP = "945548915"; |
| | | |
| | | //视频搜索页 |
| | | public static String VIDEO_SEARCH="945552227"; |
| | | |
| | | |
| | | |
| | | //无效广告 |
| | | public static String INVALID_AD = "111111111"; |
| | |
| | | import com.qq.e.ads.nativ.express2.VideoOption2; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.weikou.beibeivideo.entity.ad.ExpressAdContainer; |
| | | import com.weikou.beibeivideo.ui.recommend.SearchActivity; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 加载视频搜索广告 |
| | | * |
| | | * @param adLoadListener |
| | | */ |
| | | public void loadSearchAd(int widthDP, final IAdLoadListener adLoadListener) { |
| | | //加载大图 |
| | | String pid = null; |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | pid = CSJConstant.VIDEO_SEARCH; |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt) { |
| | | pid = BeibeiConstant.GDT_SEARCH_NATIVE; |
| | | } |
| | | int height = (int) (widthDP / 1.78f); |
| | | |
| | | loadAd(widthDP, height, pid, 1, adLoadListener); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 加载广点通广告 |
| | | * |
| | | * @param positionId |
| | |
| | | * @param context |
| | | */ |
| | | private void loadGDT(String positionId, int widthDP, int heightDP, int count, final IGDTAdLoadListener adLoadListener, Context context) { |
| | | |
| | | |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(context, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | positionId, new NativeExpressAD.NativeExpressADListener() { |
| | | |
| | |
| | | * @param tv_time |
| | | * @param splashAdListener |
| | | */ |
| | | public static void loadAD(AdUtil.AD_TYPE adType, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) { |
| | | if (adType==null) { |
| | | public static void loadAD(String pid, AdUtil.AD_TYPE adType, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) { |
| | | if (adType == null) { |
| | | splashAdListener.close(); |
| | | return; |
| | | } |
| | | if (AdUtil.AD_TYPE.csj==adType) { |
| | | loadCSJ(context, skip, vg_ad, splashAdListener); |
| | | } else if (AdUtil.AD_TYPE.gdt==adType) { |
| | | loadGDT(context, skip, vg_ad, tv_time, splashAdListener); |
| | | if (AdUtil.AD_TYPE.csj == adType) { |
| | | loadCSJ(pid, context, skip, vg_ad, splashAdListener); |
| | | } else if (AdUtil.AD_TYPE.gdt == adType) { |
| | | loadGDT(pid, context, skip, vg_ad, tv_time, splashAdListener); |
| | | } else { |
| | | splashAdListener.close(); |
| | | } |
| | | } |
| | | |
| | | private static void loadGDT(Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) { |
| | | private static void loadGDT(String code, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) { |
| | | |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = BeibeiConstant.GDT_SPLASH_POSITION_ID; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = BeibeiConstant.GDT_SPLASH_VIVO_POSITION_ID; |
| | | } |
| | | if (StringUtils.isNullOrEmpty(code)) |
| | | code = BeibeiConstant.GDT_SPLASH_POSITION_ID; |
| | | new SplashAD(context, skip, code, new SplashADListener() { |
| | | @Override |
| | | public void onADDismissed() { |
| | |
| | | * @param vg_ad |
| | | * @param splashAdListener |
| | | */ |
| | | private static void loadCSJ(Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) { |
| | | private static void loadCSJ(String code, Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) { |
| | | skip.setVisibility(View.GONE); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdNative mTTAdNative = ttAdManager.createAdNative(context.getApplicationContext()); |
| | |
| | | if (height == 0) |
| | | height = 1080; |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = CSJConstant.SPLASH_AD; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = CSJConstant.SPLASH_AD_VIVO; |
| | | } |
| | | if (StringUtils.isNullOrEmpty(code)) |
| | | code = CSJConstant.SPLASH_AD; |
| | | |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(code) |