BuWanVideo/build.gradle
@@ -96,8 +96,8 @@ defaultConfig { applicationId "com.doudou.ysvideo" versionCode 111 versionName "3.9.2" versionCode 114 versionName "3.9.5" multiDexEnabled = true minSdkVersion 17 targetSdkVersion 27 BuWanVideo/libs/open_ad_sdk.aarBinary files differ
BuWanVideo/res/drawable-xhdpi/ic_gold_corn_sign_in_gold.pngBuWanVideo/res/drawable-xhdpi/ic_video_detail_favourite1.pngBuWanVideo/res/drawable-xhdpi/ic_video_detail_share.pngBuWanVideo/res/drawable-xhdpi/icon_mine_buy_record.png
BuWanVideo/res/drawable-xhdpi/icon_right_ad_close.png
BuWanVideo/res/layout/fragment_episode.xml
@@ -93,7 +93,7 @@ <ImageView android:id="@+id/iv_add_to_favourite" android:layout_width="wrap_content" android:layout_height="21dp" android:layout_height="match_parent" android:src="@drawable/selector_favourite" /> BuWanVideo/res/layout/item_video_detail_ad.xml
@@ -58,6 +58,7 @@ android:layout_height="wrap_content" android:layout_gravity="top|right" android:layout_marginTop="5dp" android:layout_marginRight="10dp" android:background="@drawable/shape_splash_ad" android:gravity="center_vertical|right" android:orientation="horizontal"> @@ -71,9 +72,10 @@ android:textSize="12sp" /> <View android:background="#FFFFFF" android:id="@+id/v_cutline" android:layout_width="1dp" android:layout_height="match_parent" android:layout_height="12dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp"></View> BuWanVideo/res/layout/mine_fragment.xml
@@ -399,6 +399,32 @@ android:layout_height="wrap_content" android:layout_marginTop="36.5dp"> <RelativeLayout android:id="@+id/rl_mine_buy_record" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="20dp" android:layout_centerHorizontal="true" android:src="@drawable/icon_mine_buy_record"></ImageView> <TextView android:id="@+id/tv_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginTop="28dp" android:text="购买记录" android:textColor="@color/mine_item_title_text_color" android:textSize="@dimen/mine_item_name"></TextView> </RelativeLayout> <View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="2"></View> <RelativeLayout android:id="@+id/rl_mine_about_us" @@ -442,35 +468,12 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginTop="28dp" android:text="设置" android:text="   设置   " android:textColor="@color/mine_item_title_text_color" android:textSize="@dimen/mine_item_name"></TextView> </RelativeLayout> <View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="2"></View> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="invisible"> <ImageView android:layout_width="wrap_content" android:layout_height="20dp" android:src="@drawable/ic_mine_help"></ImageView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginTop="28dp" android:text="帮助中心" android:textColor="@color/mine_item_title_text_color" android:textSize="10sp"></TextView> </RelativeLayout> </LinearLayout> BuWanVideo/res/layout/recommend_fragment.xml
@@ -41,13 +41,31 @@ </com.weikou.beibeivideo.widget.MySwipeRefreshLayout> <ImageView android:id="@+id/iv_right_ad" <LinearLayout android:id="@+id/ll_right_ad" android:layout_width="wrap_content" android:layout_height="80dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical|right" android:layout_marginTop="100dp" android:visibility="gone" /> android:gravity="center_horizontal" android:orientation="vertical" android:visibility="gone"> <ImageView android:id="@+id/iv_right_ad" android:layout_width="wrap_content" android:layout_height="80dp" /> <ImageView android:id="@+id/iv_right_ad_close" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="3dp" android:src="@drawable/icon_right_ad_close"></ImageView> </LinearLayout> </FrameLayout> BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java
@@ -1158,13 +1158,11 @@ 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); commonPost(context, BASE_URL + "session/uploadSession", params, handler); } @@ -1355,6 +1353,48 @@ commonPost(context, BASE_URL + "video/play/pptvPlay", params, handler); } public static void pptvFinishPlay(Context context, String cid, String vid, Integer currentTime, ResponseHandlerInterface handler) { String loginUid = UserUtil.getLoginUid(context); String uid = UserUtil.getUid(context); LinkedHashMap<String, String> params = new LinkedHashMap<>(); if (loginUid != null) params.put("loginUid", loginUid); if (uid != null) params.put("Uid", uid); params.put("cid", cid); params.put("vid", vid); if (currentTime != null) { params.put("currentTime", currentTime + ""); } commonPost(context, BASE_URL + "video/play/pptvFinishPlay", params, handler); } /** * 获取PPTV的播放状态 * * @param context * @param cid * @param vid * @param handler */ public static void getPPTVVideoPlayState(Context context, String cid, String vid, ResponseHandlerInterface handler) { String loginUid = UserUtil.getLoginUid(context); String uid = UserUtil.getUid(context); LinkedHashMap<String, String> params = new LinkedHashMap<>(); if (loginUid != null) params.put("loginUid", loginUid); if (uid != null) params.put("Uid", uid); params.put("cid", cid); params.put("vid", vid); commonPost(context, BASE_URL + "video/play/getPPTVVideoPlayState", params, handler); } /** * 付费视频的购买活动 BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoApplication.java
@@ -12,7 +12,9 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import androidx.multidex.MultiDex; import android.util.Log; import com.alibaba.baichuan.android.trade.AlibcTradeSDK; @@ -132,8 +134,8 @@ CrashHandler crashHandler = CrashHandler.getInstance(); crashHandler.init(getApplicationContext()); } this.registerActivityLifecycleCallbacks(new MyActivityLifecycleCallbacks()); //取消热启动开屏广告 // this.registerActivityLifecycleCallbacks(new MyActivityLifecycleCallbacks()); application = this; MultiDex.install(this); //友盟初始化 BuWanVideo/src/com/weikou/beibeivideo/entity/vo/CouponVideoInfo.java
@@ -2,10 +2,12 @@ import com.weikou.beibeivideo.entity.JumpDetail; import java.io.Serializable; /** * 用券视频信息 */ public class CouponVideoInfo { public class CouponVideoInfo implements Serializable { private String picture; private JumpDetail jumpDetail; private String params; BuWanVideo/src/com/weikou/beibeivideo/entity/vo/GoldCornTask.java
@@ -1,8 +1,13 @@ package com.weikou.beibeivideo.entity.vo; import android.os.Parcel; import android.os.Parcelable; import com.weikou.beibeivideo.entity.JumpDetail; public class GoldCornTask { import java.io.Serializable; public class GoldCornTask implements Serializable { private String sourceCode; private String icon; @@ -85,4 +90,5 @@ public void setEnable(boolean enable) { this.enable = enable; } } BuWanVideo/src/com/weikou/beibeivideo/receiver/APPInstallReceiver.java
@@ -1,16 +1,10 @@ package com.weikou.beibeivideo.receiver; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Handler; import com.lcjian.library.util.common.StringUtils; import com.weikou.beibeivideo.BeibeiVideoApplication; import com.weikou.beibeivideo.ui.recommend.RecommendAdapter; public class APPInstallReceiver extends BroadcastReceiver { @@ -30,31 +24,7 @@ @Override public void run() { if (packageName != null && packageName .equalsIgnoreCase(RecommendAdapter.MM_PACKAGE_NAME) && !StringUtils .isBlank(BeibeiVideoApplication.MMNumber)) { if (packageName .equalsIgnoreCase(RecommendAdapter.MM_PACKAGE_NAME)) { Intent intent = new Intent(); intent.setComponent(new ComponentName( RecommendAdapter.MM_PACKAGE_NAME, RecommendAdapter.MM_CLASS_NAME)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction("com.memezhibo.android.exportedAction");// 么么直播action名 intent.putExtra("room_id", Long .parseLong(BeibeiVideoApplication.MMNumber)); try { mContext.startActivity(intent); } catch (ActivityNotFoundException e) { } } } } }, time); } BuWanVideo/src/com/weikou/beibeivideo/ui/SplashActivity.java
@@ -16,8 +16,10 @@ import android.os.Build; import android.os.Bundle; import android.provider.Settings; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import android.telephony.TelephonyManager; import android.view.KeyEvent; import android.view.ViewGroup; @@ -283,8 +285,10 @@ GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; GDTConstant.PID_HOME_RECOMMEND_BIG_IMG = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; GDTConstant.PID_2_VIDEO_DETAIL_PLAYER_PRE_PPTV = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; GDTConstant.PID_2_EXIT = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; CSJConstant.RECOMMEND_BIG_IMG_AD = CSJConstant.INVALID_AD; CSJConstant.PPTV_INTERSTITIALAD = CSJConstant.INVALID_AD; } //获取广告 @@ -470,6 +474,9 @@ ConfigUtil.savePlayerJumpOutProtocolPrefix(getApplicationContext(), data.optString("jumpAppProtocolPrefix")); //保存购买记录 ConfigUtil.saveBuyRecordUrl(getApplicationContext(), data.optString("buyRecordUrl")); //保存免广告权益持续时间 AdUtil.setPPTVNoAdRewardHour(getApplicationContext(), pptvNoAdRewardHour); BuWanVideo/src/com/weikou/beibeivideo/ui/ad/SplashADFragment.java
@@ -2,9 +2,11 @@ import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -112,8 +114,7 @@ fl_ad.removeAllViews(); //把SplashView 添加到ViewGroup中 fl_ad.addView(view); //设置SplashView的交互监听器 ad.setNotAllowSdkCountdown(); ad.setSplashInteractionListener(new TTSplashAd.AdInteractionListener() { @Override public void onAdClicked(View view, int type) { @@ -137,59 +138,62 @@ mAdShowListener.onClose(); } }); if (timer != null) timer.cancel(); timer = new Timer(); ll_input.setVisibility(View.VISIBLE); timer.schedule(new TimerTask() { @Override public void run() { leftTime--; if (leftTime < 0) { timer.cancel(); if (ad_close_time != null) ad_close_time.post(new Runnable() { @Override public void run() { if (ad_close_time != null) ad_close_time.setVisibility(View.GONE); if (vclick) { if (ll_input != null) ll_input.setClickable(true); } else { if (mAdShowListener != null) mAdShowListener.onClose(); } } }); return; } else { //倒计时 if (ad_close_time != null) ad_close_time.post(new Runnable() { @Override public void run() { if (ad_close_time != null) ad_close_time.setText(leftTime + ""); } }); if (vclick) { ll_input.setClickable(false); } } } }, 1000, 1000); ll_input.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mAdShowListener.onClose(); } }); //设置SplashView的交互监听器 // ad.setNotAllowSdkCountdown(); //自定义跳过按钮 // if (timer != null) // timer.cancel(); // timer = new Timer(); // ll_input.setVisibility(View.VISIBLE); // timer.schedule(new TimerTask() { // @Override // public void run() { // leftTime--; // if (leftTime < 0) { // timer.cancel(); // if (ad_close_time != null) // ad_close_time.post(new Runnable() { // @Override // public void run() { // if (ad_close_time != null) // ad_close_time.setVisibility(View.GONE); // if (vclick) { // if (ll_input != null) // ll_input.setClickable(true); // } else { // if (mAdShowListener != null) // mAdShowListener.onClose(); // } // // } // }); // // // return; // } else { // //倒计时 // if (ad_close_time != null) // ad_close_time.post(new Runnable() { // @Override // public void run() { // if (ad_close_time != null) // ad_close_time.setText(leftTime + ""); // } // }); // if (vclick) { // ll_input.setClickable(false); // } // } // } // }, 1000, 1000); // // // ll_input.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // mAdShowListener.onClose(); // } // }); adLoadInfo = null; } else if (adLoadInfo.getGdtSplashAd() != null) { @@ -221,6 +225,9 @@ ll_input = root.findViewById(R.id.ll_input); ad_close_time = root.findViewById(R.id.ad_close_time); fl_ad = root.findViewById(R.id.fl_ad); ll_input.setVisibility(View.GONE); ad_close_time.setVisibility(View.GONE); } @Nullable @@ -237,7 +244,7 @@ adPidInfo2 = (AdPidInfo) arguments.getSerializable("pid2"); } loadAd(getContext(), adPidInfo1, adPidInfo2, ll_input, ad_close_time, true, new SplashADFragment.AdLoadResultListener() { loadAd(getContext(), adPidInfo1, adPidInfo2, null, null, true, new SplashADFragment.AdLoadResultListener() { @Override public void onAdLoad(SplashAdLoadInfo adLoadInfo) { BuWanVideo/src/com/weikou/beibeivideo/ui/category/CategoryRecommendAdapter.java
@@ -1,6 +1,7 @@ package com.weikou.beibeivideo.ui.category; import android.app.Activity; import android.content.Intent; import android.graphics.Canvas; import android.graphics.Rect; @@ -19,6 +20,7 @@ import com.weikou.beibeivideo.entity.CategoryRecommendVideo; import com.weikou.beibeivideo.entity.VideoInfo; import com.weikou.beibeivideo.entity.VideoType; import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; import com.weikou.beibeivideo.ui.video.VideoColumn2Adapter; import com.weikou.beibeivideo.R; import com.weikou.beibeivideo.util.ad.HomeAdUtil; @@ -197,7 +199,13 @@ public void onBannerClick(int position) { if (position >= bannerList.size()) return; // HomeAdUtil.jump(bannerList.get(position), getActivity()); Intent intent = new Intent(mContext, VideoDetailActivity2.class); if (bannerList.get(position).getVideoInfo() != null) { intent.putExtra("video_info", bannerList.get(position).getVideoInfo()); intent.putExtra("from", "banner"); mContext.startActivity(intent); } } }); } BuWanVideo/src/com/weikou/beibeivideo/ui/main/GoldCornFragment.java
@@ -1,7 +1,10 @@ package com.weikou.beibeivideo.ui.main; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.Toast; @@ -107,21 +110,51 @@ @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (savedInstanceState != null) if (savedInstanceState != null) { signInInfo = (SignInInfo) savedInstanceState.getSerializable("signInfo"); String taskListStr = savedInstanceState.getString("taskList", null); Gson gson = new Gson(); if (taskListStr != null) { Type type = new TypeToken<List<GoldCornTask>>() { }.getType(); taskList = gson.fromJson(taskListStr, type); } String videoListStr = savedInstanceState.getString("videoList", null); if (videoListStr != null) { Type type = new TypeToken<List<CouponVideoInfo>>() { }.getType(); videoList = gson.fromJson(videoListStr, type); } } } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) if (savedInstanceState != null) { signInInfo = (SignInInfo) savedInstanceState.getSerializable("signInfo"); String taskListStr = savedInstanceState.getString("taskList", null); Gson gson = new Gson(); if (taskListStr != null) { Type type = new TypeToken<List<GoldCornTask>>() { }.getType(); taskList = gson.fromJson(taskListStr, type); } String videoListStr = savedInstanceState.getString("videoList", null); if (videoListStr != null) { Type type = new TypeToken<List<CouponVideoInfo>>() { }.getType(); videoList = gson.fromJson(videoListStr, type); } } } private void initData() { mGoldCornAdapter = new GoldCornAdapter(getActivity(), videoList, taskList, couponExchangeUrl, signInInfo, this); rv_goldcorn.setAdapter(mGoldCornAdapter); rv_goldcorn.setLayoutManager(new LinearLayoutManager(getContext())); rv_goldcorn.setLayoutManager(new XLinearLayoutManager(getContext())); } private boolean first; @@ -307,7 +340,39 @@ @Override public void onSaveInstanceState(@NonNull Bundle outState) { outState.putSerializable("signInfo", signInInfo); if (taskList != null) outState.putString("taskList", new Gson().toJson(taskList)); if (videoList != null) outState.putString("videoList", new Gson().toJson(videoList)); super.onSaveInstanceState(outState); } public class XLinearLayoutManager extends LinearLayoutManager { public XLinearLayoutManager(Context context) { super(context); } public XLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } public XLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { try { super.onLayoutChildren(recycler, state); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } } } } BuWanVideo/src/com/weikou/beibeivideo/ui/main/MainActivity.java
@@ -99,6 +99,8 @@ private FrameLayout fl_category; public static boolean showRecommendRightAd = true; SharedPreferences preferences;// 广告商城,获取图标状态信息 private boolean isHaveNewCom;// 是否存在新的评论消息 @@ -244,7 +246,6 @@ } return new VideoOption.Builder().build(); } private String getDay(long time) { @@ -592,50 +593,48 @@ String position = intent.getStringExtra("position"); if (StringUtils.isEmpty(position)) return; switch (Integer.parseInt(position)) { case 0: rg_nav.check(R.id.rb_nav_recommend); final String cposition = intent.getStringExtra("cposition"); if (StringUtils.isEmpty(cposition)) { break; } String goldcorn = intent.getStringExtra("goldcorn"); if (!StringUtils.isEmpty(goldcorn)) { GoldCornFragment.GoldCornExpireInfo info = new GoldCornFragment.GoldCornExpireInfo(); info.goldcorn = goldcorn; //2分钟 info.expireTime = System.currentTimeMillis() + 1000 * 60 * 2; BeibeiConstant.watchVideoGoldCorn = info; } rg_nav.post(new Runnable() { @Override public void run() { EventBus.getDefault().post(new HomeTabChangeInfo(Integer.parseInt(cposition))); try { switch (Integer.parseInt(position)) { case 0: findViewById(R.id.rb_nav_recommend).performClick(); final String cposition = intent.getStringExtra("cposition"); if (StringUtils.isEmpty(cposition)) { break; } }); break; case 1: rg_nav.check(R.id.rb_nav_discover); break; case 2: rg_nav.check(R.id.rb_gold_corn); break; case 3: rg_nav.check(R.id.rb_guess_like); break; case 4: rg_nav.check(R.id.rb_nav_mine); break; String goldcorn = intent.getStringExtra("goldcorn"); if (!StringUtils.isEmpty(goldcorn)) { GoldCornFragment.GoldCornExpireInfo info = new GoldCornFragment.GoldCornExpireInfo(); info.goldcorn = goldcorn; //2分钟 info.expireTime = System.currentTimeMillis() + 1000 * 60 * 2; BeibeiConstant.watchVideoGoldCorn = info; } rg_nav.post(new Runnable() { @Override public void run() { EventBus.getDefault().post(new HomeTabChangeInfo(Integer.parseInt(cposition))); } }); break; case 1: findViewById(R.id.rb_nav_discover).performClick(); break; case 2: findViewById(R.id.rb_gold_corn).performClick(); break; case 3: findViewById(R.id.rb_guess_like).performClick(); break; case 4: findViewById(R.id.rb_nav_mine).performClick(); break; } } catch (Exception e) { } super.onNewIntent(intent); } } BuWanVideo/src/com/weikou/beibeivideo/ui/main/MineFragment.java
@@ -8,9 +8,11 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.database.Cursor; import android.os.Bundle; import androidx.loader.app.LoaderManager; import androidx.loader.content.CursorLoader; import androidx.loader.content.Loader; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; @@ -100,7 +102,7 @@ private LinearLayout ll_mine_favourite, ll_mine_follow, ll_mine_watch_history; private RelativeLayout rl_mine_message, rl_mine_share, rl_mine_help, rl_mine_about_us, rl_mine_settings; private RelativeLayout rl_mine_message, rl_mine_share, rl_mine_help, rl_mine_buy_record, rl_mine_about_us, rl_mine_settings; private boolean isHaveNewCom;// 是否存在新的评论消息 @@ -154,6 +156,7 @@ rl_mine_share = contentView.findViewById(R.id.rl_mine_share); rl_mine_help = contentView.findViewById(R.id.rl_mine_help); rl_mine_about_us = contentView.findViewById(R.id.rl_mine_about_us); rl_mine_buy_record = contentView.findViewById(R.id.rl_mine_buy_record); rl_mine_settings = contentView.findViewById(R.id.rl_mine_settings); @@ -194,6 +197,7 @@ rl_mine_settings.setOnClickListener(this); rl_mine_share.setOnClickListener(this); tv_vip_open.setOnClickListener(this); rl_mine_buy_record.setOnClickListener(this); getLoaderManager().initLoader(0, null, this); } @@ -283,9 +287,21 @@ case R.id.rl_mine_about_us: Intent intent1 = new Intent(getContext(), BrowserActivity.class); intent1.putExtra("url", BeibeiConstant.ABOUT_US); // intent1.putExtra("url", "http://192.168.3.122/buyVideo/index.html?infoId=23099"); // intent1.putExtra("url", "http://192.168.3.122:8848/BuWanWeb/yzhh/index.html"); startActivity(intent1); break; case R.id.rl_mine_buy_record: { String url = ConfigUtil.getBuyRecordUrl(getContext()); if (StringUtils.isEmpty(url)) return; Intent intent11 = new Intent(getContext(), BrowserActivity.class); intent11.putExtra("url", url); startActivity(intent11); } break; case R.id.rl_mine_settings: startActivity(new Intent(tv_no_network.getContext(), SettingsActivity.class)); break; BuWanVideo/src/com/weikou/beibeivideo/ui/media/VideoDetailActivity2.java
@@ -167,6 +167,8 @@ setContentView(R.layout.video_detail_activity); VideoUtil.clearVideoEpisodeList(this); TopStatusSettings.setStatusViewAndDeepColor(this); //屏幕常亮 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); //广告 mVideoDetailVideoAdFragment = new PlayVideoPreADFragment(); @@ -322,11 +324,11 @@ private synchronized void startPlay() { //移除所有的fragment if (mVideoDetailVideoAdFragment.isAdded()) { getSupportFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commit(); getSupportFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commitAllowingStateLoss(); } if (mFunshionPlayerFragment.isAdded()) { getSupportFragmentManager().beginTransaction().remove(mFunshionPlayerFragment).commit(); getSupportFragmentManager().beginTransaction().remove(mFunshionPlayerFragment).commitAllowingStateLoss(); } iv_select_play.setVisibility(View.GONE); @@ -742,7 +744,7 @@ if (StringUtils.isEmpty(sessionId)) { return; } BeibeiVideoAPI.uploadSession(getApplicationContext(), sessionId, "videoDetail", new BasicTextHttpResponseHandler() { BeibeiVideoAPI.uploadSession(BeibeiVideoApplication.application, sessionId, "videoDetail", new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { } @@ -826,6 +828,7 @@ bundle.putString("playUrl", playUrl); bundle.putString("videoId", data.optString("videoId")); bundle.putString("name", data.optString("name")); bundle.putBoolean("vip", data.optBoolean("vip", false)); pptvPlayFragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.fl_pptv, pptvPlayFragment).commit(); if (progressDialog.isShowing()) { @@ -1186,10 +1189,12 @@ @Override protected void onDestroy() { super.onDestroy(); if (BeibeiConstant.AD_TYPE != null && BeibeiConstant.AD_TYPE.isVideoDetailSplashAd()) FullVideoAdManager.getInstance().loadAd(BeibeiVideoApplication.application, null); uploadSession(); GoldCornUtil.removeCallbacks(fl_video_play_background, makeGoldCornRunnable); //屏幕常亮 getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); super.onDestroy(); } } BuWanVideo/src/com/weikou/beibeivideo/ui/mine/PPTVPlayFragment.java
@@ -33,6 +33,11 @@ import android.widget.Toast; import com.androidquery.AQuery; import com.bytedance.sdk.openadsdk.AdSlot; import com.bytedance.sdk.openadsdk.TTAdConstant; import com.bytedance.sdk.openadsdk.TTAdNative; import com.bytedance.sdk.openadsdk.TTAdSdk; import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; import com.google.gson.Gson; import com.lcjian.library.RetainViewFragment; import com.lcjian.library.dialog.DialogUtil; @@ -71,6 +76,7 @@ import org.apache.http.Header; import org.json.JSONObject; import java.security.KeyStore; import java.util.HashMap; import java.util.Map; @@ -161,8 +167,17 @@ adPlayFinish(); } setLeftTime(); String js = ""; js += "function getQueryString(name) {\n" + "\t\tvar reg = new RegExp(\"(^|&)\" + name + \"=([^&]*)(&|$)\", \"i\");\n" + "\t\tvar r = window.location.search.substr(1).match(reg);\n" + "\t\tif (r != null) return unescape(r[2]);\n" + "\t\treturn null;\n" + "\t}"; String js = " $('video').on('timeupdate', function(event){ console.log('视频进度变化');});"; js += "var getPlayInfo = function() {var video = document.querySelector(\"video\"); ppyestv.stopPlay(getQueryString('cid'),getQueryString('vid'),parseInt( video.currentTime)); };"; js += "window.onbeforeunload =getPlayInfo;"; webView.loadUrl("javascript:" + js); } @@ -234,13 +249,13 @@ query.id(R.id.tv_top_bar_left1).visibility(View.GONE); } }); WebSettings webSetting = webview.getSettings(); webSetting.setJavaScriptEnabled(true); webSetting.setTextZoom(100); webSetting.setBlockNetworkImage(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); initWebSetting(); //开启硬件加速 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { webview.setLayerType(View.LAYER_TYPE_HARDWARE, null); } webview.addJavascriptInterface(new PPJavaInterface(BeibeiVideoApplication.application, new PPJavaInterface.IEventListener() { @Override public void onLogin() { @@ -248,6 +263,7 @@ getActivity().runOnUiThread(new Runnable() { @Override public void run() { code = REQUEST_CODE_LOGIN; Intent intent = new Intent(getContext(), LoginActivity.class); intent.putExtra("result", true); startActivityForResult(intent, REQUEST_CODE_LOGIN); @@ -285,6 +301,32 @@ }), "ppyestv"); } private void initWebSetting() { WebSettings webSetting = webview.getSettings(); webSetting.setJavaScriptEnabled(true); webSetting.setTextZoom(100); webSetting.setBlockNetworkImage(false); webSetting.setJavaScriptEnabled(true); webSetting.setJavaScriptCanOpenWindowsAutomatically(true); webSetting.setAllowFileAccess(true); webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); webSetting.setSupportZoom(false); webSetting.setBuiltInZoomControls(true); webSetting.setUseWideViewPort(true); webSetting.setSupportMultipleWindows(true); webSetting.setLoadWithOverviewMode(true); webSetting.setAppCacheEnabled(true); webSetting.setDatabaseEnabled(true); webSetting.setDomStorageEnabled(true); webSetting.setGeolocationEnabled(true); webSetting.setAppCacheMaxSize(Long.MAX_VALUE); webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND); webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { @@ -298,8 +340,6 @@ } private String videoId; //是否为VIP视频 private boolean isVIPVideo; @Override public void onCreateView(View contentView, Bundle savedInstanceState) { @@ -313,7 +353,6 @@ tv_title.setText(title); videoId = bundle.getString("videoId"); isVIPVideo = bundle.getBoolean("vip", false); webview.loadUrl(url); View view = LayoutInflater.from(getContext()).inflate(R.layout.item_jump_video_loading, null); Toast toast = ToastUtil.showMiddleToast(getContext(), view, Toast.LENGTH_SHORT); @@ -328,6 +367,29 @@ } }, 1000); } } //获取视频状态 private void getPPTVVideoPlayState(String cid, String vid, final IPPTVVideoState stateListener) { BeibeiVideoAPI.getPPTVVideoPlayState(BeibeiVideoApplication.application, cid, vid, new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.optBoolean("IsPost")) { JSONObject data = jsonObject.optJSONObject("Data"); PPTVVideoState pptvVideoState = new Gson().fromJson(data.toString(), PPTVVideoState.class); stateListener.onSuccess(pptvVideoState); } else { stateListener.onFail(jsonObject.optString("Error")); } } @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); stateListener.onFail("网络请求出错"); } }); } private VIPNewDialog vipNewDialog; @@ -367,11 +429,14 @@ @Override public void onClick(PPTVWatchVIPVideoActivityWay way) { DialogUtil.dismiss(vipNewDialog); if ("vip".equalsIgnoreCase(way.getType())) { jumpToVIP(); } else { if (way.getJumpDetail() != null) if (way.getJumpDetail() != null) { code = REQUEST_CODE_VIP; JumpActivityUtil.jumpPage(getActivity(), way.getJumpDetail(), JumpActivityUtil.getParamsJSON(way.getParams())); } } } }).create(); @@ -503,17 +568,6 @@ } private void initData() { if (UserUtil.isVIP(BeibeiVideoApplication.application)) { tv_vip_open.setText("VIP续费"); } else { tv_vip_open.setText("开通VIP"); } isCollect(); setLeftTime(); } private void setLeftTime() { if (tv_no_ad_reward_notify == null) return; @@ -537,33 +591,35 @@ public void onResume() { super.onResume(); MobclickAgent.onPageStart("网页"); if (code == REQUEST_CODE_VIP) { code = -1; UserUtil.updateUserInfo(BeibeiVideoApplication.application, new UserUtil.IUserInfoUpdateListener() { @Override public void noLogin() { } @Override public void onSuccess() { ll_vip_open.post(new Runnable() { switch (code) { case REQUEST_CODE_LOGIN: UserUtil.updateUserInfo(BeibeiVideoApplication.application, null); case REQUEST_CODE_VIP: String[] cvid = getPPVideoInfo(tv_url.getText() + ""); if (cvid != null && cvid.length > 1) getPPTVVideoPlayState(cvid[0], cvid[1], new IPPTVVideoState() { @Override public void run() { initData(); if (webview != null) webview.reload(); public void onSuccess(PPTVVideoState state) { if (state.bought || state.vipUser) { if (mVideoDetailVideoAdFragment != null && mVideoDetailVideoAdFragment.isAdded()) getChildFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commitAllowingStateLoss(); if (fl_ad != null) fl_ad.setVisibility(View.GONE); if (webview != null) webview.reload(); } } @Override public void onFail(String msg) { } }); } @Override public void onFail(String msg) { } }); break; } initData(); code = -1; setLeftTime(); } @Override @@ -575,12 +631,16 @@ @Override public void onDestroy() { if (webview != null) { webview.loadUrl("javascript:getPlayInfo();"); webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); webview.clearHistory(); ((ViewGroup) webview.getParent()).removeView(webview); webview.destroy(); webview = null; } if (mttFullVideoAd != null) { mttFullVideoAd = null; } super.onDestroy(); } @@ -631,76 +691,6 @@ } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResdult:" + requestCode); //从登录返回来的 if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case REQUEST_CODE_VIP: Log.i(TAG, "REQUEST_CODE_VIP"); UserUtil.updateUserInfo(BeibeiVideoApplication.application, new UserUtil.IUserInfoUpdateListener() { @Override public void noLogin() { } @Override public void onSuccess() { ll_vip_open.post(new Runnable() { @Override public void run() { initData(); } }); } @Override public void onFail(String msg) { } }); break; case REQUEST_CODE_LOGIN: { Log.d(TAG, "登录成功"); showAd = false; UserUtil.updateUserInfo(BeibeiVideoApplication.application, new UserUtil.IUserInfoUpdateListener() { @Override public void noLogin() { } @Override public void onSuccess() { ll_vip_open.post(new Runnable() { @Override public void run() { initData(); webview.reload(); } }); } @Override public void onFail(String msg) { } }); } break; } } super.onActivityResult(requestCode, resultCode, data); } private void showRewardSuccessToast(boolean success) { fl_ad.post(new Runnable() { @@ -724,24 +714,72 @@ } private synchronized void playAd() { //VIP永久免广告 if (UserUtil.isVIP(getContext()) || AdUtil.isGetPPTVNoAdReward(BeibeiVideoApplication.application)) { adPlayFinish(); return; } private PPTVVideoState videoState; private synchronized void playAd() { videoState = null; //VIP永久免广告 String[] cvid = getPPVideoInfo(tv_url.getText() + ""); if (cvid != null && cvid.length > 1) getPPTVVideoPlayState(cvid[0], cvid[1], new IPPTVVideoState() { @Override public void onSuccess(PPTVVideoState state) { videoState = state; if (state != null) { if (state.getTitle() != null) tv_title.setText(state.getTitle()); if (state.bought || state.vipUser) { adPlayFinish(); return; } else { if (AdUtil.isGetPPTVNoAdReward(BeibeiVideoApplication.application)) { adPlayFinish(); return; } if (state.isShowInterstitialAd()) showInterstitialAd(); startPlayAd(); } } else { if (AdUtil.isGetPPTVNoAdReward(BeibeiVideoApplication.application)) { adPlayFinish(); return; } else { startPlayAd(); } } } @Override public void onFail(String msg) { if (AdUtil.isGetPPTVNoAdReward(BeibeiVideoApplication.application)) { adPlayFinish(); return; } } }); } private void startPlayAd() { fl_ad.setVisibility(View.VISIBLE); PlayVideoPreADSetting setting = new PlayVideoPreADSetting(AdUtil.AD_TYPE.gdt, BeibeiConstant.GDT_ID, GDTConstant.PID_2_VIDEO_DETAIL_PLAYER_PRE_PPTV, null); if (isVIPVideo) { setting.setOtherAction("0元看本片"); if (videoState != null && videoState.isVipVideo()) { if (videoState.canBuy) setting.setOtherAction("0元看本片"); else { setting.setOtherAction("开通VIP"); } } else { setting.setOtherAction("获取免广告权益"); } mVideoDetailVideoAdFragment = PlayVideoPreADFragment.newInstance(); Bundle bundle = new Bundle(); bundle.putInt("skipDuration", 15); bundle.putInt("skipDuration", 1); mVideoDetailVideoAdFragment.setArguments(bundle); mVideoDetailVideoAdFragment.setPageEventListener(new IPageEventListener() { @@ -782,6 +820,7 @@ } }); getChildFragmentManager().beginTransaction().replace(R.id.fl_ad, mVideoDetailVideoAdFragment).commitAllowingStateLoss(); } private void loadRewardAd() { @@ -871,8 +910,22 @@ private void adPlayFinish() { if (webview != null) webview.loadUrl("javascript:adPlayFinish()"); if (webview != null) { webview.loadUrl("javascript:adPlayFinish();"); //TODO 设置上次视频播放进度 String js = "var video = document.querySelector('video');\n" + "video.play = function() {\n" + "\tsetTimeout(function() {\n" + "\t\tvideo.currentTime = {播放位置}; video.play=null; \n" + "\t}, 2000);\n" + "\tconsole.log('获取到资源长度');\n" + "\treturn false;\n" + "};"; if (videoState != null && videoState.getPlayPosition() != null && videoState.getPlayPosition() > 0) webview.loadUrl("javascript:" + js.replace("{播放位置}", videoState.getPlayPosition() + "")); // webview.loadUrl("javascript: setTimeout(function(){H5Player.seekVideo(300);},2000);"); } } private boolean collected = false; @@ -927,4 +980,153 @@ }); } TTFullScreenVideoAd mttFullVideoAd = null; private boolean isInterstitialAdShown = false; private void showInterstitialAd() { if (isInterstitialAdShown) return; TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(getContext()); AdSlot adSlot = new AdSlot.Builder() .setCodeId(CSJConstant.PPTV_INTERSTITIALAD) //模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可 .setExpressViewAcceptedSize(300, 500) .setSupportDeepLink(true) .setOrientation(TTAdConstant.VERTICAL)//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL .build(); mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() { //请求广告失败 @Override public void onError(int code, String message) { } //广告物料加载完成的回调 @Override public void onFullScreenVideoAdLoad(TTFullScreenVideoAd ad) { mttFullVideoAd = ad; mttFullVideoAd.setFullScreenVideoAdInteractionListener(new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() { //广告的展示回调 @Override public void onAdShow() { isInterstitialAdShown = true; } //广告的下载bar点击回调 @Override public void onAdVideoBarClick() { } //广告关闭的回调 @Override public void onAdClose() { } //视频播放完毕的回调 @Override public void onVideoComplete() { } //跳过视频播放 @Override public void onSkippedVideo() { } }); } //广告视频/图片加载完成的回调,接入方可以在这个回调后展示广告 @Override public void onFullScreenVideoCached() { if (mttFullVideoAd != null) { //展示广告,并传入广告展示的场景 if (getActivity() != null) mttFullVideoAd.showFullScreenVideoAd(getActivity(), TTAdConstant.RitScenes.GAME_GIFT_BONUS, null); mttFullVideoAd = null; } } }); } interface IPPTVVideoState { public void onSuccess(PPTVVideoState state); public void onFail(String msg); } public class PPTVVideoState { private boolean vipUser; private boolean vipVideo; private boolean bought; private boolean canBuy; private String title; private Integer playPosition; //是否显示插屏广告 private boolean showInterstitialAd; public boolean isShowInterstitialAd() { return showInterstitialAd; } public void setShowInterstitialAd(boolean showInterstitialAd) { this.showInterstitialAd = showInterstitialAd; } public Integer getPlayPosition() { return playPosition; } public void setPlayPosition(Integer playPosition) { this.playPosition = playPosition; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public boolean isVipUser() { return vipUser; } public void setVipUser(boolean vipUser) { this.vipUser = vipUser; } public boolean isVipVideo() { return vipVideo; } public void setVipVideo(boolean vipVideo) { this.vipVideo = vipVideo; } public boolean isBought() { return bought; } public void setBought(boolean bought) { this.bought = bought; } public boolean isCanBuy() { return canBuy; } public void setCanBuy(boolean canBuy) { this.canBuy = canBuy; } } } BuWanVideo/src/com/weikou/beibeivideo/ui/recommend/CategoryRecommendFragment.java
@@ -7,6 +7,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.FrameLayout; @@ -87,8 +88,8 @@ }); fl_ad = new FrameLayout(rl_cate_recommed.getContext()); AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView .LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup .LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); fl_ad.setPadding(0, DimenUtils.dip2px(rl_cate_recommed.getContext(), 10), 0, 0); fl_ad.setLayoutParams(params); BuWanVideo/src/com/weikou/beibeivideo/ui/recommend/RecommendAdapter.java
File was deleted BuWanVideo/src/com/weikou/beibeivideo/ui/recommend/RecommendFragment.java
@@ -55,6 +55,7 @@ import com.weikou.beibeivideo.entity.ad.ExpressAdContainer; import com.weikou.beibeivideo.entity.recommend.HomeClass; import com.weikou.beibeivideo.ui.category.bean.HotStar; import com.weikou.beibeivideo.ui.main.MainActivity; import com.weikou.beibeivideo.ui.media.VideoDetailActivity; import com.weikou.beibeivideo.ui.mine.BrowserActivity; import com.weikou.beibeivideo.util.BeibeiConstant; @@ -108,6 +109,8 @@ private int position; private ImageView iv_right_ad; private ImageView iv_right_ad_close; private LinearLayout ll_right_ad; private boolean isBottom = false; @@ -274,12 +277,23 @@ int last = manager.findLastVisibleItemPosition(); int total = manager.getItemCount(); if (newState == RecyclerView.SCROLL_STATE_IDLE) { if ((!isLoad) && last == total - 1 && mHomeTypes.size() < homeTypeCount) { if (mHomeTypes != null && mHomeTypes.size() > 0 && !rl_recommend.isRefreshing()) {//列表中有数据才能加载更多 homeTypePage++; isLoad = true; loading.setVisibility(View.VISIBLE); getHomeType(homeTypePage); if ((!isLoad) && last == total - 1) { int nowHomeTypeCount = 0; if (mHomeTypes != null) for (Object object : mHomeTypes) { if (object instanceof HomeType) { nowHomeTypeCount++; } } if (nowHomeTypeCount < homeTypeCount) { if (mHomeTypes != null && mHomeTypes.size() > 0 && !rl_recommend.isRefreshing()) {//列表中有数据才能加载更多 homeTypePage++; isLoad = true; loading.setVisibility(View.VISIBLE); getHomeType(homeTypePage); } } } } @@ -295,6 +309,8 @@ rl_recommend.setClickable(false); iv_right_ad = contentView.findViewById(R.id.iv_right_ad); iv_right_ad_close = contentView.findViewById(R.id.iv_right_ad_close); ll_right_ad = contentView.findViewById(R.id.ll_right_ad); type = (HomeClass) getArguments().getSerializable("videotype"); position = (Integer) getArguments().get("position"); @@ -305,6 +321,16 @@ mHomeTypes = new ArrayList<HomeType>(); mHomeAds = new ArrayList<>(); iv_right_ad_close.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (ll_right_ad != null) { ll_right_ad.setVisibility(View.GONE); MainActivity.showRecommendRightAd = false; } } }); rl_recommend.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override @@ -522,10 +548,12 @@ final String downloadLink = jsonObject.optJSONObject("Data").optString("downloadLink"); Glide.with(context).load(img).into(iv_right_ad); if (mstatus.equalsIgnoreCase("0")) { iv_right_ad.setVisibility(View.GONE); ll_right_ad.setVisibility(View.GONE); } else { iv_right_ad.setVisibility(View.VISIBLE); if (MainActivity.showRecommendRightAd) ll_right_ad.setVisibility(View.VISIBLE); } iv_right_ad.setOnClickListener(new OnClickListener() { @Override @@ -555,7 +583,7 @@ } }); } else { iv_right_ad.setVisibility(View.GONE); ll_right_ad.setVisibility(View.GONE); } } } BuWanVideo/src/com/weikou/beibeivideo/ui/recommend/SearchActivity.java
@@ -96,7 +96,6 @@ private boolean touchSearchInput = false; private void initView() { fl_advertisement = findViewById(R.id.fl_advertisement); et_search_key = findViewById(R.id.et_search_key); @@ -125,15 +124,14 @@ if (actionId == EditorInfo.IME_ACTION_SEARCH) { if (StringUtils.isEmpty(et_search_key.getEditableText() .toString()) && StringUtils.isEmpty(et_search_key.getHint() .toString())) { + "") && StringUtils.isEmpty(et_search_key.getHint() + "")) { Toast.makeText(SearchActivity.this, "请输入搜索内容!", Toast.LENGTH_LONG).show(); return false; } else { if (!StringUtils.isEmpty(et_search_key.getEditableText() .toString())) { +"")) { jumpToSearch(et_search_key.getEditableText() .toString()); +""); } else { jumpToSearch(et_search_key.getHint() + ""); } BuWanVideo/src/com/weikou/beibeivideo/ui/recommend/SearchSuggestFragment.java
@@ -2,9 +2,11 @@ import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.text.Html; import android.view.LayoutInflater; import android.view.View; @@ -18,6 +20,7 @@ import com.weikou.beibeivideo.R; import com.weikou.beibeivideo.util.ui.DividerItemDecoration; import java.lang.reflect.Array; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; @@ -61,9 +64,12 @@ public void setData(String key, List<String> list) { this.key = key; if (mList == null) mList = new ArrayList<>(); mList.clear(); mList.addAll(list); adapter.notifyDataSetChanged(); if (adapter != null) adapter.notifyDataSetChanged(); } private OnItemClickListener clickListener; BuWanVideo/src/com/weikou/beibeivideo/util/ConfigUtil.java
@@ -108,6 +108,22 @@ } /** * 保存购买记录 * * @param context * @param content */ public static void saveBuyRecordUrl(Context context, String content) { saveConfig("buyRecordUrl", content, context); } public static String getBuyRecordUrl(Context context) { return getConfig("buyRecordUrl", context); } private static void saveConfig(String key, String value, Context context) { SharedPreferences.Editor editor = context.getSharedPreferences("config", Context.MODE_PRIVATE).edit(); editor.putString(key, value); BuWanVideo/src/com/weikou/beibeivideo/util/ExitDialog.java
@@ -45,7 +45,10 @@ public Builder(Activity context) { this.context = context; expressAdManager = new ExpressAdManager(AdUtil.getAdType(context, AdPositionEnum.exitApp), context); AdUtil.AD_TYPE adType = AdUtil.getAdType(context, AdPositionEnum.exitApp); if (adType == AdUtil.AD_TYPE.gdt) adType = AdUtil.AD_TYPE.gdt2; expressAdManager = new ExpressAdManager(adType, context); } @@ -147,13 +150,12 @@ public void onRenderSuccess(List<ExpressAdContainer> adList) { expressAdContainer = adList.get(0); if (show) { ExpressAdManager.bindCloseListener(context, expressAdContainer, new IAdEventListener() { ExpressAdManager.renderAndFillAd(context, adList.get(0), fl_advertisement, new IAdEventListener() { @Override public void closeAd(ExpressAdContainer ad) { fl_advertisement.removeAllViews(); } }); ExpressAdManager.fillAd(expressAdContainer, fl_advertisement); } } BuWanVideo/src/com/weikou/beibeivideo/util/ad/CSJConstant.java
@@ -27,15 +27,19 @@ public static String VIDEO_DETAIL_GUESSLIKE_TOP = "945548915"; //视频搜索页 public static String VIDEO_SEARCH="945552227"; public static String VIDEO_SEARCH = "945552227"; //PPTV激励视频 public static String VIDEO_REWARD_PPTV="945914112"; public static String VIDEO_REWARD_PPTV = "945914112"; //影视豆激励视频 public static String GOLDCORN_REWARD_PPTV = "946039290"; //无效广告 public static String INVALID_AD = "111111111"; public static String PPTV_INTERSTITIALAD="946078773"; } BuWanVideo/src/com/weikou/beibeivideo/util/ad/ExpressAdManager.java
@@ -127,7 +127,7 @@ //加载大图 int deviceWidth = DimenUtils.getScreenWidth(mContext); deviceWidth = DimenUtils.px2dip(mContext, deviceWidth); int width = deviceWidth -9 * 2; int width = deviceWidth - 9 * 2; int height = (int) (width * 0.8); String pid = null; if (sourceType == AdUtil.AD_TYPE.csj) { @@ -306,8 +306,8 @@ String pid = null; if (sourceType == AdUtil.AD_TYPE.csj) { pid = CSJConstant.APP_EXIT; } else if (sourceType == AdUtil.AD_TYPE.gdt) { pid = BeibeiConstant.GDT_EXIT_DIALOG; } else { pid = GDTConstant.PID_2_EXIT; } //获取屏幕的宽 int deviceWidth = DimenUtils.getScreenWidth(mContext); @@ -550,10 +550,17 @@ return; } ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { @Override public void onSelected(int i, String s) { public void onShow() { } @Override public void onSelected(int i, String s, boolean b) { if (adEventListener != null) { adEventListener.closeAd(ad); } @@ -564,10 +571,6 @@ } @Override public void onRefuse() { } }); ad.getCsj().render(); if (ad.getCsj().getExpressAdView().getParent() != null) { @@ -668,8 +671,14 @@ if (activity != null) ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { @Override public void onSelected(int i, String s) { public void onShow() { } @Override public void onSelected(int i, String s, boolean b) { if (adEventListener != null) { adEventListener.closeAd(ad); } @@ -680,10 +689,7 @@ } @Override public void onRefuse() { } }); ad.getCsj().render(); } @@ -758,8 +764,14 @@ }); ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { @Override public void onSelected(int i, String s) { public void onShow() { } @Override public void onSelected(int i, String s, boolean b) { if (adEventListener != null) { adEventListener.closeAd(ad); } @@ -770,10 +782,6 @@ } @Override public void onRefuse() { } }); } BuWanVideo/src/com/weikou/beibeivideo/util/ad/GDTConstant.java
@@ -27,7 +27,11 @@ //PPTV激励视频 public static String PID_2_VIDEO_DETAIL_PLAYER_REWARD_PPTV = "9051467743649673"; //影视豆激励视频 public static String PID_2_GOLDCORN_REWARD = "9051467743649673"; //退出广告 public static String PID_2_EXIT = "6091485426868623"; } BuWanVideo/src/com/weikou/beibeivideo/util/browser/BWJavaInterface.java
@@ -4,11 +4,14 @@ import android.app.Dialog; import android.content.Intent; import android.content.pm.PackageManager; import androidx.core.content.ContextCompat; import android.webkit.JavascriptInterface; import android.widget.ImageView; import android.widget.TextView; import com.google.gson.Gson; import com.lcjian.library.util.common.StringUtils; import com.tencent.smtt.sdk.WebView; import com.weikou.beibeivideo.entity.JumpDetail; @@ -17,6 +20,7 @@ import com.weikou.beibeivideo.ui.login.PhoneLoginActivity; import com.weikou.beibeivideo.util.AlibcTradeUtil; import com.weikou.beibeivideo.util.JumpActivityUtil; import com.weikou.beibeivideo.util.UserUtil; import org.json.JSONException; import org.json.JSONObject; @@ -50,6 +54,17 @@ this.iv_right = iv_right; this.webview = webview; loadingDialog = LoadingDialogUtil.getLoadingDialog(activity, ""); } @JavascriptInterface public void jumpAPPPage(String jumpDetailStr, String params) { JumpDetail jumpDetail = new Gson().fromJson(jumpDetailStr, JumpDetail.class); com.alibaba.fastjson.JSONObject paramsJson = null; if (!StringUtils.isEmpty(params)) { paramsJson = com.alibaba.fastjson.JSONObject.parseObject(params); } JumpActivityUtil.jumpPage(mContext, jumpDetail, paramsJson); } @@ -172,6 +187,11 @@ mContext.startActivity(intent); } @JavascriptInterface public void logout() { UserUtil.logout(mContext); } @JavascriptInterface public void jumpWeb() { BuWanVideo/src/com/weikou/beibeivideo/util/browser/BaseBWJavaInterface.java
@@ -42,7 +42,6 @@ return mContext.getSharedPreferences("user", MODE_PRIVATE).getString("LoginUid", ""); } @JavascriptInterface public String getVersion() { return PackageUtils2.getVersionCode(mContext) + ""; BuWanVideo/src/com/weikou/beibeivideo/util/browser/PPJavaInterface.java
@@ -18,6 +18,7 @@ import com.lcjian.library.util.security.DEScrypt; import com.lcjian.library.util.security.MD5Utils; import com.umeng.analytics.MobclickAgent; import com.weikou.beibeivideo.BasicTextHttpResponseHandler; import com.weikou.beibeivideo.BeibeiVideoAPI; import com.weikou.beibeivideo.entity.UserInfo; import com.weikou.beibeivideo.entity.vo.UserInfoVO; @@ -26,6 +27,7 @@ import com.weikou.beibeivideo.util.JumpActivityUtil; import com.weikou.beibeivideo.util.UserUtil; import org.apache.http.Header; import org.json.JSONException; import org.json.JSONObject; @@ -117,6 +119,17 @@ } @JavascriptInterface public void stopPlay(String cid, String vid, int currentTime) { BeibeiVideoAPI.pptvFinishPlay(mContext, cid, vid, currentTime, new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { } }); } public interface IEventListener { public void onLogin();