New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:gravity="center"> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:text="^到底了^" |
| | | android:textColor="#FF0000" |
| | | android:textSize="15sp"></TextView> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="4dp" |
| | | android:paddingTop="8dp" |
| | | android:gravity="center_vertical" |
| | | android:paddingTop="8dp" |
| | | android:paddingBottom="8dp"> |
| | | |
| | | <TextView |
| | |
| | | <android.support.v7.widget.RecyclerView |
| | | android:id="@+id/rv_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | ></android.support.v7.widget.RecyclerView> |
| | | android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView> |
| | | |
| | | |
| | | <TextView |
| | |
| | | android:orientation="vertical"></LinearLayout> |
| | | |
| | | <FrameLayout |
| | | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:descendantFocusability="blocksDescendants"> |
| | |
| | | } |
| | | |
| | | |
| | | public static void uploadSession(Context context, String sessionId, |
| | | String type, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | params.put("Method", "uploadSession"); |
| | | if (sessionId != null) |
| | | params.put("sessionId", sessionId); |
| | | if (type != null) |
| | | params.put("type", type); |
| | | commonPost(context, BASE_URL + "session", params, handler); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取剧集列表 |
| | | * |
| | |
| | | import com.weikou.beibeivideo.entity.JumpDetail; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Map; |
| | | |
| | | public class BannerVO { |
| | | private boolean show; |
| | | private String picture; |
| | | private BigDecimal ratio; |
| | | private JumpDetail jumpDetail; |
| | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public boolean isShow() { |
| | | return show; |
| | | } |
| | | |
| | | public void setShow(boolean show) { |
| | | this.show = show; |
| | | } |
| | | } |
| | |
| | | //设置我的页面banner |
| | | ConfigUtil.saveMinePageBanner(getApplicationContext(), data.optString("minePageBanner")); |
| | | |
| | | ConfigUtil.savePlayerJumpOutProtocolPrefix(getApplicationContext(), data.optString("jumpAppProtocolPrefix")); |
| | | |
| | | //保存免广告权益持续时间 |
| | | AdUtil.setPPTVNoAdRewardHour(getApplicationContext(), pptvNoAdRewardHour); |
| | | |
| | |
| | | rl_banner.setOnClickListener(new OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | JumpActivityUtil.jumpPage(getActivity(), bannerVO.getJumpDetail(), bannerVO.getParams() != null ? JSONObject.parseObject(bannerVO.getParams().replace( |
| | | "\\" + "\"", "\"")) : null); |
| | | JumpActivityUtil.jumpPage(getActivity(), bannerVO.getJumpDetail(), bannerVO.getParams() != null ? JSONObject.parseObject(bannerVO.getParams()) : null); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | private VideoDetailAdInfoVO adInfo; |
| | | |
| | | //会话ID |
| | | private String sessionId; |
| | | |
| | | @Override |
| | | protected void onSaveInstanceState(Bundle outState) { |
| | | outState.putString("flash exit", "VideoDetailActivity"); |
| | |
| | | if (!progressDialog.isShowing()) { |
| | | progressDialog.show(); |
| | | } |
| | | uploadSession(); |
| | | getVideoDetail(this, videoInfo.getId(), videoInfo.getThirdType(), false, changeVideoEvent.getFrom()); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public void onEventMainThread(VideoInfo info) { |
| | | Log.i(TAG, "onEventMainThread-videoInfo"); |
| | | videoInfo = info; |
| | | } |
| | | |
| | | //上报session |
| | | private void uploadSession() { |
| | | if (StringUtils.isEmpty(sessionId)) { |
| | | return; |
| | | } |
| | | BeibeiVideoAPI.uploadSession(getApplicationContext(), sessionId, "videoDetail", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void getVideoDetail(final Context context, String videoId, |
| | |
| | | if (pptv) { |
| | | UmengEventUtil.pptvPlay(getApplicationContext()); |
| | | String playUrl = data.optString("playUrl"); |
| | | sessionId = data.optString("sessionId"); |
| | | |
| | | fl_pptv.setVisibility(View.VISIBLE); |
| | | ll_other.setVerticalGravity(View.GONE); |
| | | PPTVPlayFragment pptvPlayFragment = new PPTVPlayFragment(); |
| | |
| | | finish(); |
| | | return; |
| | | } |
| | | |
| | | sessionId = data.optString("SessionId"); |
| | | |
| | | |
| | | Glide.with(getApplicationContext()) |
| | |
| | | super.onDestroy(); |
| | | if (BeibeiConstant.AD_TYPE != null && BeibeiConstant.AD_TYPE.isVideoDetailSplashAd()) |
| | | FullVideoAdManager.getInstance().loadAd(BeibeiVideoApplication.application, null); |
| | | uploadSession(); |
| | | } |
| | | } |
| | |
| | | private CirclePageIndicator indicator_recommend; |
| | | private boolean isLoad; |
| | | private View loading; |
| | | private View noMoreDataView; |
| | | |
| | | private void initHomeAd() { |
| | | View view = LayoutInflater.from(getContext()).inflate(R.layout.recommend_top, null); |
| | |
| | | loading = LayoutInflater.from(getContext()).inflate(R.layout.item_loading, null); |
| | | loading.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); |
| | | loading.setVisibility(View.GONE); |
| | | |
| | | noMoreDataView = LayoutInflater.from(getContext()).inflate(R.layout.item_no_more_data_view, null); |
| | | noMoreDataView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); |
| | | |
| | | |
| | | rv_recommend.addOnScrollListener(new RecyclerView.OnScrollListener() { |
| | |
| | | .getJSONArray("data").toString()); |
| | | editor.commit(); |
| | | } |
| | | //刷新 |
| | | if (page == 1) { |
| | | mRecommendNewAdapter.setFooterView(loading); |
| | | } |
| | | |
| | | if (mHomeTypes.size() >= homeTypeCount) { |
| | | mRecommendNewAdapter.removeFooterView(); |
| | | } |
| | | mRecommendNewAdapter.notifyDataSetChanged(); |
| | | } |
| | | } |
| | |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.graphics.Color; |
| | | import android.support.v7.widget.RecyclerView; |
| | | import android.text.SpannableString; |
| | | import android.text.Spanned; |
| | |
| | | import com.weikou.beibeivideo.entity.recommend.HomeTypeContent; |
| | | import com.weikou.beibeivideo.entity.recommend.RecommendContent; |
| | | import com.weikou.beibeivideo.entity.recommend.holder.RecommendVideoAdHolder; |
| | | import com.weikou.beibeivideo.entity.video.holder.FooterViewHolder; |
| | | import com.weikou.beibeivideo.entity.video.holder.HeaderViewHolder; |
| | | import com.weikou.beibeivideo.entity.video.holder.VideoHolder; |
| | | import com.weikou.beibeivideo.ui.common.VideosLiveActivity; |
| | |
| | | |
| | | public void setFooterView(View view) { |
| | | this.footerView = view; |
| | | if (contentList != null) { |
| | | notifyItemChanged(contentList.size() + (headerView != null ? 1 : 0)); |
| | | } |
| | | } |
| | | |
| | | public void removeFooterView() { |
| | | if (footerView != null) { |
| | | notifyItemRemoved(contentList.size() + (headerView != null ? 1 : 0)); |
| | | this.footerView = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public RecommendNewAdapter(Activity context, List contentList, int recyclerViewWidth) { |
| | | this.mContext = context; |
| | |
| | | case TYPE_HEADER: |
| | | return new HeaderViewHolder(headerView); |
| | | case TYPE_FOOTER: |
| | | return new HeaderViewHolder(footerView); |
| | | return new FooterViewHolder(footerView); |
| | | case RecommendContent.TYPE_HOMETYPE: |
| | | return new HomeTypeHolder(inflater.inflate(R.layout.item_recommend_home_type, null, false), new RecyclerView.RecycledViewPool()); |
| | | case RecommendContent.TYPE_AD: |
| | |
| | | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { |
| | | if (viewHolder instanceof HeaderViewHolder) |
| | | return; |
| | | if (viewHolder instanceof FooterViewHolder) |
| | | return; |
| | | int p = i; |
| | | if (headerView != null) |
| | | p--; |
| | |
| | | if (viewHolder instanceof HomeTypeHolder) { |
| | | final HomeType homeType = (HomeType) contentList.get(p); |
| | | |
| | | |
| | | final HomeTypeHolder holder = (HomeTypeHolder) viewHolder; |
| | | |
| | | if (homeType == null) { |
| | | holder.view.setVisibility(View.GONE); |
| | | return; |
| | |
| | | if (headerView != null) |
| | | position--; |
| | | |
| | | if(position>=contentList.size()) |
| | | if (position >= contentList.size()) |
| | | return TYPE_FOOTER; |
| | | |
| | | if (contentList.get(position) instanceof HomeType) |
| | |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.BaseActivity; |
| | | import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; |
| | | import com.weikou.beibeivideo.util.ConfigUtil; |
| | | import com.weikou.beibeivideo.util.browser.BWJavaInterface; |
| | | import com.weikou.beibeivideo.util.downutil.DownFiles; |
| | | import com.weikou.beibeivideo.util.downutil.DownFiles.IProgress; |
| | | import com.weikou.beibeivideo.util.ui.TopStatusSettings; |
| | | import com.weikou.beibeivideo.widget.CustomWebView; |
| | | import com.yeshi.video.player.util.PlayerFullScreenUtil; |
| | | |
| | | import java.util.Set; |
| | | |
| | | public class VideoPlayerBrowserActivity extends BaseActivity implements OnClickListener { |
| | | |
| | |
| | | return true; |
| | | } else if (url.contains("/tbopen/") || url.startsWith("tbopen://")) { |
| | | return true; |
| | | } else if (url.startsWith("tenvideo2://") || url.startsWith("iqiyi://") || url.startsWith("youku://") || url.startsWith("imgotv://")) { |
| | | try { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | startActivity(intent); |
| | | } catch (Exception e) { |
| | | } else if (!url.startsWith("http")) { |
| | | Set<String> prefixSet = ConfigUtil.getPlayerJumpOutProtocolPrefix(getApplicationContext()); |
| | | prefixSet.add("tenvideo2://"); |
| | | prefixSet.add("iqiyi://"); |
| | | prefixSet.add("youku://"); |
| | | prefixSet.add("imgotv://"); |
| | | |
| | | for (String prefix : prefixSet) { |
| | | if (url.startsWith(prefix)) { |
| | | try { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | startActivity(intent); |
| | | } catch (Exception e) { |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | return true; |
| | | } else if (!url.startsWith("http")) |
| | | return true; |
| | | } |
| | | |
| | | |
| | | return super.shouldOverrideUrlLoading(view, request); |
| | | } |
| | |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.weikou.beibeivideo.entity.HomeAd; |
| | | import com.weikou.beibeivideo.entity.vo.BannerVO; |
| | | |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | public class ConfigUtil { |
| | |
| | | public static BannerVO getMinePageBanner(Context context) { |
| | | try { |
| | | String config = getConfig("minePageBanner", context); |
| | | if (StringUtils.isEmpty(config)) { |
| | | BannerVO bannerVO = new Gson().fromJson(config, BannerVO.class); |
| | | return bannerVO; |
| | | if (!StringUtils.isEmpty(config)) { |
| | | JSONObject jsonObject = new JSONObject(config); |
| | | JSONObject params = jsonObject.optJSONObject("params"); |
| | | jsonObject.remove("params"); |
| | | BannerVO bannerVO = new Gson().fromJson(jsonObject.toString(), BannerVO.class); |
| | | if (params != null) { |
| | | bannerVO.setParams(params.toString()); |
| | | } |
| | | if (bannerVO.isShow()) |
| | | return bannerVO; |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | e.getMessage(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存播放器外跳协议 |
| | | * |
| | | * @param context |
| | | * @param content |
| | | */ |
| | | public static void savePlayerJumpOutProtocolPrefix(Context context, String content) { |
| | | saveConfig("jumpAppProtocolPrefix", content, context); |
| | | } |
| | | |
| | | public static Set<String> getPlayerJumpOutProtocolPrefix(Context context) { |
| | | try { |
| | | String config = getConfig("jumpAppProtocolPrefix", context); |
| | | if (!StringUtils.isEmpty(config)) { |
| | | Type type = new TypeToken<Set<String>>() { |
| | | }.getType(); |
| | | return new Gson().fromJson(config, type); |
| | | } |
| | | } catch (Exception e) { |
| | | e.getMessage(); |
| | | } |
| | | return new HashSet<>(); |
| | | } |
| | | |
| | | |
| | | private static void saveConfig(String key, String value, Context context) { |
| | | SharedPreferences.Editor editor = context.getSharedPreferences("config", Context.MODE_PRIVATE).edit(); |
| | | editor.putString(key, value); |
| | |
| | | import com.tencent.mm.opensdk.openapi.WXAPIFactory; |
| | | import com.weikou.beibeivideo.entity.JumpDetail; |
| | | import com.weikou.beibeivideo.ui.login.LoginActivity; |
| | | import com.weikou.beibeivideo.ui.mine.BrowserActivity; |
| | | |
| | | import org.json.JSONException; |
| | | |
| | |
| | | |
| | | break; |
| | | |
| | | case "web": |
| | | if (params == null) |
| | | return; |
| | | { |
| | | String webUrl = params.getString("url").toString(); |
| | | String title = params.getString("title"); |
| | | context.startActivity(new Intent(context, BrowserActivity.class).putExtra("url", webUrl).putExtra("title", title)); |
| | | } |
| | | |
| | | |
| | | break; |
| | | |
| | | default: { |
| | | try { |
| | | Intent intent = new Intent(context, Class.forName(JumpActivityUtil.filterActivityName(detail.getActivity()))); |
| | |
| | | ll_ad_info.setVisibility(VISIBLE); |
| | | ll_author_info.setVisibility(GONE); |
| | | Glide.with(getContext()).load(data.getImageUrls().get(0)).apply(new RequestOptions().centerCrop().placeholder(R.color.img_bg)).transition(withCrossFade()).into(iv_video_pciture); |
| | | Glide.with(getContext()).load(data.getBaiduLogoUrl()).apply(new RequestOptions().centerCrop().placeholder(R.color.img_bg)).transition(withCrossFade()).into(iv_baidu_logo); |
| | | iv_baidu_logo.setImageResource(R.drawable.new_bg_logo); |
| | | // Glide.with(getContext()).load(getContext().getDrawable(R.)).apply(new RequestOptions().centerCrop().placeholder(R.color.img_bg)).transition(withCrossFade()).into(iv_baidu_logo); |
| | | |
| | | ll_ad_info.setOnClickListener(new OnClickListener() { |
| | | @Override |