3个文件已删除
59个文件已修改
38个文件已添加
| | |
| | | <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> |
| | | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| | | |
| | | <uses-sdk tools:overrideLibrary="com.bytedance.pangrowthsdk,com.bytedance.novel.pangolin" /> |
| | | |
| | | <application xmlns:tools="http://schemas.android.com/tools" |
| | | android:name=".MGVideoApplication" |
| | | android:allowBackup="true" |
| | |
| | | <activity |
| | | android:name=".ui.main.MainActivity" |
| | | android:label="@string/app_name" |
| | | android:launchMode="singleTask"></activity> |
| | | android:configChanges="keyboard|orientation|screenSize" |
| | | android:launchMode="singleTask"> |
| | | |
| | | </activity> |
| | | <activity |
| | | android:name=".ui.common.MVideosActivity" |
| | | android:label="@string/app_name"></activity> |
| | |
| | | android:name=".ui.category.StarDetailActivity" |
| | | android:label="@string/app_name"></activity> |
| | | |
| | | <activity |
| | | android:name=".ui.common.CommonFragmentActivity" |
| | | android:label="@string/app_name"></activity> |
| | | |
| | | |
| | | <service android:name=".service.DownLoadFileService" /> |
| | | |
| | |
| | | android:value="2.5" /> |
| | | <meta-data |
| | | android:name="UMENG_CHANNEL" |
| | | android:value="huawei"></meta-data> |
| | | android:value="QQ"></meta-data> |
| | | |
| | | |
| | | <meta-data |
New file |
| | |
| | | { |
| | | "init": { |
| | | "site_id": "5115334", |
| | | "app_id": "300974", |
| | | "partner": "pangle_300974", |
| | | "secure_key": "0dc597a9533e662ca9acab1c0ef1c2bb" |
| | | }, |
| | | "feed": { |
| | | "news_list_ad_code_id": "947237149", |
| | | "news_first_ad_code_id": "947237150", |
| | | "news_second_ad_code_id": "947237136", |
| | | "video_first_ad_code_id": "", |
| | | "video_second_ad_code_id": "947237134", |
| | | "related_ad_code_id": "947237169", |
| | | "news_draw_ad_code_id": "947237160", |
| | | "news_draw_native_ad_code_id": "947237165", |
| | | "news_outer_list_ad_code_id": "947237141", |
| | | "news_outer_first_ad_code_id": "947237155", |
| | | "news_outer_second_ad_code_id": "947237143", |
| | | "outer_video_second_ad_code_id": "947237171", |
| | | "outer_related_ad_code_id": "947237154", |
| | | "news_outer_draw_ad_code_id": "947237145", |
| | | "news_outer_draw_native_ad_code_id": "947237137", |
| | | "news_interstitial_code_id": "947237166" |
| | | }, |
| | | "small_video": { |
| | | "draw_ad_code_id": "947237161", |
| | | "draw_native_ad_code_id": "947237163", |
| | | "grid_ad_code_id": "947237140", |
| | | "grid_draw_ad_code_id": "947237158", |
| | | "grid_draw_native_ad_code_id": "947237148", |
| | | "video_card_ad_code_id": "947237168", |
| | | "video_card_draw_ad_code_id": "947237146", |
| | | "video_card_draw_native_ad_code_id": "947237157", |
| | | "interstitial_ad_code_id": "947237138", |
| | | "interstitial_note_ad_code_id": "947237164", |
| | | "staggered_grid_ad_code_id": "947237152", |
| | | "staggered_grid_draw_ad_code_id": "947237161", |
| | | "staggered_grid_draw_native_ad_code_id": "947237163" |
| | | }, |
| | | "novel": { |
| | | "status": 1, |
| | | "pre_ad_code_id": "947236541", |
| | | "mid_ad_code_id": "947236533", |
| | | "exciting_ad_code_id": "947236530", |
| | | "interstitial_code_id": "947236537", |
| | | "banner_ad_code_id": "947236534", |
| | | "end_ad_code_id": "947236532" |
| | | } |
| | | } |
New file |
| | |
| | | { |
| | | "init": { |
| | | "site_id": "5123000", |
| | | "app_id": "300975", |
| | | "partner": "pangle_300975", |
| | | "secure_key": "14788f710869423a4d2de41dc9fdf583" |
| | | }, |
| | | "feed": { |
| | | "news_list_ad_code_id": "947237201", |
| | | "news_first_ad_code_id": "947237202", |
| | | "news_second_ad_code_id": "947237191", |
| | | "video_first_ad_code_id": "", |
| | | "video_second_ad_code_id": "947237190", |
| | | "related_ad_code_id": "947237188", |
| | | "news_draw_ad_code_id": "947237210", |
| | | "news_draw_native_ad_code_id": "947237214", |
| | | "news_outer_list_ad_code_id": "947237195", |
| | | "news_outer_first_ad_code_id": "947237206", |
| | | "news_outer_second_ad_code_id": "947237196", |
| | | "outer_video_second_ad_code_id": "947237189", |
| | | "outer_related_ad_code_id": "947237205", |
| | | "news_outer_draw_ad_code_id": "947237198", |
| | | "news_outer_draw_native_ad_code_id": "947237192", |
| | | "news_interstitial_code_id": "947237215" |
| | | }, |
| | | "small_video": { |
| | | "draw_ad_code_id": "947237211", |
| | | "draw_native_ad_code_id": "947237212", |
| | | "grid_ad_code_id": "947237194", |
| | | "grid_draw_ad_code_id": "947237209", |
| | | "grid_draw_native_ad_code_id": "947237200", |
| | | "video_card_ad_code_id": "947237187", |
| | | "video_card_draw_ad_code_id": "947237199", |
| | | "video_card_draw_native_ad_code_id": "947237207", |
| | | "interstitial_ad_code_id": "947237193", |
| | | "interstitial_note_ad_code_id": "947237213", |
| | | "staggered_grid_ad_code_id": "947237204", |
| | | "staggered_grid_draw_ad_code_id": "947237211", |
| | | "staggered_grid_draw_native_ad_code_id": "947237212" |
| | | }, |
| | | "novel": { |
| | | "status": 1, |
| | | "pre_ad_code_id": "947236542", |
| | | "mid_ad_code_id": "947236536", |
| | | "exciting_ad_code_id": "947236556", |
| | | "interstitial_code_id": "947236548", |
| | | "banner_ad_code_id": "947236539", |
| | | "end_ad_code_id": "947236545" |
| | | } |
| | | } |
| | |
| | | implementation project(path: ':library-video') |
| | | implementation project(path: ':library-youth') |
| | | |
| | | implementation ('com.pangle.cn:pangrowth-sdk:1.7.0.0'){ |
| | | exclude group: 'com.pangle.cn', module: 'pangrowth-dpsdk-live' |
| | | exclude group: 'com.pangle.cn', module: 'pangrowth-game-sdk' |
| | | exclude group: 'com.pangle.cn', module: 'pangrowth-luckycat-sdk' |
| | | } |
| | | |
| | | //indicator |
| | | // implementation 'com.github.hackware1993:MagicIndicator:1.7.0' |
| | | |
| | | |
| | | } |
| | | android { |
| | | |
| | | dexOptions { |
| | | javaMaxHeapSize = "4g" |
| | | } |
| | | |
| | | //配置自定义打包名称 |
| | | applicationVariants.all { variant -> |
| | | variant.outputs.all { |
| | | def fileName |
| | | if (variant.buildType.name.equals('release')) { |
| | | fileName = "mg_${variant.mergedFlavor.versionName}_release.apk" |
| | | } else if (variant.buildType.name.equals('debug')) { |
| | | fileName = "${variant.mergedFlavor.versionName}_debug.apk" |
| | | } |
| | | outputFileName = fileName |
| | | } |
| | | } |
| | | |
| | | signingConfigs { |
| | | debug { |
| | | // storeFile file('D:\\项目\\影音\\签名\\FastTortoisekey') |
| | | // storePassword 'weikou2014' |
| | | // keyAlias '乌龟快快' |
| | | // keyPassword 'weikou2014' |
| | | storeFile file('D:\\项目\\影音\\签名\\FastTortoisekey') |
| | | storePassword 'weikou2014' |
| | | keyAlias '乌龟快快' |
| | | keyPassword 'weikou2014' |
| | | //华为木瓜 |
| | | storeFile file('D:\\项目\\影音\\签名\\qumikey') |
| | | storePassword 'weikou2016' |
| | | keyAlias 'qumi' |
| | | keyPassword 'weikou2016' |
| | | // storeFile file('D:\\项目\\影音\\签名\\qumikey') |
| | | // storePassword 'weikou2016' |
| | | // keyAlias 'qumi' |
| | | // keyPassword 'weikou2016' |
| | | } |
| | | } |
| | | buildTypes { |
| | |
| | | targetCompatibility JavaVersion.VERSION_1_8 |
| | | } |
| | | defaultConfig { |
| | | // applicationId "com.mugua.mgvideo" |
| | | applicationId "com.qm.fbvideo" |
| | | applicationId "com.mugua.mgvideo" |
| | | // applicationId "com.qm.fbvideo" |
| | | //84 |
| | | versionCode 85 |
| | | versionName "2.4.5" |
| | | versionCode 86 |
| | | versionName "2.4.6" |
| | | multiDexEnabled = true |
| | | ndk { |
| | | abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' |
| | |
| | | // resValue "string", "app_name", "影视大全精简版" |
| | | // resValue "string", "agreement", "http://111.231.250.166/ysdqjj/userAgreenment.html" |
| | | // resValue "string", "privacy", "http://111.231.250.166/ysdqjj/privacyPolicy.html" |
| | | // resValue "string", "idp_file", "SDK_Setting_5123000.json" |
| | | // resValue "string", "about_us_url", "http://111.231.250.166/ysdqjj/aboutUs.html" |
| | | // |
| | | // |
| | | // manifestPlaceholders = [app_icon: "@drawable/app_icon",splashLayout:"activity_splash_ysdqjj"] |
| | | |
| | | //*********公共开始********** |
| | | resValue "string", "app_name", "木瓜影视大全" |
| | | resValue "string", "agreement", "http://h5.mugua.yeshitv.com/user_protocol.html" |
| | | resValue "string", "privacy", "http://h5.mugua.yeshitv.com/privacy.html" |
| | | resValue "string", "about_us_url", "http://h5.mugua.yeshitv.com/abountOur/index.html" |
| | | manifestPlaceholders = [app_icon: "@drawable/ic_launcher", splashLayout: "activity_splash"] |
| | | //*********公共结束********** |
| | | |
| | | |
| | | |
| | | //*********木瓜开始********** |
| | | resValue "string", "idp_file", "SDK_Setting_5115334.json" |
| | | //*********木瓜结束********** |
| | | |
| | | |
| | | |
| | | |
| | | //*********华为木瓜开始********** |
| | | resValue "string", "umeng_key", "56a1dfbe67e58e6bb10002a2" |
| | | resValue "string", "qq_id", "" |
| | | resValue "string", "qq_key", "AI6ri4IcDhsacEoP" |
| | | resValue "string", "ad_csj_app_id", "5123000" |
| | | resValue "string", "ad_csj_pid_splash", "887407507" |
| | | resValue "string", "ad_csj_pid_video_detail_fullvideo", "945640921" |
| | | resValue "string", "ad_csj_pid_recommend_big", "946382923" |
| | | resValue "string", "ad_csj_pid_pptv_insert", "946909947" |
| | | |
| | | |
| | | |
| | | |
| | | resValue "string", "ad_gdt_app_id", "1106495463" |
| | | resValue "string", "ad_gdt_pid_splash", "4011340484841820" |
| | | resValue "string", "ad_gdt_pid_home_recommend", "5011840464486076" |
| | | resValue "string", "ad_gdt_pid_2_video_list_column2", "6032700999360323" |
| | | resValue "string", "ad_gdt_pid_2_video_list_column3", "4042804929362396" |
| | | resValue "string", "ad_gdt_pid_2_search_result_album", "1052004949566734" |
| | | resValue "string", "ad_gdt_pid_home_and_play_big_picture", "5011840464486076" |
| | | resValue "string", "ad_gdt_pid_template_search_result", "" |
| | | resValue "string", "ad_gdt_pid_exit_dialog", "3071141484940803" |
| | | resValue "string", "ad_gdt_pid_video_detail_insert", "1002940790571485" |
| | | resValue "string", "ad_gdt_pid_pptv_insert", "8072445701746253" |
| | | |
| | | |
| | | |
| | | resValue "string", "baidu_app_id", "b085a885" |
| | | // resValue "string", "idp_file", "SDK_Setting_5123000.json" |
| | | // resValue "string", "umeng_key", "56a1dfbe67e58e6bb10002a2" |
| | | // resValue "string", "qq_id", "" |
| | | // resValue "string", "qq_key", "AI6ri4IcDhsacEoP" |
| | | // resValue "string", "ad_csj_app_id", "5123000" |
| | | // resValue "string", "ad_csj_pid_splash", "887407507" |
| | | // resValue "string", "ad_csj_pid_video_detail_fullvideo", "945640921" |
| | | // resValue "string", "ad_csj_pid_recommend_big", "946382923" |
| | | // resValue "string", "ad_csj_pid_pptv_insert", "946909947" |
| | | // resValue "string", "ad_csj_pid_home_insert", "947433584" |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // resValue "string", "ad_gdt_app_id", "1106495463" |
| | | // resValue "string", "ad_gdt_pid_splash", "4011340484841820" |
| | | // resValue "string", "ad_gdt_pid_home_recommend", "5011840464486076" |
| | | // resValue "string", "ad_gdt_pid_2_video_list_column2", "6032700999360323" |
| | | // resValue "string", "ad_gdt_pid_2_video_list_column3", "4042804929362396" |
| | | // resValue "string", "ad_gdt_pid_2_search_result_album", "1052004949566734" |
| | | // resValue "string", "ad_gdt_pid_home_and_play_big_picture", "5011840464486076" |
| | | // resValue "string", "ad_gdt_pid_template_search_result", "" |
| | | // resValue "string", "ad_gdt_pid_exit_dialog", "3071141484940803" |
| | | // resValue "string", "ad_gdt_pid_video_detail_insert", "1002940790571485" |
| | | // resValue "string", "ad_gdt_pid_pptv_insert", "8072445701746253" |
| | | // resValue "string", "ad_gdt_pid_home_insert", "9082277774265644" |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // resValue "string", "baidu_app_id", "b085a885" |
| | | //*********华为木瓜结束********** |
| | | } |
| | | |
| | |
| | | // } |
| | | // } |
| | | |
| | | |
| | | sourceSets { |
| | | main { |
| | | manifest.srcFile 'AndroidManifest.xml' |
| | |
| | | { |
| | | "type": "SINGLE", |
| | | "filters": [], |
| | | "versionCode": 85, |
| | | "versionName": "2.4.5", |
| | | "outputFile": "MGVideo-release.apk" |
| | | "versionCode": 86, |
| | | "versionName": "2.4.6", |
| | | "outputFile": "mg_2.4.6_release.apk" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_category_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_category" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_draw_video_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_draw_video" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_mine_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_mine" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_novel_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_novel" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_recomend_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_recomend" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_shop_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_shop" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/icon_nav_watch_highlight" android:state_checked="true"></item> |
| | | <item android:drawable="@drawable/icon_nav_watch" android:state_checked="false"></item> |
| | | |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android" > |
| | | |
| | | <corners android:radius="8dp" /> |
| | | |
| | | <solid android:color="@android:color/white" /> |
| | | |
| | | |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="20dp" /> |
| | | |
| | | <solid android:color="#FF323232" /> |
| | | |
| | | <corners android:radius="20dp"></corners> |
| | | |
| | | <stroke |
| | | android:width="1px" |
| | | android:color="#FF959595"></stroke> |
| | | |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:background="@color/top_bar_color"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_back" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center_vertical" |
| | | android:drawableLeft="@drawable/ic_back" |
| | | android:drawablePadding="3dp" |
| | | android:gravity="center_vertical" |
| | | android:padding="8dp" |
| | | android:text="返回" |
| | | android:textColor="@color/white" |
| | | android:textSize="16sp" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_title" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:paddingTop="6dp" |
| | | android:paddingBottom="6dp" |
| | | android:text="" |
| | | android:textColor="@color/white" |
| | | android:textSize="20sp" /> |
| | | </FrameLayout> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"></FrameLayout> |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:id="@+id/fl_container" |
| | | android:layout_height="match_parent"> |
| | | |
| | | </FrameLayout> |
| | |
| | | android:orientation="vertical"> |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/rl_nav" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:visibility="gone" |
| | | android:background="#ff222222" |
| | | android:gravity="center_vertical" |
| | | android:orientation="horizontal"> |
| | |
| | | android:layout_height="match_parent"> |
| | | |
| | | <ImageView |
| | | android:scaleType="centerCrop" |
| | | android:id="@+id/iv_picture" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"></ImageView> |
| | | android:layout_height="match_parent" |
| | | android:scaleType="centerCrop"></ImageView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_close" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="top|right" |
| | | android:padding="2dp" |
| | | android:text="关闭" |
| | | android:textColor="@color/gray" |
| | | android:textSize="10sp"></TextView> |
| | | |
| | | </FrameLayout> |
| | | |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.625"> |
| | | <androidx.cardview.widget.CardView |
| | | app:cardCornerRadius="4dp" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:src="@drawable/tsa_ad_logo" |
| | | android:visibility="gone" /> |
| | | </FrameLayout> |
| | | |
| | | </androidx.cardview.widget.CardView> |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | |
| | | <TextView |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="horizontal"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"></FrameLayout> |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_video_card_title" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="10dp" |
| | | android:text="今日必看" |
| | | android:textColor="#ff222222" |
| | | android:textSize="15sp" |
| | | android:visibility="gone" |
| | | android:textStyle="bold" /> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="-8dp"></FrameLayout> |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:paddingBottom="14dp"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="10dp" |
| | | android:layout_marginRight="10dp" |
| | | android:background="@drawable/shape_corner_radius_white_8" |
| | | android:paddingTop="14dp" |
| | | android:paddingBottom="14dp"></FrameLayout> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" > |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1dp" |
| | | android:background="@color/blue2" /> |
| | | <!-- <View--> |
| | | <!-- android:layout_width="match_parent"--> |
| | | <!-- android:layout_height="1dp"--> |
| | | <!-- android:background="@color/blue2" />--> |
| | | |
| | | <RadioGroup |
| | | android:id="@+id/rg_nav" |
| | |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_recommend" |
| | | android:drawableTop="@drawable/selector_nav_recommend" |
| | | android:gravity="center_horizontal" |
| | | android:text="@string/recommend" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="13sp" /> |
| | | android:textSize="10sp" /> |
| | | |
| | | |
| | | <RadioButton |
| | | android:id="@+id/rb_nav_short_video" |
| | | android:id="@+id/rb_nav_draw_video" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_shortvideo" |
| | | android:drawableTop="@drawable/selector_nav_draw_video" |
| | | android:gravity="center_horizontal" |
| | | android:text="@string/shortVideo" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="13sp" /> |
| | | android:textSize="10sp" /> |
| | | <RadioButton |
| | | android:id="@+id/rb_nav_category" |
| | | android:layout_width="0dp" |
| | |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_category" |
| | | android:drawableTop="@drawable/selector_nav_category" |
| | | android:gravity="center_horizontal" |
| | | android:text="@string/category" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="13sp" /> |
| | | android:textSize="10sp" /> |
| | | |
| | | <RadioButton |
| | | android:id="@+id/rb_nav_watch" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_nav_watch" |
| | | android:gravity="center_horizontal" |
| | | android:text="看一看" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="10sp" /> |
| | | |
| | | <RadioButton |
| | | android:id="@+id/rb_shop" |
| | |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_shop" |
| | | android:drawableTop="@drawable/selector_nav_shop" |
| | | android:gravity="center_horizontal" |
| | | android:text="@string/shop" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="13sp" /> |
| | | android:textSize="10sp" /> |
| | | |
| | | <RadioButton |
| | | android:id="@+id/rb_nav_novel" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_nav_novel" |
| | | android:gravity="center_horizontal" |
| | | android:text="小说" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="10sp" /> |
| | | |
| | | |
| | | <RadioButton |
| | |
| | | android:background="@android:color/white" |
| | | android:button="@null" |
| | | android:drawablePadding="4dp" |
| | | android:drawableTop="@drawable/selector_mine" |
| | | android:drawableTop="@drawable/selector_nav_mine" |
| | | android:gravity="center_horizontal" |
| | | android:text="@string/mine" |
| | | android:textAppearance="?android:attr/textAppearanceSmall" |
| | | android:textColor="@color/selector_bottom_bar_text" |
| | | android:textSize="13sp" /> |
| | | android:textSize="10sp" /> |
| | | </RadioGroup> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:background="#ff222222" |
| | | android:padding="8dp"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center_vertical"> |
| | | |
| | | |
| | | <ImageView |
| | | android:id="@+id/logo" |
| | | android:layout_width="wrap_content" |
| | |
| | | android:contentDescription="@string/app_name" |
| | | android:src="@drawable/logo" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_go_search" |
| | | android:layout_width="wrap_content" |
| | | <LinearLayout |
| | | android:layout_marginLeft="22dp" |
| | | android:layout_width="0dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:layout_alignParentEnd="true" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/search_input_bg" |
| | | android:gravity="center_vertical"> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_go_search" |
| | | android:layout_width="0dp" |
| | | android:layout_height="28dp" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/shape_search_bg" |
| | | android:drawableEnd="@drawable/ic_search" |
| | | android:drawableRight="@drawable/ic_search" |
| | | android:ellipsize="end" |
| | | android:gravity="center_vertical" |
| | | android:maxEms="7" |
| | | android:paddingLeft="8dp" |
| | | android:paddingLeft="15dp" |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" |
| | | android:textAppearance="?android:attr/textAppearance" |
| | | android:textColor="@color/white" /> |
| | | android:textColor="#FF999999" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_shop" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="17dp" |
| | | android:drawableTop="@drawable/icon_nav_shop" |
| | | android:drawablePadding="1dp" |
| | | android:gravity="center" |
| | | android:text="集市" |
| | | android:textColor="#FF999999" |
| | | android:textSize="7sp"></TextView> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_category" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="17dp" |
| | | android:layout_marginRight="5dp" |
| | | android:drawableTop="@drawable/icon_nav_category" |
| | | android:drawablePadding="1dp" |
| | | android:gravity="center" |
| | | android:text="分类" |
| | | android:textColor="#FF999999" |
| | | android:textSize="7sp"></TextView> |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | |
| | | <FrameLayout |
| | | android:layout_width="wrap_content" |
| | |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="top|right" |
| | | android:visibility="gone" |
| | | android:src="@drawable/ic_red_point"></ImageView> |
| | | android:src="@drawable/ic_red_point" |
| | | android:visibility="gone"></ImageView> |
| | | </FrameLayout> |
| | | </RelativeLayout> |
| | | |
| | |
| | | <AutoCompleteTextView |
| | | android:id="@+id/et_search_key" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_height="28dp" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/search_input_bg" |
| | | android:background="@drawable/shape_search_bg" |
| | | android:completionThreshold="1" |
| | | android:drawableEnd="@drawable/ic_search" |
| | | android:drawableRight="@drawable/ic_search" |
| | | android:inputType="text" |
| | | android:paddingLeft="8dp" |
| | | android:paddingLeft="15dp" |
| | | android:paddingRight="8dp" |
| | | android:textAppearance="?android:attr/textAppearance" |
| | | android:textColor="@color/white" |
| | |
| | | android:orientation="vertical" > |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/rl_search_bar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:padding="8dp" > |
| | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_go_search" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_width="200dp" |
| | | android:layout_height="28dp" |
| | | android:layout_alignParentEnd="true" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_centerVertical="true" |
| | | android:background="@drawable/search_input_bg" |
| | | android:background="@drawable/shape_search_bg" |
| | | android:drawableEnd="@drawable/ic_search" |
| | | android:drawableRight="@drawable/ic_search" |
| | | android:gravity="center_vertical" |
| | | android:paddingLeft="8dp" |
| | | android:paddingLeft="15dp" |
| | | android:paddingRight="8dp" |
| | | android:singleLine="true" |
| | | android:textAppearance="?android:attr/textAppearance" |
| | |
| | | |
| | | <string name="recommend">推荐</string> |
| | | <string name="category">分类</string> |
| | | <string name="shortVideo">短视频</string> |
| | | <string name="shortVideo">刷一刷</string> |
| | | <string name="news">资讯</string> |
| | | <string name="shop">集市</string> |
| | | <string name="recent">最近</string> |
| | |
| | | package com.mugua.mgvideo; |
| | | |
| | | import android.Manifest; |
| | | import android.app.ActivityManager; |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | |
| | | import android.os.Build; |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.Log; |
| | | import android.webkit.WebView; |
| | | |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | | import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback; |
| | | import com.baidu.mobads.AppActivity; |
| | | import com.bytedance.novel.pangolin.NovelConfig; |
| | | import com.bytedance.novel.pangolin.NovelSDK; |
| | | import com.bytedance.novel.pangolin.PangolinDocker; |
| | | import com.bytedance.novel.pangolin.data.NormalFontType; |
| | | import com.bytedance.novel.pangolin.data.ReaderFontType; |
| | | import com.bytedance.sdk.dp.DPSdk; |
| | | import com.bytedance.sdk.dp.DPSdkConfig; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.fun.xm.FSPlayer; |
| | | import com.funshion.playsdk.callback.FunshionPlayInitCallback; |
| | |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.umeng.socialize.PlatformConfig; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.CSJConstant; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.ad.TTAdManagerHolder; |
| | |
| | | ARouter.init(application); |
| | | ARouter.openDebug(); |
| | | ARouter.openLog(); |
| | | |
| | | initNovel(application); |
| | | initDPSDK(application); |
| | | |
| | | |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { |
| | | String processName = getProcessName(application); |
| | | String packageName = application.getPackageName(); |
| | | if (!packageName.equals(processName)) { |
| | | WebView.setDataDirectorySuffix(processName); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | private static void initFunshion(Application application) { |
| | |
| | | } |
| | | |
| | | |
| | | private static void initNovel(Application application) { |
| | | if (!AdUtil.isCanInitCSJ()) { |
| | | return; |
| | | } |
| | | |
| | | NovelConfig config = new NovelConfig.Builder() |
| | | .appName(application.getString(R.string.app_name)) //接入小说SDK的App的英文名 必填 |
| | | .appVersionName(PackageUtils2.getVersionName(application)) //接入小说SDKApp的版本名称 必填 |
| | | .appVersionCode(PackageUtils2.getVersionCode(application)) //接入小说SDK App的版本号 必填 |
| | | .channel(ManifestDataUtil.getAppMetaData(application, "UMENG_CHANNEL")) //渠道号维度。开发者自定义字符串即可(建议不要包含test)。选填 |
| | | .initInnerApplog(true) // 是否使用小说sdk来初始化applog sdk。默认为false,需要开发者在App中单独初始化applog sdk,且必须在小说sdk之前初始化。 |
| | | .initInnerOpenAdSdk(true) //是否使用小说sdk来初始化广告sdk,如果为true,需要设置siteId。默认为false,需开发者在App中单独初始化广告sdk并在小说sdk之前初始化。 |
| | | .jsonFileName(application.getString(R.string.idp_file))//json配置文件的名称 必填 |
| | | .normalFontSize(NormalFontType.NORMAL) //全局字号大小 可选 |
| | | .readerFontSize(ReaderFontType.TWO) //阅读器字号大小 可选 |
| | | .build(); |
| | | NovelSDK.INSTANCE.attach(new PangolinDocker(config), application); |
| | | } |
| | | |
| | | private static boolean dpSDKIninted; |
| | | |
| | | public static void initDPSDK(Application application) { |
| | | if (!AdUtil.isCanInitCSJ()) { |
| | | return; |
| | | } |
| | | if (!dpSDKIninted) { |
| | | DPSdkConfig.Builder configBuilder = new DPSdkConfig.Builder() |
| | | .debug(true) |
| | | .preloadDraw(true) |
| | | .needInitAppLog(false) |
| | | .setIsAndroidx(true) |
| | | .initListener(new DPSdkConfig.InitListener() { |
| | | @Override |
| | | public void onInitComplete(boolean b) { |
| | | dpSDKIninted = b; |
| | | } |
| | | }) //接入了红包功能需要传入的参数,没有接入的话可以忽略该配置 |
| | | // .luckConfig(new DPSdkConfig.LuckConfig().application(application).enableLuck(false)) |
| | | // .liveConfig(new DPSdkConfig.LiveConfig()) |
| | | |
| | | ;//若您需要接入直播,参考「直播接入文档」;否则可忽略此参数。 |
| | | DPSdk.init(application, application.getString(R.string.idp_file), configBuilder.build()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //初始化监听 |
| | | public interface InitListener { |
| | | public void onFinish(); |
New file |
| | |
| | | package com.mugua.mgvideo.entity; |
| | | |
| | | public enum HomeNavType { |
| | | |
| | | recommend, |
| | | category, |
| | | shop, |
| | | mine, |
| | | novel, |
| | | drawVideo, |
| | | news; |
| | | |
| | | } |
| | |
| | | public final static int TYPE_BANNER = 1; |
| | | public final static int TYPE_AD = 2; |
| | | public final static int TYPE_HOMETYPE = 3; |
| | | //新闻 |
| | | public final static int TYPE_NEWS = 4; |
| | | //信息流 |
| | | public final static int TYPE_DRAW_VIDEOS = 5; |
| | | |
| | | private int type; |
| | | private List<HomeAd> homeBannerList; |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.ui.common.VideosFragment; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.mugua.mgvideo.util.VideoTypeUtil; |
| | | import com.viewpagerindicator.MTabPageIndicator; |
| | | import com.yeshi.base.entity.video.VideoType; |
| | |
| | | findViewById(R.id.pager) |
| | | .setVisibility(View.VISIBLE); |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoType> videoType = gson.fromJson( |
| | | |
| | | |
| | | List<VideoType> videoType = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoType>>() { |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | 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.RetainViewFragment; |
| | | import com.mugua.mgvideo.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.ui.discover.StarWorksAdapter; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import android.widget.Toast; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | 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.RetainViewFragment; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | |
| | | System.out.println("hhhhh====" |
| | | + jsonObject.getJSONObject("Data") |
| | | .toString()); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.handmark.pulltorefresh.library.PullToRefreshBase; |
| | | import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode; |
| | |
| | | import com.lcjian.library.util.cache.DiskLruCache; |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.ui.category.ChannelAdapter; |
| | | import com.mugua.mgvideo.ui.category.ChannelAdapterHot; |
| | |
| | | * @throws Exception |
| | | */ |
| | | protected void getdatas(String jsonObject) throws Exception { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | List<VideoType> categories = gson.fromJson(jsonObject, |
| | | |
| | | List<VideoType> categories = JsonUtil.videoGson.fromJson(jsonObject, |
| | | new TypeToken<List<VideoType>>() { |
| | | }.getType()); |
| | | List<VideoType> mainTypes = new ArrayList<VideoType>(); |
| | |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | | |
| | | 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.RetainViewFragment; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.mugua.mgvideo.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.ui.category.NewStarAdapter; |
| | | import com.mugua.mgvideo.ui.category.bean.HotStar; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HotStar> hotStarList = gson.fromJson( |
| | | |
| | | List<HotStar> hotStarList = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<HotStar>>() { |
| | |
| | | import android.widget.ListView; |
| | | import android.widget.ProgressBar; |
| | | |
| | | 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.RetainViewFragment; |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.mugua.mgvideo.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.ui.category.UniqueAdapter; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<UniqueBean> uniqueList = gson.fromJson( |
| | | |
| | | List<UniqueBean> uniqueList = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<UniqueBean>>() { |
New file |
| | |
| | | package com.mugua.mgvideo.ui.common; |
| | | |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.ui.BaseActivity; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | | |
| | | /** |
| | | * @author hxh |
| | | */ |
| | | public class CommonFragmentActivity extends BaseActivity { |
| | | |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle arg0) { |
| | | super.onCreate(arg0); |
| | | setContentView(R.layout.activity_fragment); |
| | | String title = getIntent().getStringExtra("title"); |
| | | String fragmentName = getIntent().getStringExtra("fragment"); |
| | | |
| | | AQuery mAquery = new AQuery(this); |
| | | mAquery.id(R.id.tv_title).text(title); |
| | | mAquery.id(R.id.tv_back).clicked(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | CommonFragmentActivity.this.finish(); |
| | | } |
| | | }); |
| | | |
| | | Object fragment = null; |
| | | |
| | | try { |
| | | Class clazz = Class.forName(fragmentName); |
| | | fragment = clazz.newInstance(); |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } catch (InstantiationException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (fragment == null) { |
| | | return; |
| | | } |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fl_container, (Fragment) fragment).commitAllowingStateLoss(); |
| | | } |
| | | } |
| | |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | |
| | | 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.RefreshLayout; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | mVideoInfos.clear(); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | fl_download_failure.setVisibility(View.GONE); |
| | | lv_video.setVisibility(View.VISIBLE); |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import android.widget.RadioGroup.OnCheckedChangeListener; |
| | | import android.widget.Toast; |
| | | |
| | | 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.RefreshLayout; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.ui.category.CategoryListAdapter; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.entity.video.VideoType; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | ll_videosfragment.setVisibility(View.VISIBLE); |
| | | iv_download_failure.setVisibility(View.GONE); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import com.lcjian.library.util.common.StorageUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.viewpagerindicator.CirclePageIndicator; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | |
| | | |
| | | private CirclePageIndicator indicator_theme; |
| | | |
| | | public static CategoryFragment newInstance(boolean showSearchBar) { |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putBoolean("searchBar", showSearchBar); |
| | | CategoryFragment fragment = new CategoryFragment(); |
| | | fragment.setArguments(bundle); |
| | | return fragment; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | |
| | | if (getArguments() != null && getArguments().getBoolean("searchBar", false)) { |
| | | contentView.findViewById(R.id.rl_search_bar).setVisibility(View.VISIBLE); |
| | | } else { |
| | | contentView.findViewById(R.id.rl_search_bar).setVisibility(View.GONE); |
| | | } |
| | | |
| | | tv_no_network = (TextView) contentView.findViewById(R.id.tv_no_network); |
| | | tv_no_network.setOnClickListener(this); |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getCategories")); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoType> categories = gson.fromJson( |
| | | |
| | | List<VideoType> categories = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<VideoType>>() { |
| | | }.getType()); |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getHotStars")); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HotVideoType> hotStars = gson.fromJson( |
| | | List<HotVideoType> hotStars = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<HotVideoType>>() { |
| | | }.getType()); |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | hotSearchs = gson.fromJson(jsonObject |
| | | |
| | | hotSearchs = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<String>>() { |
| | | }.getType()); |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoType> categories = gson.fromJson( |
| | | |
| | | List<VideoType> categories = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoType>>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HotVideoType> hotStars = gson.fromJson( |
| | | |
| | | List<HotVideoType> hotStars = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<HotVideoType>>() { |
New file |
| | |
| | | package com.mugua.mgvideo.ui.main; |
| | | |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | |
| | | import com.bytedance.sdk.dp.DPSdk; |
| | | import com.bytedance.sdk.dp.DPWidgetNewsParams; |
| | | import com.bytedance.sdk.dp.IDPNewsListener; |
| | | import com.bytedance.sdk.dp.IDPWidget; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.widget.myswiperefreshlayout.MySwipeRefreshLayout; |
| | | import com.mugua.mgvideo.R; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.fragment.app.FragmentManager; |
| | | |
| | | /** |
| | | * 主页面--快手视频 |
| | | */ |
| | | public class DYNewsFragment extends RetainViewFragment { |
| | | private static final String TAG = "DYNewsFragment"; |
| | | private FragmentManager fragmentManager; |
| | | private IDPWidget mIDPWidget; |
| | | |
| | | public DYNewsFragment() { |
| | | super(); |
| | | } |
| | | |
| | | public DYNewsFragment(FragmentManager fragmentManager) { |
| | | super(); |
| | | this.fragmentManager = fragmentManager; //fragmentManager; |
| | | } |
| | | |
| | | private Fragment fragment; |
| | | |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | | return R.layout.fragment_common; |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | Log.i(TAG, "onResume"); |
| | | super.onResume(); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onResume(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | Log.i(TAG, "onPause"); |
| | | super.onPause(); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onPause(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | Log.i(TAG, "onDestroy"); |
| | | super.onPause(); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onDestroy(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void setUserVisibleHint(boolean isVisibleToUser) { |
| | | Log.i(TAG, "setUserVisibleHint:"+isVisibleToUser); |
| | | super.setUserVisibleHint(isVisibleToUser); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().setUserVisibleHint(isVisibleToUser); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onHiddenChanged(boolean hidden) { |
| | | Log.i(TAG, "onHiddenChanged:"+hidden); |
| | | super.onHiddenChanged(hidden); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onHiddenChanged(hidden); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | Log.i(TAG, "onCreateView"); |
| | | initNewsWidget(); |
| | | } |
| | | |
| | | private void initNewsWidget() { |
| | | mIDPWidget = DPSdk.factory().createNewsTabs(DPWidgetNewsParams.obtain().channelCategory("视频") |
| | | .listener(new IDPNewsListener() { |
| | | @Override |
| | | public void onDPRefreshFinish() { |
| | | log("onDPRefreshFinish"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPNewsItemClick(Map<String, Object> map) { |
| | | log("onDPNewsItemClick"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoPlay(Map<String, Object> map) { |
| | | log("onDPVideoPlay"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoPause(Map<String, Object> map) { |
| | | log("onDPVideoPause"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoContinue(Map<String, Object> map) { |
| | | log("onDPVideoContinue"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoOver(Map<String, Object> map) { |
| | | log("onDPVideoOver"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPNewsDetailEnter(Map<String, Object> map) { |
| | | log("onDPNewsDetailEnter"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPNewsDetailExit(Map<String, Object> map) { |
| | | log("onDPNewsDetailExit"); |
| | | } |
| | | |
| | | |
| | | })); |
| | | |
| | | Fragment fragment = mIDPWidget.getFragment(); |
| | | if (fragment != null) { |
| | | getChildFragmentManager().beginTransaction().replace(R.id.fl_container, fragment).commitAllowingStateLoss(); |
| | | } |
| | | } |
| | | |
| | | private static void log(String msg) { |
| | | Log.d(TAG, String.valueOf(msg)); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mugua.mgvideo.ui.main; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | |
| | | import com.bytedance.sdk.dp.DPSdk; |
| | | import com.bytedance.sdk.dp.DPWidgetDrawParams; |
| | | import com.bytedance.sdk.dp.IDPNewsListener; |
| | | import com.bytedance.sdk.dp.IDPWidget; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.mugua.mgvideo.R; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.Fragment; |
| | | |
| | | /** |
| | | * 主页面--抖音沉浸式视频流 |
| | | */ |
| | | public class DYVideoFragment extends RetainViewFragment { |
| | | private static final String TAG = "DYVideoFragment"; |
| | | private IDPWidget mIDPWidget; |
| | | |
| | | |
| | | |
| | | public DYVideoFragment() { |
| | | super(); |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | Log.i(TAG, "onCreate"); |
| | | } |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | | return R.layout.fragment_common; |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG, "onResume"); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onResume(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | Log.i(TAG, "onPause"); |
| | | super.onPause(); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onPause(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void setUserVisibleHint(boolean isVisibleToUser) { |
| | | Log.i(TAG, "setUserVisibleHint:" + isVisibleToUser); |
| | | super.setUserVisibleHint(isVisibleToUser); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().setUserVisibleHint(isVisibleToUser); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onHiddenChanged(boolean hidden) { |
| | | Log.i(TAG, "onHiddenChanged:" + hidden); |
| | | super.onHiddenChanged(hidden); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onHiddenChanged(hidden); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | Log.i(TAG, "onCreateView"); |
| | | init(); |
| | | } |
| | | |
| | | private void init() { |
| | | mIDPWidget = DPSdk.factory().createDraw(DPWidgetDrawParams.obtain().hideClose(true, null) |
| | | .listener(new IDPNewsListener() { |
| | | @Override |
| | | public void onDPRefreshFinish() { |
| | | log("onDPRefreshFinish"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPNewsItemClick(Map<String, Object> map) { |
| | | log("onDPNewsItemClick"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoPlay(Map<String, Object> map) { |
| | | log("onDPVideoPlay"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoPause(Map<String, Object> map) { |
| | | log("onDPVideoPause"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoContinue(Map<String, Object> map) { |
| | | log("onDPVideoContinue"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoOver(Map<String, Object> map) { |
| | | log("onDPVideoOver"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPNewsDetailEnter(Map<String, Object> map) { |
| | | log("onDPNewsDetailEnter"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPNewsDetailExit(Map<String, Object> map) { |
| | | log("onDPNewsDetailExit"); |
| | | } |
| | | |
| | | |
| | | })); |
| | | |
| | | Fragment fragment = mIDPWidget.getFragment(); |
| | | if (fragment != null) { |
| | | getChildFragmentManager().beginTransaction().add(R.id.fl_container, fragment).commitAllowingStateLoss(); |
| | | } |
| | | } |
| | | |
| | | private static void log(String msg) { |
| | | Log.d(TAG, String.valueOf(msg)); |
| | | } |
| | | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | Log.i(TAG, "onDetach"); |
| | | } |
| | | |
| | | @Override |
| | | public void onAttach(@NonNull Context context) { |
| | | super.onAttach(context); |
| | | Log.i(TAG, "onAttach"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | if (mIDPWidget != null) { |
| | | mIDPWidget.destroy(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import android.content.pm.ApplicationInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.content.res.Configuration; |
| | | import android.database.Cursor; |
| | | import android.net.wifi.WifiInfo; |
| | | import android.net.wifi.WifiManager; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.loader.app.LoaderManager; |
| | | import androidx.loader.content.CursorLoader; |
| | | import androidx.loader.content.Loader; |
| | | |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.Log; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | import android.widget.RadioGroup.OnCheckedChangeListener; |
| | | import android.widget.Toast; |
| | | |
| | | import com.bytedance.novel.pangolin.NovelSDK; |
| | | import com.bytedance.sdk.dp.DPSdk; |
| | | import com.bytedance.sdk.dp.DPWidgetDrawParams; |
| | | import com.bytedance.sdk.dp.DPWidgetNewsParams; |
| | | import com.bytedance.sdk.dp.IDPDrawListener; |
| | | import com.bytedance.sdk.dp.IDPNewsListener; |
| | | import com.bytedance.sdk.dp.IDPWidget; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.lcjian.library.DeviceUuidFactory; |
| | | import com.lcjian.library.util.FragmentSwitchHelper; |
| | | import com.lcjian.library.util.FragmentSwitchHelperV2; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mozillaonline.providers.downloads.DownloadService; |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.entity.HomeNavType; |
| | | import com.mugua.mgvideo.entity.recommend.HomeClass; |
| | | import com.mugua.mgvideo.util.ad.FullVideoAdManager; |
| | | import com.mugua.mgvideo.util.ad.InterstitialAdUtil; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.base.utils.ad.AdTypeEnum; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.MGVideoApplication; |
| | |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | |
| | | public class MainActivity extends BaseActivity implements |
| | | LoaderManager.LoaderCallbacks<Cursor> { |
| | | |
| | | private static final String TAG = "MainActivity"; |
| | | private RadioGroup rg_nav; |
| | | |
| | | private BadgeView mBadgeView; |
| | | |
| | | private FragmentSwitchHelper mFragmentSwitchHelper; |
| | | private FragmentSwitchHelperV2 mFragmentSwitchHelper; |
| | | |
| | | private ProgressDialog pd = null; |
| | | |
| | | |
| | | private void initFragment() { |
| | | mFragmentSwitchHelper = FragmentSwitchHelperV2.create(R.id.fl_main_fragment_container, getSupportFragmentManager(), null); |
| | | HomeClass homeClass = new HomeClass(); |
| | | homeClass.setDataKey("recommend"); |
| | | homeClass.setId("1626144258979"); |
| | | homeClass.setDataType("recommend"); |
| | | |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.recommend.name(), RecommendNewFragment.newInstance(homeClass, 0)); |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.category.name(), CategoryFragment.newInstance(true)); |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.shop.name(), ShopFragment.newInstance(true)); |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.mine.name(), new MineFragment()); |
| | | |
| | | if (AdUtil.isCanInitCSJ()) { |
| | | |
| | | //小说 |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.novel.name(), new NovelFragment(getSupportFragmentManager())); |
| | | |
| | | |
| | | //小视频 |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.drawVideo.name(), new DYVideoFragment()); |
| | | |
| | | //资讯 |
| | | mFragmentSwitchHelper.addFragment(HomeNavType.news.name(), new DYNewsFragment()); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | //底部导航菜单显示 |
| | | private void setNavShow() { |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | findViewById(R.id.rb_nav_draw_video).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_watch).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_novel).setVisibility(View.GONE); |
| | | } else { |
| | | //后台控制显示菜单 |
| | | if (AdUtil.isCanInitCSJ() && AdUtil.getAdType(getApplicationContext(), AdPositionEnum.splashHotStart) != null) { |
| | | findViewById(R.id.rb_nav_draw_video).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_nav_watch).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_nav_novel).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.GONE); |
| | | } else { |
| | | findViewById(R.id.rb_nav_draw_video).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_watch).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_novel).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Runnable adCallback; |
| | | |
| | | //显示插屏广告 |
| | | private void showInterstitialAd() { |
| | | |
| | | final AdTypeEnum adType = AdUtil.getAdType(getApplicationContext(), AdPositionEnum.homeInterstitial); |
| | | if (adType == null) { |
| | | return; |
| | | } |
| | | |
| | | adCallback = new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | AdTypeEnum type = adType; |
| | | //Android 5.0以下广告兼容 |
| | | if (type == AdTypeEnum.csj && !AdUtil.isCanInitCSJ()) { |
| | | type = AdTypeEnum.gdt; |
| | | } |
| | | |
| | | if (type == AdTypeEnum.csj) { |
| | | InterstitialAdUtil.showAd(MainActivity.this, type, getString(R.string.ad_csj_pid_home_insert)); |
| | | } else { |
| | | InterstitialAdUtil.showAd(MainActivity.this, type, getString(R.string.ad_gdt_pid_home_insert)); |
| | | } |
| | | |
| | | |
| | | } |
| | | }; |
| | | //延迟三秒显示 |
| | | rg_nav.postDelayed(adCallback, 3000); |
| | | } |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | |
| | | pd.setMessage("正在请求网络..."); |
| | | pd.setCanceledOnTouchOutside(false); |
| | | |
| | | HomeClass homeClass = new HomeClass(); |
| | | homeClass.setDataKey("recommend"); |
| | | homeClass.setId("1626144258979"); |
| | | homeClass.setDataType("recommend"); |
| | | mFragmentSwitchHelper = FragmentSwitchHelper.create( |
| | | R.id.fl_main_fragment_container, getSupportFragmentManager(), |
| | | RecommendNewFragment.newInstance(homeClass, 0), BaiDuVideosFragment.newInstance(), new CategoryFragment(), |
| | | new ShopFragment(), new MineFragment()); |
| | | |
| | | initFragment(); |
| | | |
| | | rg_nav = findViewById(R.id.rg_nav); |
| | | rg_nav.setOnCheckedChangeListener(new OnCheckedChangeListener() { |
| | | |
| | |
| | | switch (checkedId) { |
| | | case R.id.rb_nav_recommend: { |
| | | mFragmentSwitchHelper |
| | | .changeFragment(RecommendNewFragment.class); |
| | | .changeFragment(HomeNavType.recommend.name()); |
| | | } |
| | | break; |
| | | case R.id.rb_nav_short_video: |
| | | case R.id.rb_nav_draw_video: { |
| | | mFragmentSwitchHelper |
| | | .changeFragment(BaiDuVideosFragment.class); |
| | | .changeFragment(HomeNavType.drawVideo.name()); |
| | | } |
| | | break; |
| | | case R.id.rb_nav_category: { |
| | | mFragmentSwitchHelper |
| | | .changeFragment(CategoryFragment.class); |
| | | .changeFragment(HomeNavType.category.name()); |
| | | } |
| | | break; |
| | | |
| | | case R.id.rb_nav_novel: { |
| | | mFragmentSwitchHelper |
| | | .changeFragment(HomeNavType.novel.name()); |
| | | } |
| | | break; |
| | | |
| | | case R.id.rb_nav_watch: { |
| | | mFragmentSwitchHelper |
| | | .changeFragment(HomeNavType.news.name()); |
| | | } |
| | | break; |
| | | case R.id.rb_shop: { |
| | | mFragmentSwitchHelper.changeFragment(ShopFragment.class); |
| | | mFragmentSwitchHelper.changeFragment(HomeNavType.shop.name()); |
| | | } |
| | | break; |
| | | case R.id.rb_nav_mine: { |
| | | mFragmentSwitchHelper.changeFragment(MineFragment.class); |
| | | mFragmentSwitchHelper.changeFragment(HomeNavType.mine.name()); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | }); |
| | | mBadgeView = new BadgeView(this, rg_nav); |
| | | mBadgeView.setBackgroundResource(R.drawable.ic_red_dot); |
| | | mBadgeView.setBackgroundResource(R.drawable.app_icon); |
| | | mBadgeView.setTextSize(1); |
| | | mBadgeView.setText(""); |
| | | mBadgeView.setBadgeMargin(DimenUtils.dipToPixels(24, this), |
| | |
| | | AppUpdate.setAppUpdateKey(map.get("GuanWang")); |
| | | } |
| | | AppUpdate.initAppUpdate(); |
| | | |
| | | showInterstitialAd(); |
| | | } |
| | | |
| | | private String getChannelName() { |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | setNavShow(); |
| | | EventBus.getDefault().register(this); |
| | | SharedPreferences preferences = getSharedPreferences("user", |
| | | Context.MODE_PRIVATE); |
| | |
| | | if (isLogin) { |
| | | getNewInfo(); |
| | | } |
| | | |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | findViewById(R.id.rb_nav_short_video).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.GONE); |
| | | } else { |
| | | findViewById(R.id.rb_nav_short_video).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | super.onPause(); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onActivityResult(int arg0, int arg1, Intent arg2) { |
| | |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | AppUpdate.destoryAppUpdate(); |
| | | if (rg_nav != null && adCallback != null) { |
| | | rg_nav.removeCallbacks(adCallback); |
| | | } |
| | | } |
| | | |
| | | private long mExitTime; |
| | | |
| | | boolean showFullAd = false; |
| | | |
| | | @Override |
| | | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| | |
| | | // mExitTime = System.currentTimeMillis(); |
| | | // return true; |
| | | // } |
| | | //exit |
| | | AdTypeEnum adType = AdUtil.getAdType(getApplicationContext(), AdPositionEnum.exitAppFullvideo); |
| | | if (adType != null) { |
| | | |
| | | if (showFullAd) { |
| | | finish(); |
| | | return true; |
| | | } |
| | | |
| | | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) { |
| | | adType = AdTypeEnum.gdt; |
| | | } |
| | | |
| | | |
| | | if (adType == AdTypeEnum.csj) { |
| | | FullVideoAdManager.getInstance().loadAd(MainActivity.this, AdTypeEnum.csj,getString(R.string.ad_csj_pid_video_detail_fullvideo), new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onFail(String msg) { |
| | | showFullAd = true; |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(getApplicationContext(), "再按一次退出应用", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | showFullAd = true; |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | MainActivity.this.finish(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | } else { |
| | | FullVideoAdManager.getInstance().loadAd(MainActivity.this, AdTypeEnum.gdt, getString(R.string.ad_gdt_pid_video_detail_insert), new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onFail(String msg) { |
| | | showFullAd = true; |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Toast.makeText(getApplicationContext(), "再按一次退出应用", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | showFullAd = true; |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | MainActivity.this.finish(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | } else { |
| | | ExitDialog dialog = new ExitDialog.Builder(this).create(); |
| | | dialog.setCanceledOnTouchOutside(true); |
| | | dialog.show(); |
| | | } |
| | | return true; |
| | | } |
| | | return super.onKeyDown(keyCode, event); |
| | |
| | | Intent intent = new Intent(MainActivity.this, DownloadService.class); |
| | | startService(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onConfigurationChanged(Configuration newConfig) { |
| | | super.onConfigurationChanged(newConfig); |
| | | Log.i(TAG,"onConfigurationChanged"); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | 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.RetainViewFragment; |
| | | import com.lcjian.library.content.ConnectivityChangeHelper; |
| | |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.ui.mine.SuggestionActivity; |
| | | import com.mugua.mgvideo.util.ConfigUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.umeng.socialize.ShareAction; |
| | | import com.umeng.socialize.UMShareListener; |
| | | import com.umeng.socialize.bean.SHARE_MEDIA; |
| | | import com.umeng.socialize.media.UMWeb; |
| | | import com.yeshi.base.ui.LoginActivity; |
| | | import com.yeshi.base.ui.PersonInfoActivity; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<Banner> banners = gson.fromJson(jsonObject |
| | | |
| | | List<Banner> banners = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<Banner>>() { |
| | | }.getType()); |
New file |
| | |
| | | package com.mugua.mgvideo.ui.main; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | |
| | | import com.bytedance.novel.pangolin.NovelSDK; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.mugua.mgvideo.R; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.fragment.app.FragmentManager; |
| | | |
| | | /** |
| | | * 小说 |
| | | */ |
| | | public class NovelFragment extends RetainViewFragment implements |
| | | OnClickListener { |
| | | private static final String TAG = "NovelFragment"; |
| | | private FragmentManager fragmentManager; |
| | | |
| | | public NovelFragment() { |
| | | super(); |
| | | } |
| | | |
| | | public NovelFragment(FragmentManager fragmentManager) { |
| | | super(); |
| | | this.fragmentManager = fragmentManager; |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | Log.i(TAG,"onCreate"); |
| | | } |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | | return R.layout.fragment_common; |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | Log.i(TAG,"onCreateView"); |
| | | getChildFragmentManager().beginTransaction().replace(R.id.fl_container, NovelSDK.INSTANCE.getNovelFragment(), "novel").commitAllowingStateLoss(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG,"onResume"); |
| | | NovelSDK.INSTANCE.getNovelFragment().onResume(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | Log.i(TAG,"onPause"); |
| | | NovelSDK.INSTANCE.getNovelFragment().onPause(); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | Log.i(TAG,"onDestroy"); |
| | | NovelSDK.INSTANCE.getNovelFragment().onDestroy(); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onDetach() { |
| | | super.onDetach(); |
| | | Log.i(TAG,"onDetach"); |
| | | } |
| | | |
| | | @Override |
| | | public void onAttach(@NonNull Context context) { |
| | | super.onAttach(context); |
| | | Log.i(TAG,"onAttach"); |
| | | } |
| | | |
| | | @Override |
| | | public void onHiddenChanged(boolean hidden) { |
| | | super.onHiddenChanged(hidden); |
| | | Log.i(TAG,"onHiddenChanged:"+hidden); |
| | | } |
| | | } |
| | |
| | | import com.mugua.mgvideo.entity.recommend.HomeClass; |
| | | import com.mugua.mgvideo.test.MyViewPager; |
| | | import com.mugua.mgvideo.ui.category.bean.HotStar; |
| | | import com.mugua.mgvideo.ui.common.CommonFragmentActivity; |
| | | import com.mugua.mgvideo.ui.recommend.RecommendNewAdapter; |
| | | import com.mugua.mgvideo.ui.recommend.RecommendTopAdapter; |
| | | import com.mugua.mgvideo.ui.recommend.SearchActivity; |
| | | import com.mugua.mgvideo.util.DimenUtils; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.viewpagerindicator.LinePageIndicator; |
| | | import com.yeshi.base.entity.JumpDetail; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.base.utils.ui.DividerItemDecoration; |
| | | import com.yeshi.video.ui.VideoDetailActivity; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | |
| | | |
| | | private TextView tv_go_search; |
| | | |
| | | private TextView tv_shop; |
| | | |
| | | private TextView tv_category; |
| | | |
| | | private SwipeRefreshLayout.OnRefreshListener mRefreshListener = new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | //加载广告 |
| | | if (mRecommendNewAdapter != null) { |
| | | mRecommendNewAdapter.refresh(); |
| | | } |
| | | loadAd(); |
| | | getHomeAd(); |
| | | Log.i("mResult", "onCreate---setOnRefreshListener---loadAD1"); |
| | |
| | | return; |
| | | if (mRecommendNewAdapter.getAdCount() == 0) { |
| | | if (adList != null && adList.size() > 0) { |
| | | mRecommendNewAdapter.addAdToPosition(adList.get(0), 2); |
| | | mRecommendNewAdapter.addAdToPosition(adList.get(0), 0); |
| | | } |
| | | mRecommendNewAdapter.notifyDataSetChanged(); |
| | | } |
| | |
| | | .findViewById(R.id.rv_recommend); |
| | | |
| | | rv_recommend.setLayoutManager(new LinearLayoutManager(context)); |
| | | DividerItemDecoration decoration = new DividerItemDecoration(); |
| | | decoration.setSize(DimenUtils.dip2px(rv_recommend.getContext(), 0)); |
| | | rv_recommend.addItemDecoration(decoration); |
| | | // DividerItemDecoration decoration = new DividerItemDecoration(); |
| | | // decoration.setSize(DimenUtils.dip2px(rv_recommend.getContext(), 0)); |
| | | // rv_recommend.addItemDecoration(decoration); |
| | | |
| | | loading = LayoutInflater.from(getContext()).inflate(R.layout.item_loading, null); |
| | | loading.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); |
| | |
| | | iv_right_ad_close = contentView.findViewById(R.id.iv_right_ad_close); |
| | | ll_right_ad = contentView.findViewById(R.id.ll_right_ad); |
| | | |
| | | tv_shop = contentView.findViewById(R.id.tv_shop); |
| | | tv_category = contentView.findViewById(R.id.tv_category); |
| | | |
| | | tv_shop.setOnClickListener(this); |
| | | tv_category.setOnClickListener(this); |
| | | |
| | | type = (HomeClass) getArguments().getSerializable("videotype"); |
| | | position = (Integer) getArguments().get("position"); |
| | | |
| | |
| | | if (recommendAdManager.getSourceType() == AdUtil.AD_TYPE.csj) { |
| | | pid = CSJConstant.RECOMMEND_BIG_IMG_AD; |
| | | height = (int) (width * 0.78); |
| | | } else if (recommendAdManager.getSourceType() == AdUtil.AD_TYPE.gdt2) { |
| | | } else if (recommendAdManager.getSourceType() == AdUtil.AD_TYPE.gdt) { |
| | | pid = GDTConstant.PID_HOME_RECOMMEND_BIG_IMG; |
| | | } |
| | | |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getHomeType") + type.getId()); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | List<HomeType> homeTypes = gson.fromJson( |
| | | |
| | | List<HomeType> homeTypes = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<HomeType>>() { |
| | | }.getType()); |
| | |
| | | needRefresh = true; |
| | | } |
| | | |
| | | private void setNavShow() { |
| | | if (YouthUtil.isOpenYouthMode(getActivity())) { |
| | | tv_category.setVisibility(View.GONE); |
| | | tv_shop.setVisibility(View.GONE); |
| | | } else { |
| | | if (AdUtil.isCanInitCSJ() && AdUtil.getAdType(getContext(), AdPositionEnum.splashHotStart) != null) { |
| | | tv_category.setVisibility(View.VISIBLE); |
| | | tv_shop.setVisibility(View.VISIBLE); |
| | | } else { |
| | | tv_category.setVisibility(View.GONE); |
| | | tv_shop.setVisibility(View.GONE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | indicator_recommend.setViewPager(vp_recommend); |
| | | mChangeHelper.registerReceiver(); |
| | | if (YouthUtil.isOpenYouthMode(getContext())) { |
| | | tv_go_search.setVisibility(View.GONE); |
| | | } else { |
| | | tv_go_search.setVisibility(View.VISIBLE); |
| | | } |
| | | if (needRefresh) { |
| | | needRefresh = false; |
| | | rl_recommend.setRefreshing(true); |
| | | mRefreshListener.onRefresh(); |
| | | } |
| | | setNavShow(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .setPrettyPrinting() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .excludeFieldsWithoutExposeAnnotation() |
| | | .create(); |
| | | JSONObject data = jsonObject |
| | | .getJSONObject("Data"); |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setVersion(1.0).setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HomeType> homeTypes = new ArrayList<HomeType>(); |
| | | JSONArray array = jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data"); |
| | |
| | | |
| | | |
| | | if (obj.optJSONObject("Ad") != null) |
| | | type.setAd(gson.fromJson(obj.optJSONObject("Ad").toString(), HomeType.HomeTypeAd.class)); |
| | | type.setAd(JsonUtil.videoGson.fromJson(obj.optJSONObject("Ad").toString(), HomeType.HomeTypeAd.class)); |
| | | |
| | | JSONArray homeArray = obj |
| | | .optJSONArray("HomeVideoList"); |
| | |
| | | if (homeArray != null && homeArray.length() > 0) { |
| | | for (int j = 0; j < homeArray.length(); j++) { |
| | | |
| | | homeList.add(gson.fromJson(homeArray |
| | | homeList.add(JsonUtil.videoGson.fromJson(homeArray |
| | | .optJSONObject(j).toString(), |
| | | HomeVideo.class)); |
| | | } |
| | |
| | | if (itemArray != null && itemArray.length() > 0) { |
| | | for (int k = 0; k < itemArray.length(); k++) { |
| | | if (itemArray.optJSONObject(k) != null) { |
| | | itemList.add(gson.fromJson( |
| | | itemList.add(JsonUtil.videoGson.fromJson( |
| | | itemArray.optJSONObject(k) |
| | | .toString(), |
| | | HomeTypeItem.class)); |
| | |
| | | startActivity(intent); |
| | | } |
| | | break; |
| | | |
| | | case R.id.tv_shop: { |
| | | Intent intent = new Intent(getContext(), CommonFragmentActivity.class); |
| | | intent.putExtra("title", "集市"); |
| | | intent.putExtra("fragment", ShopFragment.class.getName()); |
| | | startActivity(intent); |
| | | } |
| | | break; |
| | | |
| | | case R.id.tv_category: { |
| | | Intent intent = new Intent(getContext(), CommonFragmentActivity.class); |
| | | intent.putExtra("title", "分类"); |
| | | intent.putExtra("fragment", CategoryFragment.class.getName()); |
| | | startActivity(intent); |
| | | } |
| | | break; |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |
| | |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | EventBus.getDefault().unregister(this); |
| | | if (mRecommendNewAdapter != null) { |
| | | mRecommendNewAdapter.onDestory(); |
| | | } |
| | | } |
| | | |
| | | private List<HomeVideo> adList1 = new ArrayList<>(); |
| | |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | |
| | | private GoodsAdapter adapter; |
| | | private List<GoodsInfo> mList = new ArrayList<>(); |
| | | |
| | | public static ShopFragment newInstance(boolean nav) { |
| | | ShopFragment fragment = new ShopFragment(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putBoolean("nav", nav); |
| | | fragment.setArguments(bundle); |
| | | return fragment; |
| | | } |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | |
| | | if (getArguments() != null && getArguments().getBoolean("nav", false)) { |
| | | contentView.findViewById(R.id.rl_nav).setVisibility(View.VISIBLE); |
| | | } else { |
| | | contentView.findViewById(R.id.rl_nav).setVisibility(View.GONE); |
| | | } |
| | | |
| | | tv_no_network = (TextView) contentView.findViewById(R.id.tv_no_network); |
| | | tv_top_left = (TextView) contentView.findViewById(R.id.tv_top_bar_left); |
| | | tv_top_left.setVisibility(View.GONE); |
| | |
| | | import com.lcjian.library.util.RefreshLayout; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.entity.GoodsFavourite; |
| | |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | 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.RefreshLayout; |
| | | import com.lcjian.library.util.common.DateUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.mugua.mgvideo.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.db.MessageTable; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.optBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<CommentReply> comments = gson.fromJson( |
| | | List<CommentReply> comments = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<CommentReply>>() { |
| | |
| | | |
| | | 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.ConnectionUtils; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.mozillaonline.providers.downloads.Downloads; |
| | | import com.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | |
| | | } else { |
| | | String videoInfoStr = cursor.getString(cursor |
| | | .getColumnIndexOrThrow(DownloadTable.VIDEO_DETAIL)); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | videoInfo = gson.fromJson(videoInfoStr, |
| | | videoInfo = JsonUtil.videoGson.fromJson(videoInfoStr, |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | if (videoInfo != null) { |
| | |
| | | |
| | | 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.ConnectionUtils; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | 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.mugua.mgvideo.db.DownloadTable; |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.video.ui.VideoDetailActivity; |
| | |
| | | } else { |
| | | String videoInfoStr = cursor.getString(cursor |
| | | .getColumnIndexOrThrow(DownloadTable.VIDEO_DETAIL)); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | videoInfo = gson.fromJson(videoInfoStr, |
| | | videoInfo = JsonUtil.videoGson.fromJson(videoInfoStr, |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | if (videoInfo != null) { |
| | |
| | | |
| | | 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.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.db.DownloadTable; |
| | | import com.mugua.mgvideo.db.WatchHistoryTable; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.video.ui.VideoDetailActivity; |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | |
| | | 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>() { |
| | | videoInfo = JsonUtil.videoGson.fromJson(videoInfoStr, new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | mVideoInfos.put(videoId, videoInfo); |
| | | if (viewHolder.tv_title.getTag().equals(videoId)) { |
| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.lcjian.library.util.MarketUtils; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.lcjian.library.widget.MyListView; |
| | |
| | | import com.mugua.mgvideo.MGVideoApplication; |
| | | import com.mugua.mgvideo.entity.HomeType; |
| | | import com.mugua.mgvideo.entity.HomeVideo; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.entity.video.VideoType; |
| | | import com.mugua.mgvideo.service.DownLoadFileService; |
| | |
| | | import com.mugua.mgvideo.ui.category.bean.HotStar; |
| | | import com.mugua.mgvideo.ui.common.VideosLiveActivity; |
| | | import com.yeshi.video.ui.VideoDetailActivity; |
| | | import com.mugua.mgvideo.util.AdPromptDialog; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.mugua.mgvideo.util.GlideCircleTransform; |
| | | import com.yeshi.base.utils.downutil.ApkUtil; |
| | | |
| | |
| | | "com.mugua.mgvideo.ui.common.MVideosActivity")) {// 去好评 |
| | | mateAppMarket(intent, mHomeType); |
| | | } else { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoType type = gson.fromJson( |
| | | |
| | | VideoType type = JsonUtil.videoGson.fromJson( |
| | | mHomeType.getParams().replace( |
| | | "\\" + "\"", "\""), |
| | | VideoType.class); |
| | |
| | | package com.mugua.mgvideo.ui.recommend; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.graphics.Color; |
| | | import android.graphics.Typeface; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.bumptech.glide.request.target.DrawableImageViewTarget; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.bytedance.sdk.dp.DPArticleLevel; |
| | | import com.bytedance.sdk.dp.DPComponentPosition; |
| | | import com.bytedance.sdk.dp.DPSdk; |
| | | import com.bytedance.sdk.dp.DPWidgetTextChainParams; |
| | | import com.bytedance.sdk.dp.DPWidgetVideoCardParams; |
| | | import com.bytedance.sdk.dp.IDPElement; |
| | | import com.bytedance.sdk.dp.IDPVideoCardListener; |
| | | import com.bytedance.sdk.dp.IDPWidgetFactory; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.library.widget.RatioLayout; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | |
| | | import com.mugua.mgvideo.ui.category.StarsActivity; |
| | | import com.mugua.mgvideo.ui.common.VideosLiveActivity; |
| | | import com.mugua.mgvideo.ui.video.VideoRecommendAdapter; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.entity.ad.ExpressAdContainer; |
| | | import com.yeshi.base.entity.video.VideoType; |
| | | import com.yeshi.base.utils.JumpActivityUtil; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.ExpressAdManager; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.ysh.wpc.appupdate.util.StringUtils; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.TreeSet; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; |
| | |
| | | public final int TYPE_HEADER = 10001; |
| | | public final int TYPE_FOOTER = 10002; |
| | | |
| | | private Gson gson = new GsonBuilder().setVersion(1.0).setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | |
| | | private View headerView; |
| | | private View footerView; |
| | | |
| | | private FrameLayout mNewsLinkLayout; |
| | | private IDPElement mTextChainElement; |
| | | |
| | | private FrameLayout mVideoCardLayout; |
| | | private TextView mVideoCardTitle; |
| | | private IDPElement mVideoCardElement; |
| | | |
| | | public void setHeaderView(View view) { |
| | | this.headerView = view; |
| | |
| | | case TYPE_FOOTER: |
| | | return new FooterViewHolder(footerView); |
| | | case RecommendContent.TYPE_HOMETYPE: |
| | | return new HomeTypeHolder(inflater.inflate(R.layout.item_recommend_home_type, null, false), new RecyclerView.RecycledViewPool()); |
| | | return new HomeTypeHolder(inflater.inflate(R.layout.item_recommend_home_type, parent, false), new RecyclerView.RecycledViewPool()); |
| | | case RecommendContent.TYPE_AD: |
| | | return new AdHolder(inflater.inflate(R.layout.item_recommend_home_type_ad, parent, false)); |
| | | |
| | | case RecommendContent.TYPE_NEWS: |
| | | //加载文字链 |
| | | loadTextChainWidget(); |
| | | return new NewsHolder(inflater.inflate(R.layout.item_recommend_news, parent, false)); |
| | | |
| | | case RecommendContent.TYPE_DRAW_VIDEOS: |
| | | // 加载 video card 组件 |
| | | loadVideoCard(); |
| | | return new DrawVideosHolder(inflater.inflate(R.layout.item_recommend_draw_video, parent, false)); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | private int recyclerViewWidth = -1; |
| | | |
| | | @Override |
| | | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { |
| | | public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, @SuppressLint("RecyclerView") int i) { |
| | | if (viewHolder instanceof HeaderViewHolder) |
| | | return; |
| | | if (viewHolder instanceof FooterViewHolder) |
| | |
| | | int p = i; |
| | | if (headerView != null) |
| | | p--; |
| | | |
| | | |
| | | p -= (AdUtil.isCanInitCSJ() ? 2 : 0); |
| | | if (viewHolder instanceof HomeTypeHolder) { |
| | | final HomeType homeType = (HomeType) contentList.get(p); |
| | | |
| | | |
| | | final HomeTypeHolder holder = (HomeTypeHolder) viewHolder; |
| | | |
| | | if (homeType == null) { |
| | | if (homeType == null || homeType.getHomeVideoList().size() == 0) { |
| | | holder.view.setVisibility(View.GONE); |
| | | return; |
| | | } |
| | | holder.view.setVisibility(View.VISIBLE); |
| | | |
| | | |
| | | if (homeType.getVideoInfoList() == null) { |
| | | homeType.setVideoInfoList(new ArrayList<>()); |
| | | } |
| | |
| | | List<HomeVideo> homeList = new ArrayList<>(); |
| | | if (homeArray != null && homeArray.length() > 0) { |
| | | for (int j = 0; j < homeArray.length(); j++) { |
| | | homeList.add(gson.fromJson(homeArray |
| | | homeList.add(JsonUtil.videoGson.fromJson(homeArray |
| | | .optJSONObject(j).toString(), |
| | | HomeVideo.class)); |
| | | } |
| | |
| | | intent = new Intent(v.getContext(), StarsActivity.class); |
| | | v.getContext().startActivity(intent); |
| | | } else { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoType type = gson.fromJson(homeType.getParams().replace( |
| | | |
| | | VideoType type = JsonUtil.videoGson.fromJson(homeType.getParams().replace( |
| | | "\\" + "\"", "\""), VideoType.class); |
| | | try { |
| | | intent = new Intent(v.getContext(), Class.forName(homeType.getActivity())); |
| | |
| | | } else { |
| | | holder.ll_container.setVisibility(View.GONE); |
| | | } |
| | | } else if (viewHolder instanceof NewsHolder) { |
| | | final NewsHolder holder = (NewsHolder) viewHolder; |
| | | mNewsLinkLayout = holder.fl_container; |
| | | |
| | | } else if (viewHolder instanceof DrawVideosHolder) { |
| | | final DrawVideosHolder holder = (DrawVideosHolder) viewHolder; |
| | | mVideoCardLayout = holder.fl_container; |
| | | mVideoCardTitle = holder.tv_video_card_title; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 文字链组件 |
| | | */ |
| | | private void loadTextChainWidget() { |
| | | if (!AdUtil.isCanInitCSJ()) { |
| | | return; |
| | | } |
| | | DPSdk.factory().loadTextChain(DPWidgetTextChainParams.obtain() |
| | | .articleLevel(DPArticleLevel.LEVEL_2) // 内容等级 |
| | | .componentPosition(DPComponentPosition.TAB2) |
| | | .animationDuration(1000) // 动画时长 |
| | | .backgroundColor(0xFFFFFFFF) // 背景颜色 |
| | | // .iconDrawable(getResources().getDrawable(R.drawable.ic_launcher)) // icon标志 |
| | | .iconHeight(16) // icon高度 |
| | | .iconWidth(16) // icon宽度 |
| | | .showDuration(3000) // 停留时长 |
| | | .showIcon(true) // 是否展示icon |
| | | .showWatch(true) // 是否展示观看信息 |
| | | .titleTextColor(0xFF595959) // 标题文字颜色 |
| | | .titleTextSize(14) // 标题文字大小 |
| | | .titleTypeface(Typeface.DEFAULT) // 标题文字字体 |
| | | .watchTextColor(0xFFA0A0A0) // 观看文字颜色 |
| | | .watchTextSize(12) // 观看文字大小 |
| | | .watchTypeface(Typeface.DEFAULT), new IDPWidgetFactory.Callback() { |
| | | |
| | | @Override |
| | | public void onError(int i, String s) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccess(IDPElement data) { |
| | | if (data == null) { |
| | | return; |
| | | } |
| | | mTextChainElement = data; |
| | | |
| | | View view = mTextChainElement.getView(); |
| | | if (view != null && mNewsLinkLayout != null) { |
| | | mNewsLinkLayout.removeAllViews(); |
| | | mNewsLinkLayout.addView(view); |
| | | mTextChainElement.reportShow(); |
| | | notifyDataSetChanged(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void loadVideoCard() { |
| | | |
| | | if (!AdUtil.isCanInitCSJ()) { |
| | | return; |
| | | } |
| | | |
| | | DPWidgetVideoCardParams params = DPWidgetVideoCardParams.obtain() |
| | | .hideTitle(true) |
| | | .listener(new IDPVideoCardListener() { |
| | | @Override |
| | | public void onDPItemClick(Map<String, Object> map) { |
| | | log("onDPItemClick map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPLSwipeEnter() { |
| | | log("onDPLSwipeEnter"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPRequestStart(@Nullable Map<String, Object> map) { |
| | | log("onDPRequestStart"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPRequestSuccess(List<Map<String, Object>> list) { |
| | | if (list == null) { |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | log("onDPRequestSuccess i = " + i + ", map = " + list.get(i).toString()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onDPRequestFail(int code, String msg, @Nullable Map<String, Object> map) { |
| | | if (map == null) { |
| | | log("onDPRequestFail code = " + code + ", msg = " + msg); |
| | | return; |
| | | } |
| | | log("onDPRequestFail code = " + code + ", msg = " + msg + ", map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPClientShow(@Nullable Map<String, Object> map) { |
| | | log("onDPClientShow"); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPClickAuthorName(Map<String, Object> map) { |
| | | log("onDPClickAuthorName map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPClickAvatar(Map<String, Object> map) { |
| | | log("onDPClickAvatar map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPClickComment(Map<String, Object> map) { |
| | | log("onDPClickComment map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPClickLike(boolean isLike, Map<String, Object> map) { |
| | | log("onDPClickLike isLike = " + isLike + ", map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoPlay(Map<String, Object> map) { |
| | | log("onDPVideoPlay map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoPause(Map<String, Object> map) { |
| | | log("onDPVideoPause map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoContinue(Map<String, Object> map) { |
| | | log("onDPVideoContinue map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoOver(Map<String, Object> map) { |
| | | log("onDPVideoOver map = " + map.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public void onDPVideoCompletion(Map<String, Object> map) { |
| | | log("onDPVideoCompletion map = " + map.toString()); |
| | | } |
| | | }) |
| | | .dislikeListener(mContext, new DPWidgetVideoCardParams.IDislikeListener() { |
| | | @Override |
| | | public void onSelected(String msg) { |
| | | // 如果 hideTitle 为 true,可以不做任何处理 |
| | | log("dislike msg = " + msg); |
| | | if (mVideoCardLayout == null) { |
| | | return; |
| | | } |
| | | mVideoCardLayout.removeAllViews(); |
| | | mVideoCardLayout.setVisibility(View.GONE); |
| | | mVideoCardTitle.setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | |
| | | DPSdk.factory().loadSmallVideoCard(params, new IDPWidgetFactory.Callback() { |
| | | @Override |
| | | public void onError(int code, String msg) { |
| | | log("onError code = " + code + ", msg = " + msg); |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccess(IDPElement data) { |
| | | mVideoCardElement = data; |
| | | View view = data.getView(); |
| | | if (view == null || mVideoCardLayout == null) { |
| | | return; |
| | | } |
| | | |
| | | mVideoCardLayout.removeAllViews(); |
| | | ViewGroup viewGroup = (ViewGroup) view.getParent(); |
| | | if (viewGroup != null) { |
| | | viewGroup.removeAllViews(); |
| | | } |
| | | mVideoCardLayout.addView(view); |
| | | mVideoCardElement.reportShow(); |
| | | mVideoCardTitle.setVisibility(View.VISIBLE); |
| | | notifyDataSetChanged(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private static void log(String msg) { |
| | | Log.d(TAG, String.valueOf(msg)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getItemCount() { |
| | |
| | | count++; |
| | | if (footerView != null) |
| | | count++; |
| | | if (AdUtil.isCanInitCSJ()) { |
| | | count += 2; |
| | | } |
| | | return count; |
| | | } |
| | | |
| | |
| | | if (headerView != null) |
| | | position--; |
| | | |
| | | if (position >= contentList.size()) |
| | | if (position >= contentList.size() + (AdUtil.isCanInitCSJ() ? 2 : 0)) |
| | | return TYPE_FOOTER; |
| | | if (AdUtil.isCanInitCSJ()) { |
| | | if (position == 0) { |
| | | return RecommendContent.TYPE_NEWS; |
| | | } else if (position == 1) { |
| | | return RecommendContent.TYPE_DRAW_VIDEOS; |
| | | } |
| | | } |
| | | |
| | | if (contentList.get(position) instanceof HomeType) |
| | | position -= (AdUtil.isCanInitCSJ() ? 2 : 0); |
| | | if (contentList.get(position) instanceof HomeType) { |
| | | return RecommendContent.TYPE_HOMETYPE; |
| | | else |
| | | } else { |
| | | return RecommendContent.TYPE_AD; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | class NewsHolder extends RecyclerView.ViewHolder { |
| | | |
| | | FrameLayout fl_container; |
| | | |
| | | |
| | | public NewsHolder(View view) { |
| | | super(view); |
| | | |
| | | fl_container = view.findViewById(R.id.fl_container); |
| | | } |
| | | } |
| | | |
| | | class DrawVideosHolder extends RecyclerView.ViewHolder { |
| | | |
| | | FrameLayout fl_container; |
| | | TextView tv_video_card_title; |
| | | |
| | | public DrawVideosHolder(View view) { |
| | | super(view); |
| | | tv_video_card_title = view.findViewById(R.id.tv_video_card_title); |
| | | fl_container = view.findViewById(R.id.fl_container); |
| | | |
| | | } |
| | | } |
| | | |
| | | public void onDestory() { |
| | | if (mTextChainElement != null) { |
| | | mTextChainElement.destroy(); |
| | | } |
| | | |
| | | if (mVideoCardElement != null) { |
| | | mVideoCardElement.destroy(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public void refresh() { |
| | | loadVideoCard(); |
| | | loadTextChainWidget(); |
| | | } |
| | | } |
| | |
| | | import android.widget.GridView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.alibaba.android.arouter.facade.Postcard; |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | 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.mugua.mgvideo.R; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | |
| | | import com.mugua.mgvideo.ui.common.GridVideoAdapter1; |
| | | import com.yeshi.ec.search.ui.SearchResultActivity; |
| | | import com.yeshi.video.ui.VideoDetailActivity; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | ImageView iv_picture = v.findViewById(R.id.iv_picture); |
| | | NativeAdContainer nv = v.findViewById(R.id.native_ad_container); |
| | | GDTNativeADUnifiedManager.renderSinglePicture(iv_picture, holder.tv_movie_title, nv, ad.getGdt2Unfied()); |
| | | v.findViewById(R.id.tv_close).setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | contentList.remove(content); |
| | | notifyDataSetChanged(); |
| | | } |
| | | }); |
| | | |
| | | holder.fl_container.removeAllViews(); |
| | | |
| | | |
| | | holder.fl_container.addView(v); |
| | | } |
| | | } |
| | |
| | | package com.mugua.mgvideo.util.ad; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | import android.util.Log; |
| | | |
| | | import com.bytedance.sdk.openadsdk.AdSlot; |
| | | import com.bytedance.sdk.openadsdk.TTAdConstant; |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.mugua.mgvideo.util.DimenUtils; |
| | | import com.yeshi.base.utils.ad.CSJConstant; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.interstitial2.UnifiedInterstitialAD; |
| | | import com.qq.e.ads.interstitial2.UnifiedInterstitialADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.yeshi.base.utils.ad.AdTypeEnum; |
| | | import com.yeshi.base.utils.ad.TTAdManagerHolder; |
| | | |
| | | public class FullVideoAdManager { |
| | |
| | | return fullVideoAdManager; |
| | | } |
| | | |
| | | public void loadAd(final Context context, final IFullVideoAdListener adListener) { |
| | | int w = DimenUtils.getScreenWidth(context); |
| | | int h = DimenUtils.getScreenHeight(context); |
| | | public void loadAd(final Activity context, AdTypeEnum adType, String pid, final IFullVideoAdListener adListener) { |
| | | |
| | | if (adType == AdTypeEnum.csj) { |
| | | showCSJ(context, pid, adListener); |
| | | }else{ |
| | | showGdt(context,pid,adListener); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private void showCSJ(Activity activity, String pid, final IFullVideoAdListener adListener) { |
| | | int w = DimenUtils.getScreenWidth(activity); |
| | | int h = DimenUtils.getScreenHeight(activity); |
| | | |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(CSJConstant.CODE_FULL_VIDEO_VIDEO_DETAIL) |
| | | .setCodeId(pid) |
| | | .setSupportDeepLink(true) |
| | | .setExpressViewAcceptedSize(w, h) |
| | | .setOrientation(TTAdConstant.VERTICAL) |
| | |
| | | return; |
| | | } |
| | | |
| | | mTTAdNative = ttAdManager.createAdNative(context); |
| | | |
| | | mTTAdNative = ttAdManager.createAdNative(activity); |
| | | //加载全屏视频 |
| | | mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() { |
| | | @Override |
| | | public void onError(int code, String message) { |
| | | adListener.onFail(message); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onAdClose() { |
| | | adListener.onFinish(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | }); |
| | | |
| | | if (ad != null && adListener != null) |
| | | adListener.onSuccess(ad); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | mttFullVideoAd = ttFullScreenVideoAd; |
| | | ttFullScreenVideoAd.showFullScreenVideoAd(activity); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 展示广告 |
| | | * |
| | | * @param activity |
| | | */ |
| | | public void showAd(Activity activity) { |
| | | if (mttFullVideoAd != null) { |
| | | mttFullVideoAd.showFullScreenVideoAd(activity); |
| | | mttFullVideoAd = null; |
| | | } |
| | | private UnifiedInterstitialAD iad; |
| | | |
| | | |
| | | private void showGdt(Activity activity, String pid,IFullVideoAdListener adListener) { |
| | | |
| | | iad = new UnifiedInterstitialAD(activity, pid, new UnifiedInterstitialADListener() { |
| | | |
| | | @Override |
| | | public void onADReceive() { |
| | | iad.showFullScreenAD(activity); |
| | | } |
| | | |
| | | /** |
| | | * 是否已经缓存了广告 |
| | | * |
| | | * @return |
| | | */ |
| | | public boolean isCacahed() { |
| | | return mttFullVideoAd != null; |
| | | @Override |
| | | public void onVideoCached() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | |
| | | Log.i("gdt", adError.toString()); |
| | | adListener.onFail("no ad"); |
| | | } |
| | | |
| | | @Override |
| | | public void onADOpened() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADExposure() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClicked() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADLeftApplication() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClosed() { |
| | | adListener.onFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | |
| | | } |
| | | }); |
| | | VideoOption.Builder builder = new VideoOption.Builder(); |
| | | VideoOption |
| | | option = builder.setAutoPlayMuted(true) |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI).build(); |
| | | iad.setVideoOption(option); |
| | | iad.loadFullScreenAD(); |
| | | } |
| | | |
| | | |
| | | public interface IFullVideoAdListener { |
| | | public void onSuccess(TTFullScreenVideoAd ad); |
| | | void onFail(String msg); |
| | | void onFinish(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mugua.mgvideo.util.ad; |
| | | |
| | | |
| | | import android.app.Activity; |
| | | |
| | | 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.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.interstitial2.UnifiedInterstitialAD; |
| | | import com.qq.e.ads.interstitial2.UnifiedInterstitialADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.yeshi.base.utils.ad.AdTypeEnum; |
| | | |
| | | public class InterstitialAdUtil { |
| | | |
| | | |
| | | public static void showAd(Activity context, AdTypeEnum adType, String pid) { |
| | | if (adType == null) { |
| | | return; |
| | | } |
| | | |
| | | if (adType == AdTypeEnum.csj) { |
| | | loadCSJ(context, pid); |
| | | } else if (adType == AdTypeEnum.gdt) { |
| | | showGDT(context, pid); |
| | | } |
| | | } |
| | | |
| | | private static void loadCSJ(Activity context, String codeId) { |
| | | TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(context); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(codeId) |
| | | //模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可 |
| | | .setExpressViewAcceptedSize(300, 300) |
| | | .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) { |
| | | |
| | | } |
| | | |
| | | //广告视频/图片加载完成的回调,接入方可以在这个回调后展示广告 |
| | | @Override |
| | | public void onFullScreenVideoCached() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | ttFullScreenVideoAd.showFullScreenVideoAd(context); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | private static UnifiedInterstitialAD iad = null; |
| | | |
| | | private static void showGDT(Activity context, String pid) { |
| | | |
| | | VideoOption.Builder builder = new VideoOption.Builder(); |
| | | VideoOption option = builder.build(); |
| | | iad = new UnifiedInterstitialAD(context, pid, new UnifiedInterstitialADListener() { |
| | | |
| | | @Override |
| | | public void onADReceive() { |
| | | if (iad != null && iad.isValid()) { |
| | | iad.showAsPopupWindow(context); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoCached() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADOpened() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADExposure() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClicked() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADLeftApplication() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClosed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | |
| | | } |
| | | }); |
| | | |
| | | iad.setVideoOption(option); |
| | | iad.loadAD(); |
| | | } |
| | | |
| | | } |
| | |
| | | url "https://maven.aliyun.com/repository/google" |
| | | } |
| | | |
| | | maven{url 'https://artifact.bytedance.com/repository/Volcengine/'} |
| | | |
| | | maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' } |
| | | |
| | | jcenter() |
| | |
| | | url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/" |
| | | } |
| | | maven { url 'http://developer.huawei.com/repo/' } |
| | | |
| | | maven { url 'https://artifact.bytedance.com/repository/pangle'} |
| | | } |
| | | |
| | | dependencies { |
| | |
| | | url "https://maven.aliyun.com/repository/google" |
| | | } |
| | | |
| | | maven{url 'https://artifact.bytedance.com/repository/Volcengine/'} |
| | | |
| | | maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' } |
| | | |
| | | jcenter() |
| | |
| | | maven { url 'https://dl.bintray.com/umsdk/release' } |
| | | maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| | | maven { url 'http://developer.huawei.com/repo/' } |
| | | maven { url 'https://artifact.bytedance.com/repository/pangle'} |
| | | } |
| | | } |
| | |
| | | android.enableJetifier=true |
| | | android.useAndroidX=true |
| | | org.gradle.jvmargs=-Xmx4096m |
| | |
| | | exitApp("exitApp"),//APP退出广告 |
| | | videoSearch("videoSearch"),//搜索页广告 |
| | | videoDetailFullVideo("videoDetailFullVideo"),//视频全屏广告 |
| | | homeInterstitial("homeInterstitial"),//首页插屏 |
| | | exitAppFullvideo("exitAppFullvideo"),//应用退出全屏 |
| | | other("other");//其他广告位 |
| | | |
| | | private String positionName; |
| | |
| | | |
| | | TTNativeExpressAd csj; |
| | | NativeExpressADView gdt;//旧版广点通 |
| | | NativeExpressADData2 gdt2;//2.0版广点通 |
| | | NativeUnifiedADData gdt2Unfied;//2.0广点通自渲染 |
| | | |
| | | public NativeUnifiedADData getGdt2Unfied() { |
| | |
| | | this.gdt = gdt; |
| | | } |
| | | |
| | | public ExpressAdContainer(NativeExpressADData2 gdt2) { |
| | | this.gdt2 = gdt2; |
| | | } |
| | | |
| | | public ExpressAdContainer(NativeUnifiedADData gdt2Unfied) { |
| | | this.gdt2Unfied = gdt2Unfied; |
| | |
| | | |
| | | public void setGdt(NativeExpressADView gdt) { |
| | | this.gdt = gdt; |
| | | } |
| | | |
| | | public NativeExpressADData2 getGdt2() { |
| | | return gdt2; |
| | | } |
| | | |
| | | public void setGdt2(NativeExpressADData2 gdt2) { |
| | | this.gdt2 = gdt2; |
| | | } |
| | | |
| | | |
| | |
| | | private String picture; |
| | | private String comment; |
| | | |
| | | @Expose |
| | | private String tag; |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | |
| | | this.tag = tag; |
| | | } |
| | | |
| | | private String tag; |
| | | } |
New file |
| | |
| | | package com.yeshi.base.utils; |
| | | |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | |
| | | public class JsonUtil { |
| | | |
| | | public static Gson videoGson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .excludeFieldsWithoutExposeAnnotation() |
| | | .create(); |
| | | |
| | | } |
| | |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.os.Build; |
| | | |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 穿山甲广告是否需要初始化 |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isCanInitCSJ() { |
| | | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; |
| | | // return false; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | }, mContext); |
| | | } else if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | | loadGDT2(pid, widthDP, heightDP, count, new IGDTAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<NativeExpressADView> adList) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccess2(List<NativeExpressADData2> adList) { |
| | | List<ExpressAdContainer> adContainerList = new ArrayList<>(); |
| | | if (adList != null) |
| | | for (NativeExpressADData2 ad : adList) { |
| | | adContainerList.add(new ExpressAdContainer(ad)); |
| | | } |
| | | adLoadListener.onSuccess(adContainerList); |
| | | } |
| | | }, mContext); |
| | | |
| | | } else if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | loadCSJ(pid, widthDP, heightDP, count, new ICSJAdLoadListener() { |
| | | @Override |
| | |
| | | nativeExpressAD.loadAD(count); |
| | | } |
| | | |
| | | /** |
| | | * 2.0版本广点通原生 |
| | | * |
| | | * @param positionId |
| | | * @param widthDP |
| | | * @param heightDP |
| | | * @param count |
| | | * @param adLoadListener |
| | | * @param context |
| | | */ |
| | | private void loadGDT2(String positionId, int widthDP, int heightDP, int count, final IGDTAdLoadListener adLoadListener, Context context) { |
| | | |
| | | Log.i(TAG, String.format("loadGDT2:positionId-%s widthDP-%s heightDP-%s", positionId, widthDP, heightDP)); |
| | | |
| | | NativeExpressAD2 nativeExpressAD2 = new NativeExpressAD2(context, positionId, new NativeExpressAD2.AdLoadListener() { |
| | | @Override |
| | | public void onLoadSuccess(List<NativeExpressADData2> list) { |
| | | if (adLoadListener != null) |
| | | adLoadListener.onSuccess2(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | if (adLoadListener != null) |
| | | adLoadListener.onSuccess2(null); |
| | | } |
| | | }); |
| | | |
| | | nativeExpressAD2.setAdSize(widthDP, heightDP); |
| | | VideoOption2.Builder builder = new VideoOption2.Builder(); |
| | | builder.setAutoPlayPolicy(VideoOption2.AutoPlayPolicy.WIFI) // WIFI 环境下可以自动播放视频 |
| | | .setAutoPlayMuted(true) // 自动播放时为静音 |
| | | .setDetailPageMuted(false) // 视频详情页播放时不静音 |
| | | .setMaxVideoDuration(0) // 设置返回视频广告的最大视频时长(闭区间,可单独设置),单位:秒,默认为 0 代表无限制,合法输入为:5<=maxVideoDuration<=60. 此设置会影响广告填充,请谨慎设置 |
| | | .setMinVideoDuration(0); // 设置返回视频广告的最小视频时长(闭区间,可单独设置),单位:秒,默认为 0 代表无限制, 此设置会影响广告填充,请谨慎设置 |
| | | nativeExpressAD2.setVideoOption2(builder.build()); |
| | | nativeExpressAD2.loadAd(count); |
| | | } |
| | | |
| | | /** |
| | | * 穿山甲广告 |
| | |
| | | ((ViewGroup) ad.getGdt().getParent()).removeAllViews(); |
| | | } |
| | | fl_ad.addView(ad.getGdt()); |
| | | } else if (ad.getGdt2() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getGdt2().getAdView()) { |
| | | return; |
| | | } |
| | | fl_ad.removeAllViews(); |
| | | |
| | | ad.getGdt2().setAdEventListener(new AdEventListener() { |
| | | @Override |
| | | public void onClick() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onExposed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | try { |
| | | if (ad.getGdt2().getAdView().getParent() != null) { |
| | | ((ViewGroup) ad.getGdt2().getAdView().getParent()).removeAllViews(); |
| | | } |
| | | fl_ad.addView(ad.getGdt2().getAdView()); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAdClosed() { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | | } |
| | | }); |
| | | ad.getGdt2().render(); |
| | | |
| | | } else if (ad.getCsj() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getCsj().getExpressAdView()) { |
| | | return; |
| | |
| | | list.add(ad); |
| | | if (adRenderListener != null) |
| | | adRenderListener.onRenderSuccess(list); |
| | | } else if (ad.getGdt2() != null) { |
| | | ad.getGdt2().setAdEventListener(new AdEventListener() { |
| | | @Override |
| | | public void onClick() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onExposed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | List<ExpressAdContainer> list = new ArrayList<>(); |
| | | list.add(ad); |
| | | if (adRenderListener != null) |
| | | adRenderListener.onRenderSuccess(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | List<ExpressAdContainer> list = new ArrayList<>(); |
| | | list.add(ad); |
| | | if (adRenderListener != null) |
| | | adRenderListener.onRenderFail(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onAdClosed() { |
| | | if (adEventListener != null) |
| | | adEventListener.closeAd(ad); |
| | | } |
| | | }); |
| | | ad.getGdt2().render(); |
| | | |
| | | } else if (ad.getCsj() != null) { |
| | | ad.getCsj().setExpressInteractionListener(new TTNativeExpressAd.ExpressAdInteractionListener() { |
| | | @Override |
| | |
| | | |
| | | if (ad.getGdt() != null) { |
| | | return; |
| | | } else if (ad.getGdt2() != null) { |
| | | ad.getGdt2().setAdEventListener(new AdEventListener() { |
| | | @Override |
| | | public void onClick() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onExposed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | } |
| | | |
| | | @Override |
| | | public void onAdClosed() { |
| | | if (adEventListener != null) |
| | | adEventListener.closeAd(ad); |
| | | } |
| | | }); |
| | | |
| | | } else if (ad.getCsj() != null) { |
| | | ad.getCsj().setExpressInteractionListener(new TTNativeExpressAd.ExpressAdInteractionListener() { |
| | | @Override |
| | |
| | | } |
| | | fl_ad.removeAllViews(); |
| | | fl_ad.addView(ad.getGdt()); |
| | | } else if (ad.getGdt2() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getGdt2().getAdView()) { |
| | | return; |
| | | } |
| | | if (ad.getGdt2().getAdView().getParent() != null) { |
| | | ((ViewGroup) ad.getGdt2().getAdView().getParent()).removeAllViews(); |
| | | } |
| | | fl_ad.removeAllViews(); |
| | | fl_ad.addView(ad.getGdt2().getAdView()); |
| | | |
| | | } else if (ad.getCsj() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getCsj().getExpressAdView()) { |
| | | return; |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.yeshi.base.R; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | |
| | | /** |
| | | * 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用 |
| | |
| | | } |
| | | |
| | | private static TTAdConfig buildConfig(Context context) { |
| | | return new TTAdConfig.Builder() |
| | | |
| | | |
| | | TTAdConfig.Builder builder = new TTAdConfig.Builder() |
| | | .appId(context.getString(R.string.ad_csj_app_id)) |
| | | .useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView |
| | | .appName(context.getString(R.string.app_name)) |
| | | .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK) |
| | | .allowShowNotify(true) //是否允许sdk展示通知栏提示 |
| | | .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 |
| | | .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) |
| | | // .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) |
| | | .supportMultiProcess(true)//是否支持多进程 |
| | | .asyncInit(true) |
| | | .needClearTaskReset() |
| | | .build(); |
| | | .needClearTaskReset(); |
| | | if (AdUtil.getAdType(context, AdPositionEnum.splashHotStart) != null) { |
| | | builder.directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI); |
| | | } |
| | | |
| | | |
| | | return builder.build(); |
| | | } |
| | | } |
| | |
| | | |
| | | <string name="ad_csj_pid_pptv_insert" translatable="false">946909932</string> |
| | | |
| | | <!-- 首页插屏 --> |
| | | <string name="ad_csj_pid_home_insert" translatable="false">947433562</string> |
| | | |
| | | <!-- ##########穿山甲广告结束########## --> |
| | | |
| | | |
| | |
| | | <string name="ad_gdt_pid_exit_dialog" translatable="false">8051402676338159</string> |
| | | <string name="ad_gdt_pid_video_detail_insert" translatable="false">6062144740668570</string> |
| | | <string name="ad_gdt_pid_pptv_insert" translatable="false">2062545731747292</string> |
| | | <string name="ad_gdt_pid_home_insert" translatable="false">8012670734764571</string> |
| | | |
| | | |
| | | <!-- ##########广点通广告结束########## --> |
| | |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.fragment.app.FragmentManager; |
| | | import androidx.fragment.app.FragmentTransaction; |
| | | |
| | | import android.util.Log; |
| | | |
| | | public class FragmentSwitchHelper { |
New file |
| | |
| | | package com.lcjian.library.util; |
| | | |
| | | import android.util.Log; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.fragment.app.FragmentManager; |
| | | import androidx.fragment.app.FragmentTransaction; |
| | | |
| | | public class FragmentSwitchHelperV2 { |
| | | |
| | | private static final String TAG = "FragmentSwitchHelperV2"; |
| | | |
| | | public FragmentManager mFragmentManager; |
| | | |
| | | private Map<String, Fragment> mFragments; |
| | | |
| | | private Fragment mCurrentFragment; |
| | | |
| | | private int mContainerId; |
| | | |
| | | |
| | | public Fragment getFragmentByTag(String tag) { |
| | | if (mFragments == null || mFragments.isEmpty()) |
| | | return null; |
| | | return mFragments.get(tag); |
| | | } |
| | | |
| | | public static FragmentSwitchHelperV2 create(int containerId, |
| | | FragmentManager fragmentManager, Map<String, Fragment> mFragments) { |
| | | return new FragmentSwitchHelperV2(containerId, fragmentManager, mFragments); |
| | | } |
| | | |
| | | private FragmentSwitchHelperV2(int containerId, |
| | | FragmentManager fragmentManager, Map<String, Fragment> mFragments) { |
| | | this.mContainerId = containerId; |
| | | this.mFragments = mFragments; |
| | | this.mFragmentManager = fragmentManager; |
| | | } |
| | | |
| | | public void addFragment(String tag, Fragment fragment) { |
| | | if (mFragments == null) { |
| | | mFragments = new HashMap<>(); |
| | | } |
| | | mFragments.put(tag, fragment); |
| | | } |
| | | |
| | | public void changeFragment(String tag) { |
| | | |
| | | if (mFragments.get(tag) == null) { |
| | | return; |
| | | } |
| | | |
| | | if (!mFragmentManager.isDestroyed()) { |
| | | Fragment replaceFragment = mFragmentManager |
| | | .findFragmentByTag(tag); |
| | | if (mCurrentFragment == replaceFragment && mCurrentFragment != null) { |
| | | Log.d(TAG, "changeFragment noChange "); |
| | | return; |
| | | } |
| | | FragmentTransaction fragmentTransaction = mFragmentManager |
| | | .beginTransaction(); |
| | | if (mCurrentFragment != null) { |
| | | // fragmentTransaction.detach(mCurrentFragment); |
| | | fragmentTransaction.hide(mCurrentFragment); |
| | | |
| | | Log.d(TAG, "changeFragment detach " + mCurrentFragment.getTag()); |
| | | } |
| | | if (replaceFragment == null) { |
| | | replaceFragment = mFragments.get(tag); |
| | | fragmentTransaction.add(mContainerId, replaceFragment, |
| | | tag); |
| | | Log.d(TAG, |
| | | "changeFragment add " + tag); |
| | | } else { |
| | | // fragmentTransaction.attach(replaceFragment); |
| | | fragmentTransaction.show(replaceFragment); |
| | | |
| | | Log.d(TAG, |
| | | "changeFragment attach " |
| | | + tag); |
| | | } |
| | | |
| | | fragmentTransaction.commitAllowingStateLoss(); |
| | | mCurrentFragment = replaceFragment; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public static String getVersionName(Context context) { |
| | | try { |
| | | PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); |
| | | return pi.versionName; |
| | | } catch (NameNotFoundException e) { |
| | | e.printStackTrace(); |
| | | return "1.0.0"; |
| | | } |
| | | } |
| | | |
| | | public static String getPackageName(Context context) { |
| | | return "com.mugua.mgvideo";//context.getPackageName(); |
| | | } |
| | |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.entity.video.VideoType; |
| | | import com.yeshi.base.ui.BaseActivity; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.ExpressAdManager; |
| | |
| | | if (albumCount >= 1) { |
| | | VideoContent videoContent = VideoContent.createAdContent(adList.get(0)); |
| | | mVideoInfos.add(0, videoContent); |
| | | adapter.notifyItemInserted(0); |
| | | adapter.notifyDataSetChanged(); |
| | | rl_search_result.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | rl_search_result.scrollTo(0,0); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | throws Exception { |
| | | |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | JSONObject rootData = jsonObject.getJSONObject("Data"); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | |
| | | rootData.getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | //设置导航栏 |
| | | if (rootData.opt("typeList") != null) { |
| | | if (typeList == null) { |
| | | typeList = gson.fromJson( |
| | | typeList = JsonUtil.videoGson.fromJson( |
| | | rootData |
| | | .getJSONArray("typeList").toString(), |
| | | new TypeToken<List<VideoType>>() { |
| | |
| | | } |
| | | }); |
| | | |
| | | viewHolder.tv_close.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | contentList.remove(videoContent); |
| | | notifyDataSetChanged(); |
| | | } |
| | | }); |
| | | |
| | | viewHolder.tv_name.setText(ad.getTitle()); |
| | | viewHolder.tv_actors.setText(ad.getDesc()); |
| | | |
| | |
| | | TextView tv_type; |
| | | TextView tv_actors; |
| | | TextView tv_play; |
| | | TextView tv_close; |
| | | View view; |
| | | NativeAdContainer mNativeAdContainer; |
| | | RatioLayout rl_picture; |
| | |
| | | tv_play = view.findViewById(R.id.tv_play); |
| | | mNativeAdContainer = view.findViewById(R.id.root); |
| | | rl_picture = view.findViewById(R.id.rl_picture); |
| | | tv_close = view.findViewById(R.id.tv_close); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | </com.lcjian.library.widget.RatioLayout> |
| | | |
| | | <LinearLayout |
| | | <FrameLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginLeft="17dp" |
| | | android:layout_weight="190" |
| | | android:layout_weight="190"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <LinearLayout |
| | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_name" |
| | | android:layout_width="0dp" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:ellipsize="end" |
| | | android:maxLines="2" |
| | | android:text="以家人之名" |
| | |
| | | |
| | | </LinearLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_close" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="right|top" |
| | | android:padding="2dp" |
| | | android:text="关闭广告" |
| | | android:textColor="@color/gray"></TextView> |
| | | </FrameLayout> |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | |
| | | android:inputType="text" |
| | | android:padding="5dp" |
| | | android:textAppearance="?android:attr/textAppearance" |
| | | android:textColor="@color/search_input_text_color" |
| | | android:textColor="@color/white" |
| | | android:textColorHint="@color/search_input_hint_text_color" |
| | | android:textCursorDrawable="@null" |
| | | android:textSize="14sp" /> |
| | |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.entity.video.VideoResource; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoResource resource = gson.fromJson( |
| | | |
| | | VideoResource resource = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONObject("Resource") |
| | | .toString(), |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | |
| | | final VideoInfo videoInfo = gson |
| | | |
| | | final VideoInfo videoInfo = JsonUtil.videoGson |
| | | .fromJson(jsonObject.getJSONObject("Data") |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.entity.video.VideoResource; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.base.utils.user.UserUtil; |
| | | import com.yeshi.video.R; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoResource resource = gson.fromJson( |
| | | |
| | | VideoResource resource = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONObject("Resource") |
| | | .toString(), |
| | |
| | | import com.yeshi.base.entity.video.VideoResource; |
| | | import com.yeshi.base.ui.BaseActivity; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | |
| | | } |
| | | |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | final VideoInfo videoInfo = gson |
| | | final VideoInfo videoInfo = JsonUtil.videoGson |
| | | .fromJson(jsonObject.getJSONObject("Data") |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoResource resource = gson.fromJson( |
| | | VideoResource resource = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONObject("Resource") |
| | | .toString(), |
| | |
| | | values.put(WatchHistoryTable.VIDEO_DETAIL_ID, videoDetailId); |
| | | values.put(WatchHistoryTable.VIDEO_THIRD_TYPE, |
| | | videoInfo.getThirdType()); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | values.put(WatchHistoryTable.VIDEO_DETAIL, gson.toJson(videoInfo)); |
| | | values.put(WatchHistoryTable.VIDEO_DETAIL, JsonUtil.videoGson.toJson(videoInfo)); |
| | | values.put(WatchHistoryTable.WATCH_TIME, 0); |
| | | values.put(WatchHistoryTable.VIDEO_RESOURCE, from); |
| | | values.put(WatchHistoryTable.VIDEO_RESOURCE_ID, resoureID); |
| | |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.entity.video.VideoResource; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.downutil.DownloadUtils; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.video.R; |
| | |
| | | if (!isSetup) { |
| | | update(); |
| | | } |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | final VideoInfo videoInfo = gson |
| | | final VideoInfo videoInfo = JsonUtil.videoGson |
| | | .fromJson(jsonObject.getJSONObject("Data") |
| | | .toString(), |
| | | new TypeToken<VideoInfo>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoResource resource = gson.fromJson( |
| | | |
| | | VideoResource resource = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONObject("Resource") |
| | | .toString(), |
| | |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import com.yeshi.base.entity.db.DownloadTable; |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.SDCardUtil; |
| | | import com.yeshi.base.utils.downutil.DownloadUtils; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | |
| | | videoDetailInfo.getId()); |
| | | values.put(DownloadTable.VIDEO_THIRD_TYPE, |
| | | mVideoInfo.getThirdType()); |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | values.put(DownloadTable.VIDEO_DETAIL, |
| | | gson.toJson(mVideoInfo)); |
| | | JsonUtil.videoGson.toJson(mVideoInfo)); |
| | | getContext().getContentResolver().insert( |
| | | DownloadTable.CONTENT_URI, values); |
| | | EventBus.getDefault().post(values); |
| | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.video.R; |
| | | import com.yeshi.video.entity.Comment; |
| | |
| | | + jsonObject.optJSONObject("Data") |
| | | .toString()); |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | // if (mList == null) { |
| | | // mList = new ArrayList<Comment>(); |
| | | // } |
| | | |
| | | List<Comment> list = gson.fromJson(jsonObject |
| | | List<Comment> list = JsonUtil.videoGson.fromJson(jsonObject |
| | | .optJSONObject("Data").optJSONArray("data") |
| | | .toString(), |
| | | new TypeToken<List<Comment>>() { |
| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.yeshi.base.entity.video.VideoDetailInfo; |
| | | import com.yeshi.base.utils.JsonUtil; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | |
| | | private static void saveTempVideoDetailList(Context context, List<VideoDetailInfo> detailInfos) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("videoTempInfo", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putString("videoDetailInfoList", new Gson().toJson(detailInfos)); |
| | | editor.putString("videoDetailInfoList", JsonUtil.videoGson.toJson(detailInfos)); |
| | | editor.commit(); |
| | | } |
| | | |
| | |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("videoTempInfo", Context.MODE_PRIVATE); |
| | | String content = sharedPreferences.getString("videoDetailInfoList", ""); |
| | | if (!StringUtils.isEmpty(content)) { |
| | | return new Gson().fromJson(content, new TypeToken<List<VideoDetailInfo>>() { |
| | | return JsonUtil.videoGson.fromJson(content, new TypeToken<List<VideoDetailInfo>>() { |
| | | }.getType()); |
| | | } |
| | | return new ArrayList<>(); |