BuWanVideo/build.gradle
@@ -94,8 +94,8 @@ } defaultConfig { applicationId "com.doudou.ysvideo" versionCode 104 versionName "3.8.6" versionCode 105 versionName "3.8.7" multiDexEnabled = true minSdkVersion 17 targetSdkVersion 27 BuWanVideo/res/drawable-xhdpi/icon_video_detail_history.png
BuWanVideo/res/drawable/shape_person_info_bind_btn.xml
New file @@ -0,0 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="20dp" /> <solid android:color="#ff0052f6" /> </shape> BuWanVideo/res/drawable/shape_video_detail_vip_btn.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="0" android:endColor="#E9CE93" android:startColor="#F7EDD7" /> <corners android:radius="20dp" /> </shape> BuWanVideo/res/layout/activity_person_info.xml
@@ -2,6 +2,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#4C4C4C" android:orientation="vertical"> <View @@ -32,191 +33,244 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:paddingBottom="6dp" android:paddingTop="6dp" android:paddingBottom="6dp" android:text="个人资料" android:textColor="@color/white" android:textSize="20sp" /> <TextView android:id="@+id/tv_top_right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right|center_vertical" android:padding="8dp" android:paddingBottom="6dp" android:paddingTop="6dp" android:text="完成" android:textColor="@color/white" android:textSize="16sp" /> </FrameLayout> <LinearLayout android:id="@+id/ll_portrait_select" <ScrollView android:layout_width="match_parent" android:layout_height="80dp" android:layout_marginTop="20dp" android:background="@color/white" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="20dp" android:text="修改头像" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <ImageView android:id="@+id/iv_portrai_select" android:layout_width="60dp" android:layout_height="60dp" android:layout_gravity="center_vertical" android:layout_marginRight="20dp" android:scaleType="centerInside" android:src="@drawable/ic_portrait_default" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="20dp" android:src="@drawable/ic_input" /> </LinearLayout> <LinearLayout android:id="@+id/ll_nickName" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginTop="10dp" android:background="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="20dp" android:text="昵称" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <TextView android:id="@+id/tv_nickName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="20dp" android:drawablePadding="3dp" android:drawableRight="@drawable/ic_input" android:text="编辑昵称" android:textColor="@color/gray" /> </LinearLayout> <LinearLayout android:id="@+id/ll_birthday" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginTop="1dp" android:background="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="20dp" android:text="生日" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <TextView android:id="@+id/tv_birthday" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="20dp" android:drawablePadding="3dp" android:drawableRight="@drawable/ic_input" android:text="点击设置生日" android:textColor="@color/gray" /> </LinearLayout> <LinearLayout android:id="@+id/ll_sex" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginTop="1dp" android:background="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="20dp" android:text="性别" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <TextView android:id="@+id/tv_sex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="20dp" android:drawablePadding="3dp" android:drawableRight="@drawable/ic_input" android:text="男" android:textColor="@color/gray" /> </LinearLayout> <LinearLayout android:id="@+id/ll_autograph" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:background="@color/white"> android:layout_height="0dp" android:layout_weight="1"> <LinearLayout android:layout_width="0dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:text="个性签名" /> <LinearLayout android:id="@+id/ll_portrait_select" style="@style/personInfoItemStyle" android:layout_marginTop="6dp"> <TextView android:id="@+id/tv_autograph" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginTop="5dp" android:text="个性签名" android:textColor="@color/gray" /> <TextView style="@style/personInfoItemTitleStyle" android:text="头像" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <ImageView android:id="@+id/iv_portrai_select" android:layout_width="60dp" android:layout_height="60dp" android:layout_gravity="center_vertical" android:layout_marginRight="13.5dp" android:scaleType="centerInside" android:src="@drawable/ic_portrait_default" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:src="@drawable/ic_input" /> </LinearLayout> <LinearLayout android:id="@+id/ll_nickName" style="@style/personInfoItemStyle" android:layout_marginTop="1dp"> <TextView style="@style/personInfoItemTitleStyle" android:text="昵称" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <TextView android:id="@+id/tv_nickName" style="@style/personInfoItemContentStyle" android:text="编辑昵称" /> </LinearLayout> <LinearLayout android:id="@+id/ll_sex" style="@style/personInfoItemStyle" android:layout_marginTop="1dp"> <TextView style="@style/personInfoItemTitleStyle" android:text="性别" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <TextView android:id="@+id/tv_sex" style="@style/personInfoItemContentStyle" android:text="男" /> </LinearLayout> <LinearLayout android:id="@+id/ll_birthday" style="@style/personInfoItemStyle" android:layout_marginTop="1dp"> <TextView style="@style/personInfoItemTitleStyle" android:text="出生日期" /> <View android:layout_width="0dp" android:layout_height="1px" android:layout_weight="1" /> <TextView android:id="@+id/tv_birthday" style="@style/personInfoItemContentStyle" android:text="点击设置生日" /> </LinearLayout> <LinearLayout android:id="@+id/ll_autograph" style="@style/personInfoItemStyle" android:layout_marginTop="10dp"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:layout_weight="1" android:orientation="vertical"> <TextView style="@style/personInfoItemTitleStyle" android:text="个性签名" /> <TextView android:id="@+id/tv_autograph" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="19dp" android:text="个性签名" android:textColor="@color/gray" /> </LinearLayout> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:src="@drawable/ic_input" /> </LinearLayout> <LinearLayout android:id="@+id/ll_qq" style="@style/personInfoItemStyle" android:layout_marginTop="10dp"> <TextView style="@style/personInfoItemTitleStyle" android:drawableLeft="@drawable/icon_person_info_qq" android:drawablePadding="13dp" android:gravity="center" android:text="QQ" /> <View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1"></View> <TextView android:visibility="gone" android:id="@+id/tv_bind_qq" style="@style/personInfoBindBtnStyle" android:background="@drawable/shape_person_info_bind_btn" android:text="去绑定"></TextView> <TextView android:id="@+id/tv_qq" style="@style/personInfoItemContentStyle" android:drawableRight="@null" android:drawablePadding="0dp"></TextView> </LinearLayout> <LinearLayout android:id="@+id/ll_wx" style="@style/personInfoItemStyle" android:layout_marginTop="1dp"> <TextView style="@style/personInfoItemTitleStyle" android:drawableLeft="@drawable/icon_person_info_wx" android:drawablePadding="13dp" android:gravity="center" android:text="微信" /> <View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1"></View> <TextView android:visibility="gone" android:id="@+id/tv_bind_wx" style="@style/personInfoBindBtnStyle" android:background="@drawable/shape_person_info_bind_btn" android:text="去绑定"></TextView> <TextView android:id="@+id/tv_wx" style="@style/personInfoItemContentStyle" android:drawableRight="@null" android:drawablePadding="0dp"></TextView> </LinearLayout> <LinearLayout android:id="@+id/ll_phone" style="@style/personInfoItemStyle" android:layout_marginTop="1dp"> <TextView style="@style/personInfoItemTitleStyle" android:drawableLeft="@drawable/icon_person_info_phone" android:drawablePadding="13dp" android:gravity="center" android:text="手机号" /> <View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1"></View> <TextView android:visibility="gone" android:id="@+id/tv_bind_phone" style="@style/personInfoBindBtnStyle" android:background="@drawable/shape_person_info_bind_btn" android:text="去绑定"></TextView> <TextView android:id="@+id/tv_phone" style="@style/personInfoItemContentStyle" android:drawableRight="@null" android:drawablePadding="0dp"></TextView> </LinearLayout> </LinearLayout> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginRight="20dp" android:src="@drawable/ic_input" /> </LinearLayout> </ScrollView> </LinearLayout> BuWanVideo/res/layout/browser_pptv_activity.xml
@@ -1,46 +1,103 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:background="#000000" android:orientation="vertical"> <FrameLayout android:id="@+id/fl_container" android:layout_width="match_parent" android:layout_height="match_parent"> <com.weikou.beibeivideo.util.x5.X5WebView <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> android:layout_width="match_parent" android:layout_height="match_parent" /> <FrameLayout android:visibility="gone" android:id="@+id/fl_ad" android:layout_width="match_parent" android:layout_height="wrap_content"> android:layout_height="wrap_content" android:visibility="gone"> </FrameLayout> <LinearLayout android:id="@+id/ll_bottom" android:layout_width="match_parent" android:layout_height="48dp" android:layout_gravity="bottom" android:background="#b4000000" android:gravity="center_vertical"> <TextView android:id="@+id/tv_top_bar_left" style="@style/TextBuleNormal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:drawableLeft="@drawable/ic_back_two" android:drawablePadding="3dp" android:gravity="center" android:layout_gravity="left|top" android:padding="8dp" /> <ImageView android:id="@+id/iv_add_to_favourite" android:layout_width="wrap_content" android:layout_height="21dp" android:layout_marginLeft="28.5dp" android:src="@drawable/selector_favourite" /> <ImageView android:id="@+id/iv_watch_history" android:layout_width="wrap_content" android:layout_height="21dp" android:layout_marginLeft="23.5dp" android:src="@drawable/icon_video_detail_history" /> <View android:layout_width="0dp" android:layout_height="1dp" android:layout_weight="1" /> <LinearLayout android:id="@+id/ll_vip_open" android:layout_width="237dp" android:layout_height="38dp" android:background="@drawable/shape_video_detail_vip_btn" android:gravity="center" android:orientation="vertical"> <TextView android:id="@+id/tv_vip_open" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="开通VIP" android:textColor="#ff885e24" android:textSize="15sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="海量高清无广告" android:textColor="#ff885e24" android:textSize="9sp" /> </LinearLayout> </LinearLayout> </FrameLayout> <TextView android:id="@+id/tv_top_bar_left" style="@style/TextBuleNormal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_gravity="left|top" android:drawableLeft="@drawable/ic_back_two" android:drawablePadding="3dp" android:gravity="center" android:padding="8dp" /> </LinearLayout> </FrameLayout> BuWanVideo/res/values/colors.xml
@@ -45,7 +45,7 @@ <color name="colorPrimaryDark">#303F9F</color> <color name="colorAccent">#FF4081</color> <color name="colorLoading">#0052F6</color> <color name="colorLoading">#0052f6</color> BuWanVideo/res/values/styles.xml
@@ -288,4 +288,53 @@ <item name="android:textSize">14sp</item> </style> <style name="personInfoItemStyle"> <item name="android:layout_height">wrap_content</item> <item name="android:layout_width">match_parent</item> <item name="android:paddingBottom">19dp</item> <item name="android:paddingTop">19dp</item> <item name="android:paddingLeft">19dp</item> <item name="android:paddingRight">19dp</item> <item name="android:background">#5C5C5C</item> <item name="android:gravity">center_vertical</item> </style> <style name="personInfoItemTitleStyle"> <item name="android:layout_height">wrap_content</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_gravity">center_vertical</item> <item name="android:textColor">#FFFFFF</item> <item name="android:textSize">16dp</item> </style> <style name="personInfoItemContentStyle"> <item name="android:layout_height">wrap_content</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_gravity">center_vertical</item> <item name="android:textColor">#FFFFFF</item> <item name="android:textSize">14dp</item> <item name="android:drawableRight">@drawable/ic_input</item> <item name="android:drawablePadding">13.5dp</item> </style> <style name="personInfoBindBtnStyle"> <item name="android:layout_height">wrap_content</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_gravity">center_vertical</item> <item name="android:textColor">#FFFFFF</item> <item name="android:textSize">14sp</item> <item name="android:paddingBottom">6.5dp</item> <item name="android:paddingTop">6.5dp</item> <item name="android:paddingLeft">18dp</item> <item name="android:paddingRight">18dp</item> <item name="android:gravity">center</item> </style> </resources> BuWanVideo/src/com/doudou/ysvideo/wxapi/WXEntryActivity.java
@@ -1,6 +1,7 @@ package com.doudou.ysvideo.wxapi; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.SharedPreferences; @@ -8,6 +9,7 @@ import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -21,6 +23,7 @@ import com.weikou.beibeivideo.BeibeiVideoAPI; import com.weikou.beibeivideo.BeibeiVideoApplication; import com.weikou.beibeivideo.ui.BaseActivity; import com.weikou.beibeivideo.ui.dialog.LoadingDialogUtil; import com.weikou.beibeivideo.util.UserUtil; import org.apache.http.Header; @@ -31,7 +34,8 @@ private static final int RETURN_MSG_TYPE_LOGIN = 1; private static final int RETURN_MSG_TYPE_SHARE = 2; private static final int RETURN_MSG_TYPE_XCX = 19; private ProgressDialog dialog; private static final int RETURN_MSG_TYPE_BIND = 30; private Dialog dialog; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -48,12 +52,13 @@ } //如果没回调onResp,八成是这句没有写 BeibeiVideoApplication.application.mWxApi.handleIntent(getIntent(), this); dialog = new ProgressDialog(this); dialog = LoadingDialogUtil.getLoadingDialog(this, ""); } // 微信发送请求到第三方应用时,会回调到该方法 @Override public void onReq(BaseReq req) { } // 第三方应用发送到微信的请求处理后的响应结果,会回调到该方法 @@ -78,16 +83,18 @@ switch (resp.getType()) { case RETURN_MSG_TYPE_LOGIN: SendAuth.Resp res = (SendAuth.Resp) resp; setLogin(res.code); if ("bind".equalsIgnoreCase(res.state)) { bind(res.code); } else { login(res.code); } break; case RETURN_MSG_TYPE_SHARE: // UIUtils.showToast("微信分享成功"); finish(); break; case RETURN_MSG_TYPE_XCX: // UIUtils.showToast("微信分享成功"); finish(); break; @@ -100,7 +107,7 @@ /** * 请求服务器匹配验证码 */ private void setLogin(String code) { private void login(String code) { BeibeiVideoAPI.wxLogin(this, UserUtil.getUid(this), code, new BasicTextHttpResponseHandler() { @Override @@ -154,4 +161,48 @@ } }); } /** * 请求服务器匹配验证码 */ private void bind(String code) { BeibeiVideoAPI.bindWX(this, UserUtil.getLoginUid(this), code, new BasicTextHttpResponseHandler() { @Override public void onStart() { super.onStart(); if (!dialog.isShowing()) dialog.show(); } @Override public void onFinish() { super.onFinish(); if (dialog.isShowing()) dialog.dismiss(); } @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.optBoolean("IsPost")) { SingleToast.showToast(getApplicationContext(), "微信绑定成功"); } else { SingleToast.showToast(WXEntryActivity.this, jsonObject.optString("Error")); } WXEntryActivity.this.finish(); } @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); SingleToast.showToast(getApplicationContext(), "微信绑定失败"); WXEntryActivity.this.finish(); } }); } } BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoAPI.java
@@ -1058,13 +1058,16 @@ } public static void getVideoDetail(Context context, String uid, String ResourceId, String videoId, String loginid, String type, String ResourceId, String videoId, Integer position, String loginid, String type, ResponseHandlerInterface handler) { LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); params.put("Method", "getVideoDetail"); params.put("Uid", uid); params.put("LoginUid", loginid); params.put("VideoId", videoId); if (position != null) { params.put("Position", position+""); } params.put("ResourceId", ResourceId); params.put("Type", type); commonPost(context, BASE_URL + "recommend", params, handler); BuWanVideo/src/com/weikou/beibeivideo/entity/vo/UserInfoVO.java
@@ -10,7 +10,7 @@ private String birthday; private String sign; private String pptvUid; private String pptvCode; //绑定的电话号码 private String qqOpenId; @@ -72,12 +72,12 @@ this.sign = sign; } public String getPptvUid() { return pptvUid; public String getPptvCode() { return pptvCode; } public void setPptvUid(String pptvUid) { this.pptvUid = pptvUid; public void setPptvCode(String pptvCode) { this.pptvCode = pptvCode; } public String getQqOpenId() { BuWanVideo/src/com/weikou/beibeivideo/entity/vo/WatchHistoryVO.java
New file @@ -0,0 +1,53 @@ package com.weikou.beibeivideo.entity.vo; import com.weikou.beibeivideo.entity.VideoInfo; public class WatchHistoryVO { private String id; private Long createTime; private VideoInfo videoInfo; private int position; //选中 private boolean selected; public String getId() { return id; } public void setId(String id) { this.id = id; } public VideoInfo getVideoInfo() { return videoInfo; } public void setVideoInfo(VideoInfo videoInfo) { this.videoInfo = videoInfo; } public Long getCreateTime() { return createTime; } public void setCreateTime(Long createTime) { this.createTime = createTime; } public int getPosition() { return position; } public void setPosition(int position) { this.position = position; } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } } BuWanVideo/src/com/weikou/beibeivideo/ui/ad/PlayVideoPreADFragment.java
@@ -50,6 +50,8 @@ */ public class PlayVideoPreADFragment extends Fragment implements View.OnClickListener { private int AD_DURATION = 5; private final static String TAG = PlayVideoPreADFragment.class.getName(); private MediaView mediaView; @@ -99,7 +101,10 @@ @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { Bundle bundle = getArguments(); if (bundle != null) { AD_DURATION = bundle.getInt("skipDuration", 5); } View root = LayoutInflater.from(getContext()).inflate(R.layout.item_video_detail_ad, null); initView(root); @@ -160,6 +165,7 @@ if (AdUtil.getAdType(getContext(), AdUtil.POSITION_VIDEO_PLAY_PRE) != AdUtil.AD_TYPE.gdt) pid = BeibeiConstant.GDT_DOWNLOAD_HINT_ID; tv_skip.setText(AD_DURATION + "s后可跳过"); // loadCSJ(CSJConstant.PLAY_VIDEO_PRE, videoAdListener); loadGDT(setting.getGdtAppId(), pid, videoAdListener); } @@ -314,8 +320,8 @@ @Override public void onVideoStart() { Log.d(TAG, "onVideoStart"); if (ad.getVideoDuration() / 1000 > 5) remainTime = 5; if (ad.getVideoDuration() / 1000 > AD_DURATION) remainTime = AD_DURATION; else remainTime = ad.getVideoDuration() / 1000; @@ -412,6 +418,7 @@ tv_skip.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i(TAG, "点击跳过"); if (mGDTAdData != null) mGDTAdData.stopVideo(); if (videoAdListener != null) BuWanVideo/src/com/weikou/beibeivideo/ui/common/ListVideoAdapter.java
@@ -1,8 +1,5 @@ package com.weikou.beibeivideo.ui.common; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; @@ -19,16 +16,16 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.lcjian.library.util.common.StringUtils; import com.weikou.beibeivideo.R; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.assist.ImageScaleType; import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer; import com.weikou.beibeivideo.R; import com.weikou.beibeivideo.entity.VideoInfo; import com.weikou.beibeivideo.ui.media.VideoDetailActivity; import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; import com.weikou.beibeivideo.ui.mine.MyFavouriteActivity; import com.weikou.beibeivideo.ui.recent.DownloadAdapter2.IGetDeleteCallback; import java.util.ArrayList; import java.util.List; public class ListVideoAdapter extends BaseAdapter { BuWanVideo/src/com/weikou/beibeivideo/ui/login/LoginActivity.java
@@ -127,7 +127,7 @@ SingleToast.showToast(LoginActivity.this, "选择同意用户协议后方可登录"); break; } if (isQQClientAvailable()) { if (isQQClientAvailable(getApplicationContext())) { loginType = "1"; // qq登录逻辑处理 点击登录后需要暂时锁定返回键和返回功能 不然会报错 lockBack(true); @@ -142,7 +142,7 @@ SingleToast.showToast(LoginActivity.this, "选择同意用户协议后方可登录"); break; } if (isWXClientAvailable()) { if (isWXClientAvailable(getApplicationContext())) { loginType = "2"; SendAuth.Req req = new SendAuth.Req(); req.scope = "snsapi_userinfo"; @@ -181,8 +181,8 @@ /** * 判断qq是否可用 */ public boolean isQQClientAvailable() { final PackageManager packageManager = getPackageManager(); public static boolean isQQClientAvailable(Context context) { final PackageManager packageManager = context.getPackageManager(); List<PackageInfo> pinfo = packageManager.getInstalledPackages(0); if (pinfo != null) { for (int i = 0; i < pinfo.size(); i++) { @@ -195,8 +195,8 @@ return false; } public boolean isWXClientAvailable() { final PackageManager packageManager = getPackageManager(); public static boolean isWXClientAvailable(Context context) { final PackageManager packageManager = context.getPackageManager(); List<PackageInfo> pinfo = packageManager.getInstalledPackages(0); if (pinfo != null) { for (int i = 0; i < pinfo.size(); i++) { BuWanVideo/src/com/weikou/beibeivideo/ui/login/PersonInfoActivity.java
@@ -3,12 +3,14 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.util.Base64; @@ -20,16 +22,23 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.google.gson.Gson; import com.lcjian.library.util.Environment; import com.lcjian.library.util.SingleToast; import com.lcjian.library.util.common.StringUtils; import com.tencent.mm.opensdk.modelmsg.SendAuth; import com.umeng.socialize.UMAuthListener; import com.umeng.socialize.UMShareAPI; import com.umeng.socialize.bean.SHARE_MEDIA; import com.weikou.beibeivideo.BasicTextHttpResponseHandler; import com.weikou.beibeivideo.BeibeiVideoAPI; import com.weikou.beibeivideo.BeibeiVideoApplication; import com.weikou.beibeivideo.entity.vo.UserInfoVO; import com.weikou.beibeivideo.ui.BaseActivity; import com.weikou.beibeivideo.ui.dialog.LoadingDialogUtil; import com.weikou.beibeivideo.util.BeibeiConstant; import com.weikou.beibeivideo.util.GlideCircleTransform; import com.weikou.beibeivideo.util.SelectPicUtil; @@ -46,12 +55,15 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.Calendar; import java.util.Map; /** * Created by weikou2015 on 2016/10/27. */ public class PersonInfoActivity extends BaseActivity implements View.OnClickListener { private String TAG = PersonInfoActivity.class.getSimpleName(); private LinearLayout ll_portrait; private LinearLayout ll_nickName; @@ -64,6 +76,17 @@ private TextView tv_birthday; private TextView tv_sex; private TextView tv_autograph; private TextView tv_qq; private TextView tv_wx; private TextView tv_phone; private TextView tv_bind_qq; private TextView tv_bind_wx; private TextView tv_bind_phone; private Dialog loadingDialog; @Override protected void onCreate(Bundle arg0) { @@ -96,14 +119,26 @@ tv_sex = (TextView) findViewById(R.id.tv_sex); tv_autograph = (TextView) findViewById(R.id.tv_autograph); tv_qq = findViewById(R.id.tv_qq); tv_wx = findViewById(R.id.tv_wx); tv_phone = findViewById(R.id.tv_phone); tv_bind_qq = findViewById(R.id.tv_bind_qq); tv_bind_wx = findViewById(R.id.tv_bind_wx); tv_bind_phone = findViewById(R.id.tv_bind_phone); ll_portrait.setOnClickListener(this); ll_nickName.setOnClickListener(this); ll_birthday.setOnClickListener(this); ll_sex.setOnClickListener(this); ll_autograph.setOnClickListener(this); findViewById(R.id.tv_back).setOnClickListener(this); findViewById(R.id.tv_top_right).setOnClickListener(this); getPersonInfo(); tv_bind_qq.setOnClickListener(this); tv_bind_wx.setOnClickListener(this); tv_bind_phone.setOnClickListener(this); loadingDialog = LoadingDialogUtil.getLoadingDialog(this, ""); } private String sign = ""; @@ -118,25 +153,89 @@ if (jsonObject.optBoolean("IsPost")) { JSONObject data = jsonObject.optJSONObject("Data"); UserInfoVO userInfoVO = new Gson().fromJson(data.toString(), UserInfoVO.class); Glide.with(PersonInfoActivity.this).load(BeibeiConstant.addPreFix(userInfoVO.getPortrait())). placeholder(R.drawable.ic_portrait_default).error(R.drawable.ic_portrait_default).into(iv_portrait); tv_nickName.setText(userInfoVO.getNickName()); tv_birthday.setText(userInfoVO.getBirthday()); tv_sex.setText(Integer.parseInt(userInfoVO.getSex()) == 0 ? "女" : "男"); sign = userInfoVO.getSign(); tv_autograph.setText(sign); setData(userInfoVO); } } }); } private void setData(UserInfoVO userInfoVO) { Glide.with(PersonInfoActivity.this).load(BeibeiConstant.addPreFix(userInfoVO.getPortrait())). placeholder(R.drawable.ic_portrait_default).error(R.drawable.ic_portrait_default).transform(new GlideCircleTransform(getApplicationContext())).into(iv_portrait); if (!StringUtils.isEmpty(userInfoVO.getNickName())) { tv_nickName.setText(userInfoVO.getNickName()); tv_nickName.setTextColor(Color.WHITE); } else { tv_nickName.setText("未填写"); tv_nickName.setTextColor(Color.GRAY); } if (!StringUtils.isEmpty(userInfoVO.getBirthday())) { tv_birthday.setText(userInfoVO.getBirthday()); tv_birthday.setTextColor(Color.WHITE); } else { tv_birthday.setText("未填写"); tv_birthday.setTextColor(Color.GRAY); } if (!StringUtils.isEmpty(userInfoVO.getSex())) { tv_sex.setText(Integer.parseInt(userInfoVO.getSex()) == 0 ? "女" : "男"); tv_sex.setTextColor(Color.WHITE); } else { tv_sex.setText("未填写"); tv_sex.setTextColor(Color.GRAY); } sign = userInfoVO.getSign(); if (!StringUtils.isEmpty(userInfoVO.getSign())) { tv_autograph.setText(userInfoVO.getSign()); tv_autograph.setTextColor(Color.WHITE); } else { tv_autograph.setText("未填写"); tv_autograph.setTextColor(Color.GRAY); } if (!StringUtils.isEmpty(userInfoVO.getQqOpenId())) { tv_qq.setText(userInfoVO.getQqNickName()); tv_bind_qq.setVisibility(View.GONE); tv_qq.setVisibility(View.VISIBLE); } else { tv_bind_qq.setVisibility(View.VISIBLE); tv_qq.setVisibility(View.GONE); } if (!StringUtils.isEmpty(userInfoVO.getWxUnionId())) { tv_wx.setText(userInfoVO.getWxName()); tv_bind_wx.setVisibility(View.GONE); tv_wx.setVisibility(View.VISIBLE); } else { tv_bind_wx.setVisibility(View.VISIBLE); tv_wx.setVisibility(View.GONE); } if (!StringUtils.isEmpty(userInfoVO.getPhone())) { tv_phone.setText(userInfoVO.getPhone()); tv_bind_phone.setVisibility(View.GONE); tv_phone.setVisibility(View.VISIBLE); } else { tv_bind_phone.setVisibility(View.VISIBLE); tv_phone.setVisibility(View.GONE); } } String imgBase64 = ""; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { Bitmap bm = null; bm = SelectPicUtil.onActivityResult(this, requestCode, @@ -258,8 +357,87 @@ case R.id.ll_autograph://个性签名 getAutograph(); break; case R.id.tv_top_right://完成个人信息的修改 break; case R.id.tv_bind_qq: //绑定QQ { if (LoginActivity.isQQClientAvailable(getApplicationContext())) { // qq登录逻辑处理 点击登录后需要暂时锁定返回键和返回功能 不然会报错 UMShareAPI.get(getApplicationContext()).getPlatformInfo(PersonInfoActivity.this, SHARE_MEDIA.QQ, new UMAuthListener() { @Override public void onStart(SHARE_MEDIA share_media) { if (loadingDialog != null && !loadingDialog.isShowing()) loadingDialog.show(); } @Override public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) { Log.d(TAG, "onComplete"); if (loadingDialog != null && loadingDialog.isShowing()) loadingDialog.dismiss(); String nickName = map.get("name"); String openid = map.get("openid"); String portrait = map.get("iconurl"); String sex = map.get("gender"); String province = map.get("province"); String city = map.get("city"); if (StringUtils.isEmpty(openid)) { return; } BeibeiVideoAPI.bindQQ(PersonInfoActivity.this, UserUtil.getLoginUid(getApplicationContext()), nickName, portrait, openid, new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.optBoolean("IsPost")) { Toast.makeText(PersonInfoActivity.this, "QQ绑定成功", Toast.LENGTH_SHORT).show(); getPersonInfo(); } else { Toast.makeText(PersonInfoActivity.this, jsonObject.optString("Error"), Toast.LENGTH_SHORT).show(); } } }); } @Override public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) { throwable.printStackTrace(); Log.d(TAG, "onError"); if (loadingDialog != null && loadingDialog.isShowing()) loadingDialog.dismiss(); Toast.makeText(PersonInfoActivity.this, "QQ授权出错,请稍后再试", Toast.LENGTH_SHORT).show(); } @Override public void onCancel(SHARE_MEDIA share_media, int i) { Log.d(TAG, "onCancel"); if (loadingDialog != null && loadingDialog.isShowing()) loadingDialog.dismiss(); } }); } else { Toast.makeText(this, "QQ不可用,请查询手机是否安装QQ...", Toast.LENGTH_LONG).show(); } } break; case R.id.tv_bind_wx: { if (LoginActivity.isWXClientAvailable(getApplicationContext())) { SendAuth.Req req = new SendAuth.Req(); req.scope = "snsapi_userinfo"; req.state = "bind"; BeibeiVideoApplication.application.mWxApi.sendReq(req); } else { Toast.makeText(this, "微信不可用,请查询手机是否安装微信...", Toast.LENGTH_LONG).show(); } } break; case R.id.tv_bind_phone: { Intent intent = new Intent(this, PhoneLoginActivity.class); intent.putExtra("login", false); startActivity(intent); } break; } } @@ -417,4 +595,12 @@ } }); } @Override public void onResume() { super.onResume(); getPersonInfo(); } } BuWanVideo/src/com/weikou/beibeivideo/ui/login/PhoneLoginActivity.java
@@ -255,7 +255,7 @@ case R.id.tv_obtain_verfication_code: String phone = et_phone.getText().toString(); if (!StringUtils.isMobileNumber(phone)) { SingleToast.showToast(this, "请输入正确的电话号码"); SingleToast.showToast(this, "请输入正确的手机号"); break; } tv_obtain_verfication_code.setEnabled(false); @@ -271,7 +271,7 @@ String phone1 = et_phone.getText().toString(); String verficationCode = et_verfication_code.getText().toString(); if (!StringUtils.isMobileNumber(phone1)) { SingleToast.showToast(this, "请输入正确的电话号码"); SingleToast.showToast(this, "请输入正确的手机号"); return; } if (StringUtils.isEmpty(verficationCode)) { @@ -343,7 +343,7 @@ break; default: if (showOneKeyLoginToast) { Toast.makeText(this, "暂无法使用电话号码一键登录", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "暂无法使用手机号一键登录", Toast.LENGTH_SHORT).show(); } break; } BuWanVideo/src/com/weikou/beibeivideo/ui/main/MainActivity.java
@@ -70,6 +70,7 @@ import com.weikou.beibeivideo.util.BeibeiConstant; import com.weikou.beibeivideo.util.ExitDialog; import com.weikou.beibeivideo.util.LoginFirstDialog; import com.weikou.beibeivideo.util.UserUtil; import com.weikou.beibeivideo.util.ad.manager.SearchResultAdManager; import com.yeshi.appupdate.AppUpdate; @@ -262,13 +263,14 @@ videoInfo.setId("8065880"); videoInfo.setThirdType("0"); Intent intent = new Intent(MainActivity.this, VideoDetailActivity2.class); intent.putExtra("video_info",videoInfo); intent.putExtra("video_info", videoInfo); startActivity(intent); } },2000); }, 2000); } // startActivity(new Intent(this, PhoneLoginActivity.class)); //拉取详情问题 UserUtil.updateUserInfo(getApplicationContext(), null); } BuWanVideo/src/com/weikou/beibeivideo/ui/media/EpisodeFragment.java
@@ -796,7 +796,7 @@ "user", Context.MODE_PRIVATE); String uid = preferences.getString("uid", ""); String loginid = preferences.getString("LoginUid", ""); BeibeiVideoAPI.getVideoDetail(getContext(), uid, resourceId, videoId, loginid, BeibeiVideoAPI.getVideoDetail(getContext(), uid, resourceId, videoId,null, loginid, videoThirdType, new BasicTextHttpResponseHandler() { @Override BuWanVideo/src/com/weikou/beibeivideo/ui/media/VideoDetailActivity.java
@@ -629,7 +629,7 @@ Context.MODE_PRIVATE); String uid = preferences.getString("uid", ""); String loginid = preferences.getString("LoginUid", ""); BeibeiVideoAPI.getVideoDetail(context, uid, resourceId, videoId, loginid, BeibeiVideoAPI.getVideoDetail(context, uid, resourceId, videoId,null, loginid, videoThirdType, new BasicTextHttpResponseHandler() { @Override BuWanVideo/src/com/weikou/beibeivideo/ui/media/VideoDetailActivity2.java
@@ -730,19 +730,18 @@ private void getVideoDetail(final Context context, String videoId, String videoThirdType, final boolean isSetup) { int position = getIntent().getIntExtra( "playing_position", 0); SharedPreferences preferences = context.getSharedPreferences("user", Context.MODE_PRIVATE); String uid = preferences.getString("uid", ""); String loginid = preferences.getString("LoginUid", ""); BeibeiVideoAPI.getVideoDetail(context, uid, resourceId, videoId, loginid, BeibeiVideoAPI.getVideoDetail(context, uid, resourceId, videoId, position, loginid, videoThirdType, new BasicTextHttpResponseHandler() { @Override public void onStart() { super.onStart(); // if (BeibeiConstant.DEBUG) // Toast.makeText(VideoDetailActivity2.this, "onStart", // Toast.LENGTH_SHORT).show(); } @Override @@ -750,9 +749,6 @@ String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); // if (BeibeiConstant.DEBUG) // Toast.makeText(VideoDetailActivity2.this, "onFailure", // Toast.LENGTH_SHORT).show(); if (progressDialog.isShowing()) { progressDialog.dismiss(); } @@ -769,19 +765,6 @@ Header[] headers, JSONObject jsonObject) throws Exception { boolean pptv = true; if (pptv) { fl_pptv.setVisibility(View.VISIBLE); ll_other.setVerticalGravity(View.GONE); getSupportFragmentManager().beginTransaction().replace(R.id.fl_pptv, new PPTVPlayFragment()).commit(); if (progressDialog.isShowing()) { progressDialog.dismiss(); } return; } else { fl_pptv.setVisibility(View.GONE); ll_other.setVisibility(View.VISIBLE); } // if (BeibeiConstant.DEBUG) // Toast.makeText(VideoDetailActivity2.this, @@ -796,6 +779,28 @@ e.printStackTrace(); } if (jsonObject.getBoolean("IsPost")) { JSONObject data = jsonObject.optJSONObject("Data"); boolean pptv = data.optBoolean("pptv", false); if (pptv) { String playUrl = data.optString("playUrl"); fl_pptv.setVisibility(View.VISIBLE); ll_other.setVerticalGravity(View.GONE); PPTVPlayFragment pptvPlayFragment = new PPTVPlayFragment(); Bundle bundle = new Bundle(); bundle.putString("playUrl", playUrl); bundle.putString("videoId",data.optString("videoId")); pptvPlayFragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.fl_pptv, pptvPlayFragment).commit(); if (progressDialog.isShowing()) { progressDialog.dismiss(); } return; } else { fl_pptv.setVisibility(View.GONE); ll_other.setVisibility(View.VISIBLE); } findViewById(R.id.fragment_video_detail_container) .setVisibility(View.VISIBLE); findViewById(R.id.fragment_video_episode_container) BuWanVideo/src/com/weikou/beibeivideo/ui/mine/BrowserActivity.java
@@ -1,5 +1,6 @@ package com.weikou.beibeivideo.ui.mine; import android.app.Activity; import android.app.AlertDialog; import android.app.Notification; import android.app.NotificationChannel; @@ -153,6 +154,8 @@ webview.addJavascriptInterface(new BWJavaInterface(this, webview), "yestv"); } private boolean needSetResult = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -192,6 +195,7 @@ String url = getIntent().getStringExtra("url"); // String url="http://192.168.3.122:8848/buwan-web/BuWanWeb/vip/index.html"; webview.loadUrl(url); needSetResult = getIntent().getBooleanExtra("result", false); } // 文件下载监听 @@ -303,7 +307,7 @@ super.onResume(); MobclickAgent.onPageStart("网页"); // webview.reload(); if(webview!=null){ if (webview != null) { webview.loadUrl("javascript:onResume()"); } } @@ -332,19 +336,25 @@ switch (v.getId()) { case R.id.tv_top_bar_left: { if (!webview.canGoBack()) finish(); finishPage(); else { webview.goBack(); } } break; case R.id.tv_top_bar_left2: { finish(); finishPage(); } break; default: break; } } private void finishPage() { if (needSetResult) setResult(Activity.RESULT_OK); finish(); } // 设置回退 @@ -354,6 +364,10 @@ if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) { webview.goBack(); // goBack()表示返回WebView的上一页面 return true; } else { if (keyCode == KeyEvent.KEYCODE_BACK) { finishPage(); } } return super.onKeyDown(keyCode, event); } BuWanVideo/src/com/weikou/beibeivideo/ui/mine/PPTVPlayFragment.java
@@ -1,34 +1,38 @@ package com.weikou.beibeivideo.ui.mine; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.Notification; import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.net.http.SslError; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.webkit.ConsoleMessage; import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.FrameLayout; import android.widget.ProgressBar; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.lcjian.library.RetainViewFragment; import com.tencent.smtt.export.external.interfaces.ConsoleMessage; import com.tencent.smtt.export.external.interfaces.SslError; import com.tencent.smtt.export.external.interfaces.SslErrorHandler; import com.tencent.smtt.export.external.interfaces.WebResourceRequest; import com.tencent.smtt.sdk.WebChromeClient; import com.tencent.smtt.sdk.WebSettings; import com.tencent.smtt.sdk.WebView; import com.tencent.smtt.sdk.WebViewClient; import com.lcjian.library.util.SingleToast; import com.umeng.analytics.MobclickAgent; import com.weikou.beibeivideo.BasicTextHttpResponseHandler; import com.weikou.beibeivideo.BeibeiVideoAPI; import com.weikou.beibeivideo.BeibeiVideoApplication; import com.weikou.beibeivideo.R; import com.weikou.beibeivideo.entity.ad.PlayVideoPreADSetting; @@ -37,23 +41,34 @@ import com.weikou.beibeivideo.ui.login.LoginActivity; import com.weikou.beibeivideo.util.BeibeiConstant; import com.weikou.beibeivideo.util.ConfigUtil; import com.weikou.beibeivideo.util.UserUtil; import com.weikou.beibeivideo.util.ad.AdUtil; import com.weikou.beibeivideo.util.ad.GDTConstant; import com.weikou.beibeivideo.util.browser.PPJavaInterface; import com.weikou.beibeivideo.util.ui.IPageEventListener; import com.weikou.beibeivideo.util.x5.X5WebView; import org.apache.http.Header; import org.json.JSONObject; public class PPTVPlayFragment extends RetainViewFragment implements OnClickListener { private static int REQUEST_CODE_LOGIN = 1001; private final static int REQUEST_CODE_LOGIN = 1001; private final static int REQUEST_CODE_VIP = 1002; private final static String TAG = PPTVPlayFragment.class.getSimpleName(); private TextView tv_top_bar_left; private X5WebView webview; private android.webkit.WebView webview; FrameLayout fl_ad; FrameLayout fl_container; private ImageView iv_favourite, iv_watch_history; private LinearLayout ll_bottom, ll_vip_open; private TextView tv_vip_open; private boolean showAd = true; private void initX5WebView(View view) { private void initWebView(View view) { fl_ad = view.findViewById(R.id.fl_ad); webview = view.findViewById(R.id.webview); webview.setWebViewClient(new WebViewClient() { @@ -73,7 +88,12 @@ @Override public void onPageFinished(WebView webView, String s) { super.onPageFinished(webView, s); playAd(); if (showAd) playAd(); else { showAd = true; adPlayFinish(); } } @Override @@ -82,6 +102,10 @@ }); webview.setWebChromeClient(new WebChromeClient() { View myVideoView; View myNormalView; CustomViewCallback callback; @Override public void onReceivedTitle(WebView view, String title) { @@ -97,6 +121,42 @@ Log.i(TAG, consoleMessage.message()); return super.onConsoleMessage(consoleMessage); } /** * 全屏播放配置 */ @Override public void onShowCustomView(View view, CustomViewCallback customViewCallback) { View normalView = fl_container; ViewGroup viewGroup = (ViewGroup) normalView.getParent(); viewGroup.removeView(normalView); viewGroup.addView(view); myVideoView = view; myNormalView = normalView; callback = customViewCallback; getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); WindowManager.LayoutParams attrs = getActivity().getWindow().getAttributes(); attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; getActivity().getWindow().setAttributes(attrs); } @Override public void onHideCustomView() { if (callback != null) { callback.onCustomViewHidden(); callback = null; } if (myVideoView != null) { ViewGroup viewGroup = (ViewGroup) myVideoView.getParent(); viewGroup.removeView(myVideoView); viewGroup.addView(myNormalView); } getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); WindowManager.LayoutParams attrs = getActivity().getWindow().getAttributes(); attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; getActivity().getWindow().setAttributes(attrs); } }); WebSettings webSetting = webview.getSettings(); webSetting.setJavaScriptEnabled(true); @@ -104,37 +164,40 @@ webview.addJavascriptInterface(new PPJavaInterface(BeibeiVideoApplication.application, new PPJavaInterface.IEventListener() { @Override public void onLogin() { webview.post(new Runnable() { @Override public void run() { Intent intent = new Intent(getContext(), LoginActivity.class); intent.putExtra("result", true); startActivityForResult(intent, REQUEST_CODE_LOGIN); } }); if (getActivity() != null) getActivity().runOnUiThread(new Runnable() { @Override public void run() { Intent intent = new Intent(getContext(), LoginActivity.class); intent.putExtra("result", true); startActivityForResult(intent, REQUEST_CODE_LOGIN); } }); } @Override public void onTryPlayFinish() { Log.i(TAG, "onTryPlayFinish"); webview.post(new Runnable() { @Override public void run() { if (vipDialog != null && !vipDialog.isShowing()) vipDialog.show(); } }); if (getActivity() != null) getActivity().runOnUiThread(new Runnable() { @Override public void run() { getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); if (vipDialog != null && !vipDialog.isShowing()) vipDialog.show(); } }); } @Override public void onPlayFinish() { webview.post(new Runnable() { @Override public void run() { new AlertDialog.Builder(getContext()).setMessage("playFinish方法被调用").create().show(); } }); if (getActivity() != null) getActivity().runOnUiThread(new Runnable() { @Override public void run() { } }); } }), "ppyestv"); @@ -151,18 +214,39 @@ return R.layout.browser_pptv_activity; } private String videoId; @Override public void onCreateView(View contentView, Bundle savedInstanceState) { initView(contentView); String url = "http://vip.pptv.com/activity/2021/pg_bwysdqmovie?cid=32159127&vid=32159127&programtype=3"; url = "https://acmd.api.pptv.com/2021/bwysdqmovie_thrid_h5.html?cid=32159127&vid=32159127&programtype=3"; webview.loadUrl(url); Bundle bundle = getArguments(); if (bundle != null) { String url = bundle.getString("playUrl", ""); videoId = bundle.getString("videoId"); webview.loadUrl(url); } } private void initView(View view) { initX5WebView(view); initWebView(view); tv_top_bar_left = view.findViewById(R.id.tv_top_bar_left); tv_top_bar_left.setOnClickListener(this); fl_container = view.findViewById(R.id.fl_container); iv_favourite = view.findViewById(R.id.iv_add_to_favourite); iv_watch_history = view.findViewById(R.id.iv_watch_history); ll_bottom = view.findViewById(R.id.ll_bottom); ll_vip_open = view.findViewById(R.id.ll_vip_open); tv_vip_open = view.findViewById(R.id.tv_vip_open); iv_favourite.setOnClickListener(this); iv_watch_history.setOnClickListener(this); ll_vip_open.setOnClickListener(this); vipDialog = new VIPDialog.Builder(getActivity()).setCloseListener(new OnClickListener() { @Override public void onClick(View v) { @@ -172,9 +256,25 @@ @Override public void onClick(View v) { vipDialog.dismiss(); startActivity(new Intent(BeibeiVideoApplication.application, BrowserActivity.class).putExtra("url", ConfigUtil.getVipLink(BeibeiVideoApplication.application))); jumpToVIP(); } }).create(); } private void jumpToVIP() { startActivityForResult(new Intent(BeibeiVideoApplication.application, BrowserActivity.class).putExtra("result", true).putExtra("url", ConfigUtil.getVipLink(BeibeiVideoApplication.application)), REQUEST_CODE_VIP); } private void initData() { if (UserUtil.isVIP(BeibeiVideoApplication.application)) { tv_vip_open.setText("VIP续费"); } else { tv_vip_open.setText("开通VIP"); } isCollect(); } Dialog vipDialog; @@ -183,18 +283,13 @@ PlayVideoPreADFragment mVideoDetailVideoAdFragment; private NotificationManager manager; private Notification notif; private Notification.Builder oBuilder; private NotificationCompat.Builder builder; int j = -1; @Override public void onResume() { super.onResume(); MobclickAgent.onPageStart("网页"); // webview.reload(); initData(); } @Override @@ -222,36 +317,52 @@ case R.id.tv_top_bar_left: { getActivity().finish(); } break; case R.id.iv_add_to_favourite: collect(collected); break; case R.id.iv_watch_history: startActivity(new Intent(iv_watch_history.getContext(), WatchHistoryActivity.class)); break; case R.id.ll_vip_open: jumpToVIP(); break; default: break; } } // 设置回退 // 覆盖Activity类的onKeyDown(int keyCoder,KeyEvent event)方法 // @Override // public boolean onKeyDown(int keyCode, KeyEvent event) { // if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) { // webview.goBack(); // goBack()表示返回WebView的上一页面 // return true; // } // return super.onKeyDown(keyCode, event); // } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResdult:" + requestCode); //从登录返回来的 if (requestCode == REQUEST_CODE_LOGIN && resultCode == Activity.RESULT_OK) { Log.d(TAG, "登录成功"); webview.reload(); switch (requestCode) { case REQUEST_CODE_VIP: break; case REQUEST_CODE_LOGIN: { Log.d(TAG, "登录成功"); showAd = false; webview.reload(); } break; } } super.onActivityResult(requestCode, resultCode, data); } private synchronized void playAd() { //VIP永久免广告 if (UserUtil.isVIP(getContext())) { adPlayFinish(); return; } fl_ad.setVisibility(View.VISIBLE); mVideoDetailVideoAdFragment = new PlayVideoPreADFragment(); mVideoDetailVideoAdFragment.setPageEventListener(new IPageEventListener() { @@ -260,7 +371,8 @@ mVideoDetailVideoAdFragment.loadVideoAD(new PlayVideoPreADFragment.IVideoAdListener() { @Override public void finishPlay() { getChildFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commitAllowingStateLoss(); if (mVideoDetailVideoAdFragment.isAdded()) getChildFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commitAllowingStateLoss(); fl_ad.setVisibility(View.GONE); adPlayFinish(); } @@ -273,10 +385,11 @@ @Override public void noAd() { fl_ad.setVisibility(View.GONE); getChildFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commitAllowingStateLoss(); if (mVideoDetailVideoAdFragment.isAdded()) getChildFragmentManager().beginTransaction().remove(mVideoDetailVideoAdFragment).commitAllowingStateLoss(); adPlayFinish(); } }, new PlayVideoPreADSetting(AdUtil.AD_TYPE.gdt, BeibeiConstant.GDT_ID, "5061928359494942", null)); }, new PlayVideoPreADSetting(AdUtil.AD_TYPE.gdt, BeibeiConstant.GDT_ID, GDTConstant.PID_2_VIDEO_DETAIL_PLAYER_PRE_PPTV, null)); } }); @@ -285,6 +398,60 @@ private void adPlayFinish() { webview.loadUrl("javascript:adPlayFinish()"); if (webview != null) webview.loadUrl("javascript:adPlayFinish()"); } private boolean collected = false; private void isCollect() { BeibeiVideoAPI.isCollect(iv_favourite.getContext(), UserUtil.getUid(BeibeiVideoApplication.application), videoId, 0 + "", new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.getBoolean("IsPost")) { collected = true; iv_favourite.setImageResource(R.drawable.ic_video_detail_favourite2); } else { collected = false; iv_favourite.setImageResource(R.drawable.ic_video_detail_favourite1); } } }); } private void collect(boolean cancel) { SharedPreferences preferences = getContext().getSharedPreferences( "user", Context.MODE_PRIVATE); String uid = preferences.getString("uid", ""); BeibeiVideoAPI.getScoreCollect(getContext(), uid, UserUtil.getLoginUid(BeibeiVideoApplication.application), videoId, 0+"", cancel ? "0" : "1", new BasicTextHttpResponseHandler() { @Override public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { if (jsonObject.getBoolean("IsPost")) { if (!cancel) { collected = true; SingleToast.showToast(getContext(), "收藏成功"); } else { collected = false; SingleToast.showToast(getContext(), "取消收藏成功"); } } else { if (!cancel) { SingleToast.showToast(getContext(), "收藏失败"); } else { SingleToast.showToast(getContext(), "取消收藏失败"); } } isCollect(); } }); } } BuWanVideo/src/com/weikou/beibeivideo/ui/recent/WatchHistoryAdapter.java
@@ -2,15 +2,12 @@ import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.support.v4.widget.CursorAdapter; import android.text.TextUtils; import android.text.TextUtils.TruncateAt; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.FrameLayout; import android.widget.ImageButton; @@ -18,46 +15,22 @@ import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.lcjian.library.util.common.StringUtils; import com.mozillaonline.providers.DownloadManager; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.assist.ImageScaleType; import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer; import com.weikou.beibeivideo.R; import com.weikou.beibeivideo.db.DownloadTable; import com.weikou.beibeivideo.db.WatchHistoryTable; import com.weikou.beibeivideo.entity.VideoDetailInfo; import com.weikou.beibeivideo.entity.VideoInfo; import com.weikou.beibeivideo.ui.media.VideoDetailActivity; import com.weikou.beibeivideo.entity.vo.WatchHistoryVO; import com.weikou.beibeivideo.ui.media.VideoDetailActivity2; import com.weikou.beibeivideo.util.VideoUtil; import java.util.ArrayList; import java.util.Formatter; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; public class WatchHistoryAdapter extends CursorAdapter { public class WatchHistoryAdapter extends BaseAdapter { private RequestManager glide; private List<WatchHistoryVO> voList; private Context context; private StringBuilder mFormatBuilder; private Formatter mFormatter; private Map<String, VideoInfo> mVideoInfos; private List<Long> mSelectedIds; private DownloadManager mDownloadManager; private Set<String> mSelectedIds = new HashSet<>(); private boolean mSelectedMode; private DownloadAdapter2.IGetDeleteCallback getdeleteNumber = null; @@ -67,302 +40,14 @@ this.getdeleteNumber = getdeleteNumber; } public WatchHistoryAdapter(Context context1, Context context, Cursor c, boolean autoRequery) { super(context, c, autoRequery); this.mFormatBuilder = new StringBuilder(); this.mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); this.mVideoInfos = new HashMap<String, VideoInfo>(); this.mSelectedIds = new ArrayList<Long>(); this.glide = Glide.with(context); this.mDownloadManager = new DownloadManager( context1.getContentResolver(), context1.getPackageName()); this.mDownloadManager.setAccessAllDownloads(true);// true public WatchHistoryAdapter(Context context, List<WatchHistoryVO> voList) { this.voList = voList; this.context = context; } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = LayoutInflater.from(parent.getContext()).inflate( R.layout.watch_history_item, parent, false); ViewHolder holder = new ViewHolder(); holder.iv_cover = (ImageView) view.findViewById(R.id.iv_cover); holder.tv_title = (TextView) view.findViewById(R.id.tv_title); holder.tv_watch_time = (TextView) view.findViewById(R.id.tv_watch_time); // holder.btn_status = (ImageButton) view.findViewById(R.id.btn_status); // holder.chb_watch_history = (CheckBox) view // .findViewById(R.id.chb_watch_history); holder.btn_delete = (ImageButton) view .findViewById(R.id.btn_delete_download); holder.chb_delete = (CheckBox) view.findViewById(R.id.chb_delete); holder.fl_video_select = (FrameLayout) view .findViewById(R.id.fl_video_select); view.setTag(holder); return view; } @Override public void bindView(View view, Context context, final Cursor cursor) { final ViewHolder viewHolder = (ViewHolder) view.getTag(); // viewHolder.tv_watch_time.setText(cursor.getString(cursor // .getColumnIndex(WatchHistoryTable.VIDEO_RESOURCE)) + ""); // String str = " "; // for (int i = 0; i < cursor.getColumnNames().length; i++) { // str += (cursor.getColumnNames()[i] + " "); // } // viewHolder.tv_watch_time.setText(str); // Log.i("mResult", "列名为:" + str + "------第1列为:" + cursor.getString(0)); final Long id = cursor.getLong(cursor .getColumnIndex(WatchHistoryTable._ID)); final String videoId = cursor.getString(cursor .getColumnIndex(WatchHistoryTable.VIDEO_ID)); final String videoDetailId = cursor.getString(cursor .getColumnIndex(WatchHistoryTable.VIDEO_DETAIL_ID)); String videoInfoStr = cursor.getString(cursor .getColumnIndexOrThrow(WatchHistoryTable.VIDEO_DETAIL)); if (!mSelectedMode) { viewHolder.fl_video_select.setVisibility(View.GONE); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Map<String, VideoInfo> videoInfos = getVideoInfos(); 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(v.getContext(), VideoDetailActivity2.class); VideoInfo info = new VideoInfo(); info.setId(videoInfo.getId()); info.setShare(videoInfo.getShare()); info.setThirdType(videoInfo.getThirdType()); intent.putExtra("video_info", info); intent.putExtra("video_detail_id", videoDetailId); intent.putExtra("playing_position", playingPosition); intent.putExtra("isFromWatchHistory", true); v.getContext().startActivity(intent); } } }); selectAll(false); viewHolder.fl_video_select.setVisibility(View.GONE); Cursor downloadCursor = context.getContentResolver().query( DownloadTable.CONTENT_URI, null, DownloadTable.VIDEO_ID + " = ? AND " + DownloadTable.VIDEO_DETAIL_ID + " = ? ", new String[]{videoId, videoDetailId}, null); if (downloadCursor.moveToFirst()) { // viewHolder.chb_watch_history.setVisibility(View.GONE); // viewHolder.btn_status.setVisibility(View.GONE); DownloadManager.Query baseQuery = new DownloadManager.Query() .setOnlyIncludeVisibleInDownloadsUi(true); baseQuery.setFilterById(downloadCursor.getLong(downloadCursor .getColumnIndex(DownloadTable.TASK_ID))); Cursor c = mDownloadManager.query(baseQuery); if (c.moveToFirst()) { // viewHolder.btn_status.setImageResource(R.drawable.ic_play); // viewHolder.btn_status.setVisibility(View.GONE); } c.close(); } // else { // viewHolder.chb_watch_history.setVisibility(View.INVISIBLE); // viewHolder.btn_status.setVisibility(View.VISIBLE); // viewHolder.btn_status.setImageResource(R.drawable.ic_download); // viewHolder.btn_status.setOnClickListener(new OnClickListener() { // // @Override // public void onClick(final View v) { // final VideoInfo videoInfo = mVideoInfos.get(videoId); // // if (!videoInfo.isCanSave()) { // Toast.makeText(mContext, "该视频暂不提供缓存", // Toast.LENGTH_SHORT).show(); // return; // } // viewHolder.btn_status.setVisibility(View.GONE); // if (videoInfo != null) { // VideoDetailInfo videoDetailInfoOrg = null; // for (VideoDetailInfo item : videoInfo // .getVideoDetailList()) { // if (item.getId().equals(videoDetailId)) { // videoDetailInfoOrg = item; // break; // } // } // if (videoDetailInfoOrg != null) { // // 点击下载操作 // final DownloadManager downloadManager = new DownloadManager( // v.getContext().getContentResolver(), v // .getContext().getPackageName()); // final VideoDetailInfo videoDetailInfo = videoDetailInfoOrg; // String url = ""; //// VideoPlayUrlUtil.getVideoUrl( //// videoDetailInfo).getUrl(); // if (StringUtils.isBlank(videoInfo // .getExtraData())) { // videoInfo // .setExtraData("http://cloud.letv.com"); // } // (new GetDownLoadTask(v.getContext()) { // protected void onPostExecute(String[] result) { // DownloadManager.Request request = new Request( // Uri.parse(result[0])); // try { // Uri uri = Uri.fromFile(new File( // SDCardUtil.getDownLoadPath(v // .getContext()))); // request.setDestinationUri(uri); // request.setUserAgent(result[1]); // // } catch (Exception e) { // e.printStackTrace(); // } // /* // * request.setDestinationInExternalPublicDir // * ( Environment.DIRECTORY_DOWNLOADS, // * "/"); // */ // Cursor cursor = getContext() // .getContentResolver() // .query(DownloadTable.CONTENT_URI, // new String[] { // DownloadTable.VIDEO_ID, // DownloadTable.VIDEO_DETAIL_ID }, // DownloadTable.VIDEO_DETAIL_ID // + "=?", // new String[] { videoDetailInfo // .getId() + "" }, // DownloadTable.VIDEO_DETAIL_ID // + " ASC");// 查询cursor // if (cursor.getCount() > 0) { // cursor.close(); // return; // } // cursor.close(); // // if (getContext().getSharedPreferences( // "settings", // Context.MODE_PRIVATE) // .getBoolean( // "only_wifi_download", // true)) { // request.setAllowedNetworkTypes(Request.NETWORK_WIFI); // } // request.setTitle(videoInfo.getName()); // request.setDescription(TextUtils // .isEmpty(videoDetailInfo // .getTag()) ? videoDetailInfo // .getName() : videoDetailInfo // .getTag()); // long taskId = downloadManager // .enqueue(request); // // ContentValues values = new ContentValues(); // values.put(DownloadTable.TASK_ID, // taskId); // values.put(DownloadTable.VIDEO_ID, // videoInfo.getId()); // values.put( // DownloadTable.VIDEO_DETAIL_ID, // videoDetailInfo.getId()); // values.put( // DownloadTable.VIDEO_THIRD_TYPE, // videoInfo.getThirdType()); // Gson gson = new GsonBuilder() // .setFieldNamingPolicy( // FieldNamingPolicy.UPPER_CAMEL_CASE) // .create(); // values.put(DownloadTable.VIDEO_DETAIL, // gson.toJson(videoInfo)); // getContext() // .getContentResolver() // .insert(DownloadTable.CONTENT_URI, // values); // // Toast.makeText(getContext(), // // "已加入下载列表", // // Toast.LENGTH_LONG).show(); // SingleToast.showToast(getContext(), // "已加入下载列表"); // notifyDataSetChanged(); // }; // // }).execute( // url, // videoDetailInfo.getId(), // GetRealPathTask // .getNeedSecondConnectServerUrl(videoInfo // .getExtraData())); // } // } // } // }); // } downloadCursor.close(); } else { viewHolder.fl_video_select.setVisibility(View.VISIBLE); // viewHolder.chb_watch_history.setVisibility(View.GONE); // viewHolder.btn_status.setVisibility(View.GONE); // viewHolder.fl_video_select.setVisibility(View.VISIBLE); // viewHolder.btn_delete.setVisibility(View.VISIBLE); // viewHolder.chb_delete.setVisibility(View.VISIBLE); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mSelectedIds.contains(id)) { mSelectedIds.remove(id); } else { mSelectedIds.add(id); } viewHolder.chb_delete.setChecked(mSelectedIds.contains(id)); if (getdeleteNumber != null) getdeleteNumber.onGetNum(mSelectedIds.size()); } }); viewHolder.chb_delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mSelectedIds.contains(id)) { mSelectedIds.remove(id); } else { mSelectedIds.add(id); } viewHolder.chb_delete.setChecked(mSelectedIds.contains(id)); if (getdeleteNumber != null) getdeleteNumber.onGetNum(mSelectedIds.size()); } }); viewHolder.chb_delete.setChecked(mSelectedIds.contains(id)); } viewHolder.iv_cover.setImageResource(R.drawable.ic_default_cover); viewHolder.tv_title.setText(""); getVideoDetail(context, videoId, videoDetailId, videoInfoStr, viewHolder); } private void bindView(ViewHolder viewHolder, String videoDetailId, private void bindView(ViewHolder viewHolder, int position, VideoInfo videoInfo) { String subName = ""; for (VideoDetailInfo videoDetailInfo : videoInfo.getVideoDetailList()) { if (videoDetailId.equals(videoDetailInfo.getId())) { subName = TextUtils.isEmpty(videoDetailInfo.getTag()) ? videoDetailInfo .getName() : videoDetailInfo.getTag(); } } if (StringUtils.isEmpty(videoInfo.getName())) { videoInfo.setName("."); } if (subName.equalsIgnoreCase(videoInfo.getName())) { viewHolder.tv_title.setSingleLine(true); viewHolder.tv_title.setEllipsize(TruncateAt.END); @@ -374,16 +59,14 @@ } viewHolder.tv_title.setText(videoInfo.getName() + System.getProperty("line.separator")); viewHolder.tv_watch_time.setText(mContext.getResources().getString( viewHolder.tv_watch_time.setText(context.getResources().getString( R.string.watch_history_time, subName)); } // imageLoader.displayImage(videoInfo.getPicture(), viewHolder.iv_cover, // options); if (StringUtils.isEmpty(videoInfo.getPicture())) videoInfo.setPicture(""); try { glide.load(videoInfo.getPicture()) Glide.with(context).load(videoInfo.getPicture()) .placeholder(R.drawable.ic_default_cover) .error(R.drawable.ic_default_cover).into(viewHolder.iv_cover); } catch (IllegalArgumentException e) { @@ -391,57 +74,129 @@ } } private void getVideoDetail(Context context, final String videoId, final String videoDetailId, String videoInfoStr, private void getVideoDetail(WatchHistoryVO vo, final ViewHolder viewHolder) { viewHolder.tv_title.setTag(videoId); VideoInfo videoInfo = mVideoInfos.get(videoId); viewHolder.tv_title.setTag(vo.getId()); VideoInfo videoInfo = vo.getVideoInfo(); if (videoInfo != null) { bindView(viewHolder, videoDetailId, videoInfo); } else { Gson gson = new GsonBuilder().setFieldNamingPolicy( FieldNamingPolicy.UPPER_CAMEL_CASE).create(); videoInfo = gson.fromJson(videoInfoStr, new TypeToken<VideoInfo>() { }.getType()); mVideoInfos.put(videoId, videoInfo); if (viewHolder.tv_title.getTag().equals(videoId)) { bindView(viewHolder, videoDetailId, videoInfo); } bindView(viewHolder, vo.getPosition(), videoInfo); } } private String stringForTime(int timeMs) { int totalSeconds = timeMs / 1000; int seconds = totalSeconds % 60; int minutes = (totalSeconds / 60) % 60; int hours = totalSeconds / 3600; mFormatBuilder.setLength(0); if (hours > 0) { return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds) .toString(); } else { return mFormatter.format("%02d:%02d", minutes, seconds).toString(); } @Override public int getCount() { return 0; } public Map<String, VideoInfo> getVideoInfos() { return mVideoInfos; @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { final WatchHistoryVO vo = voList.get(position); View view = LayoutInflater.from(parent.getContext()).inflate( R.layout.watch_history_item, parent, false); if (view.getTag() == null) { ViewHolder holder = new ViewHolder(); holder.iv_cover = (ImageView) view.findViewById(R.id.iv_cover); holder.tv_title = (TextView) view.findViewById(R.id.tv_title); holder.tv_watch_time = (TextView) view.findViewById(R.id.tv_watch_time); holder.btn_delete = (ImageButton) view .findViewById(R.id.btn_delete_download); holder.chb_delete = (CheckBox) view.findViewById(R.id.chb_delete); holder.fl_video_select = (FrameLayout) view .findViewById(R.id.fl_video_select); view.setTag(holder); } final ViewHolder holder = (ViewHolder) view.getTag(); //非编辑模式 if (!mSelectedMode) { holder.fl_video_select.setVisibility(View.GONE); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { VideoInfo videoInfo = vo.getVideoInfo(); if (videoInfo != null) { int playingPosition = vo.getPosition(); Intent intent = new Intent(v.getContext(), VideoDetailActivity2.class); VideoInfo info = new VideoInfo(); info.setId(videoInfo.getId()); info.setShare(videoInfo.getShare()); info.setThirdType(videoInfo.getThirdType()); intent.putExtra("video_info", info); intent.putExtra("playing_position", playingPosition); intent.putExtra("isFromWatchHistory", true); v.getContext().startActivity(intent); } } }); selectAll(false); holder.fl_video_select.setVisibility(View.GONE); } else { holder.fl_video_select.setVisibility(View.VISIBLE); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mSelectedIds.contains(vo.getId())) { mSelectedIds.remove(vo.getId()); } else { mSelectedIds.add(vo.getId()); } holder.chb_delete.setChecked(mSelectedIds.contains(vo.getId())); if (getdeleteNumber != null) getdeleteNumber.onGetNum(mSelectedIds.size()); } }); holder.chb_delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mSelectedIds.contains(vo.getId())) { mSelectedIds.remove(vo.getId()); } else { mSelectedIds.add(vo.getId()); } holder.chb_delete.setChecked(mSelectedIds.contains(vo.getId())); if (getdeleteNumber != null) getdeleteNumber.onGetNum(mSelectedIds.size()); } }); holder.chb_delete.setChecked(mSelectedIds.contains(vo.getId())); } holder.iv_cover.setImageResource(R.drawable.ic_default_cover); holder.tv_title.setText(""); getVideoDetail(vo, holder); return view; } private static class ViewHolder { ImageView iv_cover; TextView tv_title; TextView tv_watch_time; // ImageButton btn_status; // CheckBox chb_watch_history; ImageButton btn_delete; CheckBox chb_delete; FrameLayout fl_video_select; } public List<Long> getSelectedIds() { public Set<String> getSelectedIds() { return mSelectedIds; } @@ -457,18 +212,14 @@ public void selectAll(boolean isSelected) { mSelectedIds.clear(); if (isSelected) { if (mCursor.moveToFirst()) { do { mSelectedIds.add(mCursor.getLong(mCursor .getColumnIndex(WatchHistoryTable._ID))); } while (mCursor.moveToNext()); for (WatchHistoryVO vo : voList) { vo.setSelected(true); mSelectedIds.add(vo.getId()); } } else { if (mCursor.moveToFirst()) { do { mSelectedIds.remove(mCursor.getLong(mCursor .getColumnIndex(WatchHistoryTable._ID))); } while (mCursor.moveToNext()); for (WatchHistoryVO vo : voList) { vo.setSelected(false); } } if (getdeleteNumber != null) BuWanVideo/src/com/weikou/beibeivideo/util/BeibeiConstant.java
@@ -18,7 +18,7 @@ public static final String ABOUT_US = "http://bwweb.yeshitv.com/abountOur/index.html"; public static final String HOST = "http://api.ysdq.yeshitv.com:8089";//正式上线版本 public static final String HOST = "http://cb.ysdq.yeshitv.com";//正式上线版本 public static final String BAICHUAN_APPKEY = "24980167"; BuWanVideo/src/com/weikou/beibeivideo/util/UserUtil.java
@@ -196,5 +196,22 @@ } public static boolean isVIP(Context context) { UserInfoVO vo = getLoginUserInfoDetail(context); if (vo == null) { return false; } if (vo.getVipExpireTime() == null) { return false; } if (System.currentTimeMillis() > vo.getVipExpireTime().longValue()) { return false; } return true; } } BuWanVideo/src/com/weikou/beibeivideo/util/ad/GDTConstant.java
@@ -3,9 +3,9 @@ //广告常量 public class GDTConstant { public static String PID_HOME_RECOMMEND_BIG_IMG="2011627548122579"; public static String PID_HOME_RECOMMEND_BIG_IMG = "2011627548122579"; public static String PID_VIDEO_DETAIL_PLAYER="5061928359494942"; public static String PID_VIDEO_DETAIL_PLAYER = "5061928359494942"; //视频播放器下方广告位 public static String PID_2_VIDEO_DETAIL_PLAY_EXPRESS1 = "9031528552257617"; //相关视频下方广告位 @@ -15,4 +15,9 @@ public static String PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = "7001426565143389"; //PPTV视频前贴 public static String PID_2_VIDEO_DETAIL_PLAYER_PRE_PPTV = "5091266068484315"; } BuWanVideo/src/com/weikou/beibeivideo/util/browser/BWJavaInterface.java
@@ -137,6 +137,18 @@ }); } @JavascriptInterface public void finishPageWithResultOK() { mContext.runOnUiThread(new Runnable() { @Override public void run() { mContext.setResult(Activity.RESULT_OK); mContext.finish(); } }); } /** * 淘宝授权 * @@ -159,6 +171,14 @@ mContext.startActivity(intent); } @JavascriptInterface public void jumpWeb() { Intent intent = new Intent(mContext, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } /** * 电话号码绑定 */ BuWanVideo/src/com/weikou/beibeivideo/util/browser/BaseBWJavaInterface.java
@@ -17,6 +17,7 @@ import com.lcjian.library.util.security.MD5Utils; import com.umeng.analytics.MobclickAgent; import com.weikou.beibeivideo.BeibeiVideoAPI; import com.weikou.beibeivideo.ui.mine.BrowserActivity; import com.weikou.beibeivideo.util.JumpActivityUtil; import org.json.JSONException; @@ -107,6 +108,14 @@ } @JavascriptInterface public void jumpWeb(String url) { Intent intent = new Intent(mContext, BrowserActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("url", url); mContext.startActivity(intent); } @JavascriptInterface public String getRequestBaseParams(String json) { LinkedHashMap<String, String> params = new LinkedHashMap<>(); int version = PackageUtils2.getVersionCode(mContext); BuWanVideo/src/com/weikou/beibeivideo/util/browser/PPJavaInterface.java
@@ -72,9 +72,9 @@ } else { root.put("code", 1); JSONObject data = new JSONObject(); data.put("code", user.getPptvUid()); data.put("code", user.getPptvCode()); data.put("nickname", user.getNickName()); data.put("isSVip", (user.getVipExpireTime() != null && user.getVipExpireTime() > System.currentTimeMillis())); data.put("isSVip", UserUtil.isVIP(mContext)); data.put("isCoupon", false); root.put("data", data); }