| | |
| | | |
| | | defaultConfig { |
| | | applicationId "com.doudou.ysvideo" |
| | | versionCode 127 |
| | | versionName "3.10.9" |
| | | versionCode 128 |
| | | versionName "3.10.10" |
| | | multiDexEnabled = true |
| | | minSdkVersion 17 |
| | | targetSdkVersion 29 |
| | |
| | | android:id="@+id/ll_wx" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="50dp" |
| | | android:layout_marginRight="50dp" |
| | | android:layout_marginLeft="100dp" |
| | | |
| | | android:gravity="center" |
| | | android:orientation="vertical"> |
| | | |
| | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | |
| | | android:visibility="gone" |
| | | android:id="@+id/ll_weibo" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:background="#000000"></View> |
| | | |
| | | <TextView |
| | | |
| | | android:id="@+id/tv_cancel" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.UserUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | |
| | | import okhttp3.Call; |
| | | import okhttp3.Callback; |
| | |
| | | } |
| | | |
| | | |
| | | /*************事件上报**************/ |
| | | |
| | | public static void readNews(Context context, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | commonPost(context, BASE_URL + "event/readNews", params, handler); |
| | | } |
| | | |
| | | |
| | | public static void playDrawVideo(Context context,String source, String from, boolean finish, ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | params.put("From", from); |
| | | params.put("Source", source); |
| | | params.put("Finish", finish + ""); |
| | | commonPost(context, BASE_URL+ "event/playDrawVideo", params, handler); |
| | | } |
| | | |
| | | public static void readNovel(Context context, long duration,ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | if (UserUtil.getUid(context) != null) |
| | | params.put("Uid", UserUtil.getUid(context)); |
| | | String loginUid = UserUtil.getLoginUid(context); |
| | | if (loginUid != null) { |
| | | params.put("LoginUid", loginUid); |
| | | } |
| | | params.put("Duration", duration + ""); |
| | | commonPost(context, BASE_URL + "event/readNovel", params, handler); |
| | | } |
| | | |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, Context context) { |
| | | params.put("System", "1"); |
| | |
| | | import android.os.Message; |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.Log; |
| | | import android.webkit.WebView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | //解决错误:Using WebView from more than one process at once with the same data directory is not supported |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { |
| | | String processName = getProcessName(application); |
| | | String packageName = application.getPackageName(); |
| | | if (!packageName.equals(processName)) { |
| | | WebView.setDataDirectorySuffix(processName); |
| | | } |
| | | } |
| | | |
| | | //友盟初始化 |
| | | String description = ManifestDataUtil.getAppMetaData(application, "UMENG_CHANNEL"); |
| | | try { |
| | |
| | | initX5(application); |
| | | initNovel(application); |
| | | initDPSDK(application); |
| | | } |
| | | |
| | | private static String getProcessName(Context context) { |
| | | if (context == null) return null; |
| | | ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
| | | for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) { |
| | | if (processInfo.pid == android.os.Process.myPid()) { |
| | | return processInfo.processName; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | if (!dpSDKIninted) { |
| | | DPSdkConfig.Builder configBuilder = new DPSdkConfig.Builder() |
| | | .debug(true) |
| | | .debug(false) |
| | | .preloadDraw(true) |
| | | .needInitAppLog(false) |
| | | .setIsAndroidx(true) |
| | |
| | | KSConstant.PID_FEED = 8010000022L; |
| | | KSConstant.PID_FULL_VIDEO = 8010000015L; |
| | | //广告下载二次确认框 |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import com.bytedance.sdk.dp.IDPWidget; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.util.video.DPEventCollectUtil; |
| | | import com.weikou.beibeivideo.widget.MySwipeRefreshLayout; |
| | | |
| | | import java.util.Map; |
| | |
| | | |
| | | private void init() { |
| | | mIDPWidget = DPSdk.factory().createDoubleFeed(DPWidgetGridParams.obtain().listener(new IDPGridListener() { |
| | | |
| | | @Override |
| | | public void onDPVideoOver(Map<String, Object> map) { |
| | | super.onDPVideoOver(map); |
| | | DPEventCollectUtil.playDrawVideo(getContext(), map, "dy", "list", false); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoCompletion(Map<String, Object> map) { |
| | | super.onDPVideoCompletion(map); |
| | | // DPEventCollectUtil.playDrawVideo(getContext(), map, "dy", "list", true); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPRefreshFinish() { |
| | | super.onDPRefreshFinish(); |
| | |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | | import com.weikou.beibeivideo.util.video.DPEventCollectUtil; |
| | | import com.weikou.beibeivideo.widget.MySwipeRefreshLayout; |
| | | |
| | | import java.util.List; |
| | |
| | | @Override |
| | | public void onDPNewsDetailEnter(Map<String, Object> map) { |
| | | log("onDPNewsDetailEnter"); |
| | | DPEventCollectUtil.newsDetailEnter(getContext(), map); |
| | | } |
| | | |
| | | @Override |
| | |
| | | })); |
| | | |
| | | Fragment fragment = mIDPWidget.getFragment(); |
| | | if (fragment != null) { |
| | | if (fragment != null && getChildFragmentManager() != null) { |
| | | getChildFragmentManager().beginTransaction().replace(R.id.fl_content, fragment).commitAllowingStateLoss(); |
| | | } |
| | | } |
| | |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | | import com.weikou.beibeivideo.util.video.DPEventCollectUtil; |
| | | import com.weikou.beibeivideo.widget.MySwipeRefreshLayout; |
| | | |
| | | import java.util.Map; |
| | |
| | | public DYVideoFragment(FragmentManager fragmentManager) { |
| | | super(); |
| | | setName(DYNewsFragment.class.getName()); |
| | | this.fragmentManager=fragmentManager; |
| | | this.fragmentManager = fragmentManager; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onDPVideoOver(Map<String, Object> map) { |
| | | log("onDPVideoOver"); |
| | | DPEventCollectUtil.playDrawVideo(getContext(), null, "dy", "home", false); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoCompletion(Map<String, Object> map) { |
| | | log("onDPVideoCompletion"); |
| | | super.onDPVideoCompletion(map); |
| | | // DPEventCollectUtil.playDrawVideo(getContext(), null, "dy", "home", true); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | Fragment fragment = mIDPWidget.getFragment(); |
| | | if (fragment != null) { |
| | | if(fragmentManager!=null) { |
| | | if (fragmentManager != null) { |
| | | fragmentManager.beginTransaction().add(R.id.fl_content, fragment).commitAllowingStateLoss(); |
| | | }else{ |
| | | } else { |
| | | getChildFragmentManager().beginTransaction().add(R.id.fl_content, fragment).commitAllowingStateLoss(); |
| | | } |
| | | } |
| | |
| | | import com.kwad.sdk.api.KsScene; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.entity.ad.AdPositionEnum; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.util.ad.AdUtil; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | |
| | | |
| | | |
| | | private int getTypeCount() { |
| | | if (AdUtil.isCanInitCSJ()) { |
| | | if (AdUtil.isCanInitCSJ()&& AdUtil.getAdType(getContext(), AdPositionEnum.splashHotStart) != null) { |
| | | return 2; |
| | | } else { |
| | | return 1; |
| | |
| | | import com.kwad.sdk.api.KsFeedPage; |
| | | import com.kwad.sdk.api.KsScene; |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.entity.ad.AdPositionEnum; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.util.ad.AdUtil; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | |
| | | } |
| | | |
| | | private int getTypeCount() { |
| | | if (AdUtil.isCanInitCSJ()) { |
| | | if (AdUtil.isCanInitCSJ()&& AdUtil.getAdType(getContext(), AdPositionEnum.splashHotStart) != null) { |
| | | return 2; |
| | | } else { |
| | | return 1; |
| | |
| | | import com.weikou.beibeivideo.R; |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | | import com.weikou.beibeivideo.util.video.DPEventCollectUtil; |
| | | import com.weikou.beibeivideo.widget.MySwipeRefreshLayout; |
| | | |
| | | import androidx.annotation.Nullable; |
| | |
| | | public void preInit() { |
| | | KsScene adScene = new KsScene.Builder(KSConstant.PID_FEED).build(); |
| | | ksFeedPage = KsAdSDK.getLoadManager().loadFeedPage(adScene); |
| | | ksFeedPage.setVideoListener(new KsContentPage.VideoListener() { |
| | | @Override |
| | | public void onVideoPlayStart(KsContentPage.ContentItem contentItem) { |
| | | DPEventCollectUtil.playDrawVideo(getContext(), null, "ks", "list", false); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayPaused(KsContentPage.ContentItem contentItem) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayResume(KsContentPage.ContentItem contentItem) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayCompleted(KsContentPage.ContentItem contentItem) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayError(KsContentPage.ContentItem contentItem, int i, int i1) { |
| | | |
| | | } |
| | | }); |
| | | ksFeedPage.setPageListener(new KsContentPage.PageListener() { |
| | | @Override |
| | | public void onPageEnter(KsContentPage.ContentItem contentItem) { |
| | |
| | | import com.weikou.beibeivideo.ui.recommend.GuessLikeAdapter; |
| | | import com.weikou.beibeivideo.util.BeibeiConstant; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | | import com.weikou.beibeivideo.util.video.DPEventCollectUtil; |
| | | import com.weikou.beibeivideo.widget.MySwipeRefreshLayout; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | public void preInit() { |
| | | KsScene adScene = new KsScene.Builder(KSConstant.PID_FULL_VIDEO).build(); |
| | | ksContentPage = KsAdSDK.getLoadManager().loadContentPage(adScene); |
| | | ksContentPage.setVideoListener(new KsContentPage.VideoListener() { |
| | | @Override |
| | | public void onVideoPlayStart(KsContentPage.ContentItem contentItem) { |
| | | Log.i(TAG, "onVideoPlayStart"); |
| | | DPEventCollectUtil.playDrawVideo(getContext(), null, "ks", "home", false); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayPaused(KsContentPage.ContentItem contentItem) { |
| | | Log.i(TAG, "onVideoPlayPaused"); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayResume(KsContentPage.ContentItem contentItem) { |
| | | Log.i(TAG, "onVideoPlayResume"); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayCompleted(KsContentPage.ContentItem contentItem) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoPlayError(KsContentPage.ContentItem contentItem, int i, int i1) { |
| | | Log.i(TAG, "onVideoPlayError"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | import com.weikou.beibeivideo.ui.MyRetainViewFragment; |
| | | import com.weikou.beibeivideo.ui.category.CategoryAdapter; |
| | | import com.weikou.beibeivideo.ui.recommend.SearchActivity; |
| | | import com.weikou.beibeivideo.util.video.DPEventCollectUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | public class NovelFragment extends MyRetainViewFragment implements |
| | | OnClickListener { |
| | | private FragmentManager fragmentManager; |
| | | |
| | | public NovelFragment() { |
| | | super(); |
| | | setName(NovelFragment.class.getName()); |
| | | } |
| | | |
| | | public NovelFragment(FragmentManager fragmentManager) { |
| | | super(); |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | NovelSDK.INSTANCE.getNovelFragment().onResume(); |
| | | DPEventCollectUtil.uploadNovelReadTime(getContext()); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.weikou.beibeivideo.util.video; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import com.bytedance.novel.pangolin.NovelSDK; |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 抖音信息收集 |
| | | */ |
| | | public class DPEventCollectUtil { |
| | | |
| | | |
| | | /** |
| | | * 沉浸式视频播放 |
| | | * |
| | | * @param context |
| | | * @param from |
| | | */ |
| | | public static void playDrawVideo(Context context, Map<String, Object> map, String type, String from, boolean complete) { |
| | | |
| | | BeibeiVideoAPI.playDrawVideo(context, type, from, complete, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上传小说阅读时间 |
| | | * |
| | | * @param context |
| | | */ |
| | | public static void uploadNovelReadTime(Context context) { |
| | | long time = NovelSDK.INSTANCE.getNovelReadingDuration(); |
| | | if (time <= 0) |
| | | return; |
| | | BeibeiVideoAPI.readNovel(context, time, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 进入详情 |
| | | * |
| | | * @param context |
| | | * @param map |
| | | */ |
| | | public static void newsDetailEnter(Context context, Map<String, Object> map) { |
| | | BeibeiVideoAPI.readNews(context, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |