69个文件已添加
88个文件已修改
6个文件已删除
| | |
| | | dependencies { |
| | | api fileTree(include: '*.jar', dir: 'libs') |
| | | api 'androidx.legacy:legacy-support-v4:1.0.0' |
| | | api files('libs/GDTSDK.unionNormal.4.232.1102.aar') |
| | | //广点通SDK |
| | | api 'com.qq.e.union:union:4.420.1290' |
| | | } |
| | | |
| | | android { |
| | |
| | | <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /> |
| | | <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> |
| | | |
| | | <uses-sdk tools:overrideLibrary="com.bytedance.pangrowthsdk,com.bytedance.novel.pangolin"></uses-sdk> |
| | | |
| | | <application |
| | | android:name="com.hanju.video.app.HanJuApplication" |
| | | android:allowBackup="true" |
| | |
| | | android:largeHeap="true" |
| | | android:theme="@style/AppTheme" |
| | | tools:replace="android:allowBackup,android:icon"> |
| | | |
| | | <uses-library |
| | | android:name="org.apache.http.legacy" |
| | | android:required="false" /> |
| | | |
| | | <activity |
| | | android:name="com.hanju.video.app.ui.SplashActivity" |
| | |
| | | android:label="@string/app_name"> |
| | | |
| | | </activity> |
| | | |
| | | <activity |
| | | android:name="com.hanju.video.app.ui.SimpleBrowserActivity" |
| | | android:label="@string/app_name"></activity> |
| | | |
| | | <activity |
| | | android:name="com.hanju.video.app.ui.mine.DownLoadUrlActivity" |
| | | android:configChanges="orientation|screenSize|keyboardHidden" |
| | |
| | | <service android:name="com.hanju.update.appupdate.service.DownLoadFileService"></service> |
| | | <service android:name="com.hanju.video.app.services.DownLoadFileService" /> |
| | | |
| | | <meta-data |
| | | android:name="android.max_aspect" |
| | | android:value="2.3" /> |
| | | <!-- <meta-data--> |
| | | <!-- android:name="android.max_aspect"--> |
| | | <!-- android:value="2.3" />--> |
| | | |
| | | <!-- umeng相关Start --> |
| | | <!--<activity--> |
| | |
| | | android:value="570f28a578d6e12cba6f7f200b8d1c83"></meta-data> |
| | | <meta-data |
| | | android:name="UMENG_CHANNEL" |
| | | android:value="meizu"></meta-data> |
| | | android:value="vivo"></meta-data> |
| | | |
| | | |
| | | <provider |
| | |
| | | <activity |
| | | android:name="com.qq.e.ads.LandscapeADActivity" |
| | | android:configChanges="keyboard|keyboardHidden|orientation|screenSize" |
| | | android:screenOrientation="landscape" /> |
| | | android:screenOrientation="landscape" |
| | | tools:replace="android:screenOrientation" /> |
| | | |
| | | <!-- 请开发者注意字母的大小写,ADActivity,而不是AdActivity --> |
| | | <activity |
| | |
| | | android:configChanges="orientation|keyboardHidden|screenSize" |
| | | android:theme="@android:style/Theme.Translucent.NoTitleBar" /> |
| | | |
| | | |
| | | </application> |
| | | |
| | | </manifest> |
New file |
| | |
| | | { |
| | | "init": { |
| | | "site_id": "5211168", |
| | | "app_id": "300966", |
| | | "partner": "pangle_300966", |
| | | "secure_key": "2f584b5c5b94d4afe5c5512dcdf39869" |
| | | }, |
| | | "feed": { |
| | | "news_list_ad_code_id": "947236328", |
| | | "news_first_ad_code_id": "947236329", |
| | | "news_second_ad_code_id": "947236316", |
| | | "video_first_ad_code_id": "", |
| | | "video_second_ad_code_id": "947236320", |
| | | "related_ad_code_id": "947236324", |
| | | "news_draw_ad_code_id": "947236330", |
| | | "news_draw_native_ad_code_id": "947236318", |
| | | "news_outer_list_ad_code_id": "947236336", |
| | | "news_outer_first_ad_code_id": "947236332", |
| | | "news_outer_second_ad_code_id": "947236339", |
| | | "outer_video_second_ad_code_id": "947236309", |
| | | "outer_related_ad_code_id": "947236322", |
| | | "news_outer_draw_ad_code_id": "947236341", |
| | | "news_outer_draw_native_ad_code_id": "947236323", |
| | | "news_interstitial_code_id": "947236331" |
| | | }, |
| | | "small_video": { |
| | | "draw_ad_code_id": "947236310", |
| | | "draw_native_ad_code_id": "947236306", |
| | | "grid_ad_code_id": "947236342", |
| | | "grid_draw_ad_code_id": "947236333", |
| | | "grid_draw_native_ad_code_id": "947236343", |
| | | "video_card_ad_code_id": "947236319", |
| | | "video_card_draw_ad_code_id": "947236326", |
| | | "video_card_draw_native_ad_code_id": "947236314", |
| | | "interstitial_ad_code_id": "947236311", |
| | | "interstitial_note_ad_code_id": "947236313", |
| | | "staggered_grid_ad_code_id": "947236308", |
| | | "staggered_grid_draw_ad_code_id": "947236310", |
| | | "staggered_grid_draw_native_ad_code_id": "947236306" |
| | | }, |
| | | "novel": { |
| | | "status": 1, |
| | | "pre_ad_code_id": "947236535", |
| | | "mid_ad_code_id": "947236554", |
| | | "exciting_ad_code_id": "947236538", |
| | | "interstitial_code_id": "947236543", |
| | | "banner_ad_code_id": "947236549", |
| | | "end_ad_code_id": "947236551" |
| | | }, |
| | | "live": null |
| | | } |
| | |
| | | api 'androidx.appcompat:appcompat:1.0.0' |
| | | api files('libs/jg_filter_sdk_1.1.jar') |
| | | api files('libs/FunshionPlaySDK1.5.1.aar') |
| | | api project(':social_sdk_library_project') |
| | | api project(':GuangDianTongSDK') |
| | | api project(':MDownloadProvider') |
| | | implementation 'androidx.recyclerview:recyclerview:1.0.0' |
| | | implementation project(path: ':gallery') |
| | | //穿山甲广告 |
| | | implementation(name: 'open_ad_sdk_3.9.0.2', ext: 'aar') |
| | | implementation(name: 'open_ad_sdk_4.0.0.6', ext: 'aar') |
| | | |
| | | implementation "org.jsoup:jsoup:1.11.2" |
| | | |
| | | |
| | | //----------阿里百川开始------------ |
| | | implementation files('libs/avmpaar3-5.4.36.aar') |
| | |
| | | implementation files('libs/alibc/AlibcTradeCommon-4.0.0.15.aar') |
| | | implementation files('libs/alibc/AlibcTradeBiz-4.0.0.15.aar') |
| | | implementation files('libs/alibc/nb_trade-4.0.0.15.aar') |
| | | implementation files('libs/tbs_sdk_thirdapp_v4.3.0.39_43939.jar') |
| | | //----------阿里百川结束------------ |
| | | |
| | | implementation 'androidx.cardview:cardview:1.0.0' |
| | | |
| | | compile ('com.android.support:support-v4:23.4.0'){ |
| | | force = true; |
| | | } |
| | | compile('com.android.support:recyclerview-v7:23.4.0') { |
| | | exclude module: 'support-v4' |
| | | } |
| | | |
| | | |
| | | //权限请求 |
| | | // implementation 'com.github.jokermonn:permissions4m:2.1.2-lib' |
| | |
| | | //视频播放器 |
| | | //完整版引入 |
| | | implementation 'com.github.CarGuo.GSYVideoPlayer:gsyVideoPlayer:v8.1.5-jitpack' |
| | | implementation project(path: ':library-youth') |
| | | implementation project(path: ':social_sdk_library_project') |
| | | |
| | | |
| | | 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 { |
| | | signingConfigs { |
| | |
| | | } |
| | | } |
| | | useLibrary 'org.apache.http.legacy' |
| | | compileSdkVersion 28 |
| | | compileSdkVersion 29 |
| | | buildToolsVersion '28.0.3' |
| | | compileOptions { |
| | | sourceCompatibility JavaVersion.VERSION_1_7 |
| | |
| | | } |
| | | defaultConfig { |
| | | applicationId "com.hanju.video" |
| | | versionCode 97 |
| | | versionName "2.0.3" |
| | | versionCode 102 |
| | | versionName "2.0.6" |
| | | multiDexEnabled = true |
| | | minSdkVersion 19 |
| | | targetSdkVersion 27 |
| | | targetSdkVersion 29 |
| | | ndk { |
| | | abiFilters "armeabi-v7a", "x86", "armeabi" |
| | | abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' |
| | | } |
| | | //爱韩剧 |
| | | resValue "string", "app_name", "韩剧播放器" |
| | | manifestPlaceholders = [app_icon: "@drawable/ic_launcher"] |
| | | resValue "string", "app_name", "爱韩剧播放器" |
| | | manifestPlaceholders = [app_icon : "@drawable/ic_launcher_1", |
| | | JPUSH_PKGNAME: applicationId, |
| | | JPUSH_APPKEY : "461d3e0c6adb0a188e82408f", //JPush 上注册的包名对应的 Appkey. |
| | | JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可. |
| | | ] |
| | | } |
| | | dexOptions { |
| | | javaMaxHeapSize = "4g" |
| | |
| | | exclude 'META-INF/license.txt' |
| | | exclude 'META-INF/dependencies.txt' |
| | | exclude 'META-INF/LGPL2.1' |
| | | doNotStrip '*/mips/*.so' |
| | | doNotStrip '*/mips64/*.so' |
| | | } |
| | | sourceSets { |
| | | main { |
| | |
| | | android:background="#010005" |
| | | android:orientation="vertical"> |
| | | |
| | | <View |
| | | android:id="@+id/v_status_bar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="15dp" |
| | | android:background="@color/top_bar_color" /> |
| | | <!-- <View--> |
| | | <!-- android:id="@+id/v_status_bar"--> |
| | | <!-- android:layout_width="match_parent"--> |
| | | <!-- android:layout_height="15dp"--> |
| | | <!-- android:background="@color/top_bar_color" />--> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
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:layout_height="match_parent" |
| | | android:background="@color/theme" |
| | | android:orientation="vertical"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_top" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:gravity="center_vertical"> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_top_bar_left" |
| | | style="@style/TextBuleNormal" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerVertical="true" |
| | | android:drawableLeft="@drawable/ic_back_two" |
| | | android:drawablePadding="3dp" |
| | | android:gravity="center" |
| | | android:padding="8dp" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:gravity="center_vertical" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_title" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:ellipsize="end" |
| | | android:maxLines="1" |
| | | android:text="" |
| | | android:textColor="@color/white" |
| | | android:textSize="15sp"></TextView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_url" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="3dp" |
| | | android:ellipsize="end" |
| | | android:maxLines="1" |
| | | android:textColor="@color/white" |
| | | android:textSize="8sp"></TextView> |
| | | |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_container" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <WebView |
| | | android:id="@+id/webview" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" /> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_ad" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:visibility="gone"> |
| | | |
| | | |
| | | </FrameLayout> |
| | | |
| | | |
| | | </FrameLayout> |
| | | </FrameLayout> |
| | | </LinearLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_top_bar_left1" |
| | | style="@style/TextBuleNormal" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_alignParentStart="true" |
| | | android:layout_alignParentLeft="true" |
| | | android:layout_centerVertical="true" |
| | | android:layout_gravity="left|top" |
| | | android:drawableLeft="@drawable/ic_back_two" |
| | | android:drawablePadding="3dp" |
| | | android:gravity="center" |
| | | android:padding="8dp" |
| | | android:visibility="gone" /> |
| | | |
| | | |
| | | </FrameLayout> |
| | |
| | | android:textColor="@color/black" |
| | | android:textSize="20sp" /> |
| | | |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="260dp" |
| | | android:layout_marginLeft="10dp" |
| | | android:layout_marginRight="10dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | android:autoLink="all" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="10dp" |
| | | android:textSize="10sp" |
| | | android:lineSpacingExtra="8sp" |
| | | android:autoLink="all" |
| | | android:background="@null" |
| | | android:layout_marginRight="10dp"></TextView> |
| | | android:lineSpacingExtra="8sp" |
| | | android:textSize="14sp"></TextView> |
| | | </ScrollView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
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> |
| | |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_top" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@color/top_bar_color" |
| | |
| | | <FrameLayout |
| | | android:id="@+id/fl_advertisement" |
| | | android:layout_width="match_parent" |
| | | android:paddingBottom="10dp" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <ImageView |
| | |
| | | android:layout_marginTop="10dp" |
| | | android:text="你还没有编辑你的个人简介,所以空空如也~" |
| | | android:textColor="#ff6b6b6b" |
| | | android:paddingBottom="5dp" |
| | | android:textSize="15sp" /> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_video_mine" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginTop="60dp" |
| | |
| | | android:orientation="vertical"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_history" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:paddingLeft="24dp" |
| | |
| | | android:id="@+id/rv_watch_history" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content"></androidx.recyclerview.widget.RecyclerView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_youth" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="50dp" |
| | | android:layout_marginTop="12dp" |
| | | android:background="@drawable/shape_mine_item_bg" |
| | | android:gravity="center_vertical" |
| | | android:orientation="horizontal"> |
| | | |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="20dp" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_marginLeft="25dp" |
| | | android:src="@drawable/icon_mine_youth"></ImageView> |
| | | |
| | | <TextView |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_weight="1" |
| | | android:drawableRight="@drawable/ic_mine_item_array" |
| | | android:paddingRight="15dp" |
| | | android:text="青少年模式" |
| | | android:textColor="@color/white" |
| | | android:textSize="15sp" /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | |
| | | <LinearLayout |
| | |
| | | android:textSize="15sp" /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_mine_setting" |
| | | android:layout_width="match_parent" |
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:background="@color/white" |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <include layout="@layout/navigation_top_bar" /> |
| | | |
| | | <ProgressBar |
| | | android:id="@+id/myProgressBar" |
| | | style="?android:attr/progressBarStyleHorizontal" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" |
| | | android:background="#0B78E3" /> |
| | | |
| | | |
| | | <WebView |
| | | android:id="@+id/webview" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" /> |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_height="15dp" |
| | | android:background="@color/top_bar_color" /> |
| | | |
| | | <RelativeLayout |
| | | |
| | | <FrameLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/rl_page" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fragment_video_play_container1" |
| | |
| | | </LinearLayout> |
| | | |
| | | </RelativeLayout> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_pptv" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"></FrameLayout> |
| | | |
| | | |
| | | </FrameLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.IntentFilter; |
| | | |
| | | import androidx.multidex.MultiDex; |
| | | |
| | | import android.os.Build; |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.Log; |
| | | |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | 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.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.lib.library.util.common.PackageUtils2; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.TTAdManagerHolder; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.common.CrashHandler; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.util.ui.SDCardUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.nostra13.universalimageloader.core.ImageLoader; |
| | | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; |
| | | import com.nostra13.universalimageloader.core.assist.QueueProcessingType; |
| | | import com.qq.e.comm.managers.GDTADManager; |
| | | import com.qq.e.comm.managers.GDTAdSdk; |
| | | import com.tencent.mm.opensdk.constants.ConstantsAPI; |
| | | import com.tencent.mm.opensdk.openapi.IWXAPI; |
| | | import com.tencent.mm.opensdk.openapi.WXAPIFactory; |
| | |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.umeng.socialize.PlatformConfig; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.hanju.video.app.util.common.CrashHandler; |
| | | import com.hanju.video.app.util.ad.TTAdManagerHolder; |
| | | |
| | | import androidx.multidex.MultiDex; |
| | | |
| | | public class HanJuApplication extends Application { |
| | | public static HanJuApplication application = null; |
| | |
| | | public static String MMNumber; |
| | | public static IWXAPI mWxApi = null; |
| | | |
| | | public static boolean inited = false; |
| | | |
| | | private static int mStatusBarHeight; |
| | | private static String TAG = "HanJuApplication"; |
| | | |
| | | //兼容4.4以下版本 |
| | | protected void attachBaseContext(Context newBase) { |
| | | super.attachBaseContext(newBase); |
| | | MultiDex.install(this); |
| | | } |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | application = this; |
| | | MultiDex.install(this); |
| | | if (UserUtil.isAgreeUserProtocol(application)) { |
| | | init(application); |
| | | if (UserUtil.isAgreeUserProtocol(application) || HanJuConstant.DEBUG) { |
| | | init(application, null); |
| | | } |
| | | } |
| | | |
| | | public static void init(Application application) { |
| | | public static void init(Application application, InitListener initListener) { |
| | | inited = true; |
| | | try { |
| | | TelephonyManager manager = (TelephonyManager) application.getSystemService(TELEPHONY_SERVICE); |
| | | String model = Build.MODEL; |
| | | HanJuApplication.deviceName = model; |
| | | HanJuApplication.deviceNumber = manager.getDeviceId(); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | SDCardUtil.initStorage(application); |
| | | |
| | | //友盟初始化 |
| | | String description = ManifestDataUtil.getAppMetaData(application, "UMENG_CHANNEL"); |
| | | UMConfigure.init(application, application.getResources().getString(R.string.umeng_key), description, UMConfigure.DEVICE_TYPE_PHONE, null); |
| | | UMConfigure.setEncryptEnabled(true); |
| | | // 选用AUTO页面采集模式 |
| | | MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); |
| | | UMShareAPI.get(application); |
| | |
| | | initWX(application); |
| | | String gdtAppId = AppConfigUtil.getGDTAppId(application); |
| | | String csjAppId = AppConfigUtil.getCSJAppId(application); |
| | | initAd(application, gdtAppId, csjAppId); |
| | | initAd(application, gdtAppId, csjAppId, initListener); |
| | | |
| | | } |
| | | |
| | | public static void initAd(Application context, String gdtAppId, String csjAppId) { |
| | | public static void initAd(Application context, String gdtAppId, String csjAppId, InitListener initListener) { |
| | | if (!StringUtils.isNullOrEmpty(gdtAppId)) |
| | | GDTADManager.getInstance().initWith(context, gdtAppId); |
| | | GDTAdSdk.init(context, gdtAppId); |
| | | if (!StringUtils.isNullOrEmpty(csjAppId)) |
| | | initCSJAd(context, csjAppId); |
| | | initCSJAd(context, csjAppId, initListener); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @Override |
| | | public void onViewInitFinished(boolean arg0) { |
| | | // TODO Auto-generated method stub |
| | | //x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。 |
| | | Log.d("app", " onViewInitFinished is " + arg0); |
| | | } |
| | | |
| | | @Override |
| | | public void onCoreInitFinished() { |
| | | // TODO Auto-generated method stub |
| | | } |
| | | }; |
| | | //x5内核初始化接口 |
| | | QbSdk.initX5Environment(application, cb); |
| | | QbSdk.canGetDeviceId(false); |
| | | QbSdk.canGetAndroidId(false); |
| | | QbSdk.canGetSubscriberId(false); |
| | | |
| | | initNovel(application); |
| | | initDPSDK(application); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 穿山甲广告初始化 |
| | | */ |
| | | private static void initCSJAd(Application application, String appId) { |
| | | TTAdManagerHolder.init(application, appId); |
| | | private static void initCSJAd(Application application, String appId, InitListener initListener) { |
| | | TTAdManagerHolder.init(application, appId, new TTAdSdk.InitCallback() { |
| | | @Override |
| | | public void success() { |
| | | if (initListener != null) |
| | | initListener.onFinish(); |
| | | } |
| | | |
| | | @Override |
| | | public void fail(int i, String s) { |
| | | if (initListener != null) |
| | | initListener.onFinish(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | 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("SDK_Setting_5211168.json")//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, "SDK_Setting_5211168.json", configBuilder.build()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public interface InitListener { |
| | | public void onFinish(); |
| | | } |
| | | } |
| | |
| | | exitApp("exitApp"),//APP退出广告 |
| | | videoSearch("videoSearch"),//搜索页广告 |
| | | videoDetailFullVideo("videoDetailFullVideo"),//视频全屏广告 |
| | | pptvNoAdReward("pptvNoAdReward")//PPTV无广告激励视频 |
| | | pptvNoAdReward("pptvNoAdReward"),//PPTV无广告激励视频 |
| | | homeInterstitial("homeInterstitial"),//首页插屏 |
| | | exitAppFullvideo("exitAppFullvideo"),//应用退出全屏 |
| | | splashHotStart("splashHotStart") |
| | | ; |
| | | |
| | | private String positionName; |
| | |
| | | private String picture; |
| | | private String comment; |
| | | |
| | | @Expose |
| | | private String tag; |
| | | |
| | | |
| | | public String getPicture() { |
| | | return picture; |
| | | } |
| | |
| | | this.tag = tag; |
| | | } |
| | | |
| | | private String tag; |
| | | } |
| | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.hanju.video.app.entity.common.AdminInfo; |
| | | import com.hanju.video.app.entity.user.Follow; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @Expose |
| | | private boolean canSave;// true-可以 false-不行 |
| | | |
| | | private NativeADDataRef adInfo;// 原生广告信息 |
| | | private NativeExpressADView adView;// 原生广告信息 |
| | | @Expose |
| | | private List<VideoResource> resourceList; |
| | |
| | | |
| | | public void setCommentCount(String commentCount) { |
| | | this.commentCount = commentCount; |
| | | } |
| | | |
| | | public NativeADDataRef getAdInfo() { |
| | | return adInfo; |
| | | } |
| | | |
| | | public void setAdInfo(NativeADDataRef adInfo) { |
| | | this.adInfo = adInfo; |
| | | } |
| | | |
| | | public static long getSerialversionuid() { |
| | |
| | | package com.hanju.video.app.entity.video; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | |
| | | public class ZhiBoContent { |
| | | @Expose |
| | |
| | | @Expose |
| | | private String roomId;// 房间ID |
| | | |
| | | private NativeADDataRef adInfo;// 聚效原生广告信息 |
| | | |
| | | private int watchCount; |
| | | |
| | | public NativeADDataRef getAdInfo() { |
| | | return adInfo; |
| | | } |
| | | |
| | | public void setAdInfo(NativeADDataRef adInfo) { |
| | | this.adInfo = adInfo; |
| | | } |
| | | |
| | | public String getHeadPic() { |
| | | return headPic; |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | if (name != null) |
| | | MobclickAgent.onPageStart(name); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | if (name != null) |
| | | MobclickAgent.onPageEnd(name); |
| | | } |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.ui; |
| | | |
| | | import android.app.Activity; |
| | | import android.graphics.PixelFormat; |
| | | import android.net.http.SslError; |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.webkit.SslErrorHandler; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | |
| | | |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.browser.BaseHanJuJavaInterface; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | public class SimpleBrowserActivity extends FragmentActivity implements OnClickListener { |
| | | private final static String TAG = "SimpleBrowserActivity"; |
| | | |
| | | private TextView tv_top_bar_left; |
| | | private TextView tv_top_bar_left2; |
| | | private TextView tv_top_bar_middle; |
| | | private WebView webview; |
| | | ProgressBar progressBar; |
| | | |
| | | |
| | | private void initX5WebView() { |
| | | webview = findViewById(R.id.webview); |
| | | webview.setWebViewClient(new WebViewClient() { |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | Log.i(TAG, url); |
| | | if (url != null && (!url.startsWith("http"))) { |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { |
| | | sslErrorHandler.proceed(); |
| | | } |
| | | |
| | | }); |
| | | |
| | | webview.setWebChromeClient(new WebChromeClient() { |
| | | |
| | | @Override |
| | | public void onReceivedTitle(WebView view, String title) { |
| | | tv_top_bar_middle.setText(title); |
| | | } |
| | | |
| | | @Override |
| | | public void onProgressChanged(WebView webView, int i) { |
| | | if (i == 100) { |
| | | progressBar.setVisibility(View.GONE); |
| | | } else { |
| | | if (View.INVISIBLE == progressBar.getVisibility()) { |
| | | progressBar.setVisibility(View.VISIBLE); |
| | | } |
| | | progressBar.setProgress(i); |
| | | } |
| | | super.onProgressChanged(webView, i); |
| | | } |
| | | }); |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webview.addJavascriptInterface(new BaseHanJuJavaInterface(this), "yestv"); |
| | | } |
| | | |
| | | private boolean needSetResult = false; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | getWindow().setFormat(PixelFormat.TRANSLUCENT); |
| | | setContentView(R.layout.simple_browser_activity); |
| | | tv_top_bar_left = findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_left2 = findViewById(R.id.tv_top_bar_left2); |
| | | tv_top_bar_left2.setVisibility(View.VISIBLE); |
| | | tv_top_bar_middle = findViewById(R.id.tv_top_bar_middle); |
| | | |
| | | tv_top_bar_left2.setText("关闭"); |
| | | try { |
| | | if (getIntent().getBooleanExtra("close", true)) { |
| | | String close = getIntent().getStringExtra("close"); |
| | | if (!StringUtils.isNullOrEmpty(close)) { |
| | | tv_top_bar_left2.setVisibility(Boolean.parseBoolean(close) ? View.VISIBLE : View.GONE); |
| | | } else |
| | | tv_top_bar_left2.setVisibility(View.VISIBLE); |
| | | } else |
| | | tv_top_bar_left2.setVisibility(View.GONE); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | tv_top_bar_left.setOnClickListener(this); |
| | | tv_top_bar_left2.setOnClickListener(this); |
| | | |
| | | progressBar = findViewById(R.id.myProgressBar); |
| | | progressBar.setMax(100); |
| | | progressBar.setProgressDrawable(this.getResources() |
| | | .getDrawable(R.drawable.color_progressbar)); |
| | | initX5WebView(); |
| | | String url = getIntent().getStringExtra("url"); |
| | | webview.loadUrl(url); |
| | | needSetResult = getIntent().getBooleanExtra("result", false); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | if (webview != null) { |
| | | webview.loadUrl("javascript:onResume()"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | if (webview != null) { |
| | | webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); |
| | | webview.clearHistory(); |
| | | |
| | | ((ViewGroup) webview.getParent()).removeView(webview); |
| | | webview.destroy(); |
| | | webview = null; |
| | | } |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_top_bar_left: { |
| | | if (!webview.canGoBack()) |
| | | finishPage(); |
| | | else { |
| | | webview.goBack(); |
| | | } |
| | | } |
| | | break; |
| | | case R.id.tv_top_bar_left2: { |
| | | finishPage(); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void finishPage() { |
| | | if (needSetResult) |
| | | setResult(Activity.RESULT_OK); |
| | | finish(); |
| | | } |
| | | |
| | | // 设置回退 |
| | | // 覆盖Activity类的onKeyDown(int keyCoder,KeyEvent event)方法 |
| | | @Override |
| | | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| | | if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) { |
| | | webview.goBack(); // goBack()表示返回WebView的上一页面 |
| | | return true; |
| | | } else { |
| | | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| | | finishPage(); |
| | | } |
| | | } |
| | | return super.onKeyDown(keyCode, event); |
| | | } |
| | | } |
| | |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | import static android.content.pm.PackageManager.PERMISSION_DENIED; |
| | | import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
| | | |
| | | public class SplashActivity extends BaseActivity { |
| | | public class SplashActivity extends FragmentActivity { |
| | | |
| | | boolean isInput = false; |
| | | |
| | |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | setContentView(R.layout.activity_splash); |
| | | |
| | | StatusBarUtil.init(this); |
| | | |
| | | vg_ad = findViewById(R.id.fl_splash_ad); |
| | | vg_input = findViewById(R.id.fl_input); |
| | | ad_close_time = findViewById(R.id.ad_close_time); |
| | |
| | | SharedPreferences preferences = getSharedPreferences("link_page", |
| | | Context.MODE_PRIVATE); |
| | | isInput = preferences.getBoolean("isInput", false); |
| | | try { |
| | | TelephonyManager manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); |
| | | Build bd = new Build(); |
| | | String model = Build.MODEL; |
| | | HanJuApplication.deviceName = model; |
| | | HanJuApplication.deviceNumber = manager.getDeviceId(); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | mPermissionsChecker = new PermissionsChecker(this); |
| | | // 初始化大设备 |
| | | SDCardUtil.initStorage(this); |
| | | //初始化一次Banner,否则后面Banner使用时会出现卡顿 |
| | | // new BannerView(SplashActivity.this, ADSize.BANNER, HanJuConstant.GDT_ID, HanJuConstant.GDT_PLAYER_DETAIL); |
| | | |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())) { |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())&&!HanJuConstant.DEBUG) { |
| | | showProtocol(); |
| | | } else { |
| | | vg_ad.post(new Runnable() { |
| | |
| | | |
| | | |
| | | private void showProtocol() { |
| | | String data = "感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | | data += "我们依照新的监管要求条例更新了"; |
| | | String data = "尊敬的用户:<br>感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | | data += "我们非常尊重并保护您的个人信息、隐私。为了更好的保障您的权利,在您使用我们的产品之前,请您务必审慎阅读"; |
| | | data += String.format("<a href='%s'>《隐私政策》</a>和", HanJuConstant.PRIVACY_POLICY); |
| | | data += String.format("<a href='%s'>《用户协议》</a>", HanJuConstant.USER_AGREEMENT); |
| | | data += "为采取相应安全保护措施,尽力保护您的个人信息安全可控,特向你说明如下:<br>" + |
| | | "1、您在使用" + getResources().getString(R.string.app_name) + "各项产品或服务时,将会提供与具体功能相关的个人信息(可能涉及帐号、位置、存储等信息)。<br>" + |
| | | "2、您可以随时查询、更正、删除您的个人信息,我们也提供账户注销的渠道。<br>" + |
| | | "3、未经您的再次同意,我们不会将上述信息用于您未授权的其他用途或目的。<br>" + |
| | | "4、未经监护人同意,我们不会收集使用14周岁以下(含14周岁)未成年人个人信息,且不会利用其信息推送新闻、时政信息、广告等定向推送活动。"; |
| | | data += "内的所有条款,<b>尤其是:<br>" + |
| | | "1、我们对您的个人信息(包括但不限于<font color='#FF0000'>设备MAC地址、IMEI/Android ID</font>等信息)的收集/保存/使用/对外提供/保护等规则条款,以及您的用户权利等条款;<br>" + |
| | | "2、约定我们的限制责任、免责条款;<br>" + |
| | | "3、其他以加粗或斜体字进行标识的重要条款。</b><br>" + |
| | | "如您对协议有任何疑虑,可通过电子邮箱: xcwapp@qq.com 向我们询问,我们将为您竭诚解答。您点击“同意”的行为代表您已阅读完毕并接受以上协议全部条款。如您同意以上协议内容,请您点击“同意”,开始使用您的产品。"; |
| | | |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())) { |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext()) && !HanJuConstant.DEBUG) { |
| | | new UserProtocolDialog.Builder(SplashActivity.this).setNegativeButton("不同意", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | UserUtil.agreeUserProtocol(getApplicationContext()); |
| | | HanJuApplication.init(HanJuApplication.application); |
| | | myRequetPermission(); |
| | | } |
| | | }).setData(data).create().show(); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("欢迎页"); |
| | | } |
| | | |
| | | private void getUid() { |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("欢迎页"); |
| | | } |
| | | |
| | | private String getDay(long time) { |
| | |
| | | }, 2000); |
| | | return; |
| | | } |
| | | |
| | | |
| | | SplashAdUtil.loadAD(splashType, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | @Override |
| | |
| | | }); |
| | | } |
| | | |
| | | int delayMs = 1000; |
| | | |
| | | private void myRequetPermission() { |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | boolean showPermission = sharedPreferences.getBoolean("show", true); |
| | |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PERMISSION_GRANTED && showPermission) { |
| | | ActivityCompat.requestPermissions(this, PERMISSIONS, REQUEST_CODE); |
| | | } else { |
| | | if (!HanJuApplication.inited) { |
| | | HanJuApplication.init(HanJuApplication.application, new HanJuApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | |
| | | } |
| | | }); |
| | | delayMs = 1; |
| | | } |
| | | getUid(); |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | |
| | | AppConfigUtil.saveConcatUsLink(getApplicationContext(), data.optString("contactUsLink")); |
| | | AppConfigUtil.saveUnRegisterLink(getApplicationContext(), data.optString("unRegisterLink")); |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | HanJuApplication.initAd(HanJuApplication.application, gdtAppId, csjAppId, new HanJuApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | loadSplashAd(); |
| | |
| | | |
| | | |
| | | } |
| | | }, 1000); |
| | | }, delayMs); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | Dialog mDialog; |
| | | AlertDialog alertDialog; |
| | | |
| | | @Override |
| | | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
| | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | // if (requestCode == REQUEST_CODE) { |
| | | // myRequetPermission();//由于不知道是否选择了允许所以需要再次判断 |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.viewpagerindicator.MTabPageIndicator; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | 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 com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("专题详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("专题详情页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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 com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("明星详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("明星详情页"); |
| | | } |
| | | |
| | | private void getHotStarDetail() { |
| | |
| | | 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>>() { |
| | |
| | | package com.hanju.video.app.ui.category.bean; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | |
| | | /** |
| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | 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>>() { |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("主界面—分类—明星"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主界面—分类—明星"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.user.Attention; |
| | |
| | | return; |
| | | } |
| | | |
| | | Gson gson = new GsonBuilder() |
| | | .setPrettyPrinting() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<Attention> list = gson.fromJson(jsonObject |
| | | |
| | | List<Attention> list = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<Attention>>() { |
| | | }.getType()); |
| | |
| | | holder = (Holder) view.getTag(); |
| | | } |
| | | if (info != null) { |
| | | if (info.getAdInfo() != null) { |
| | | info.getAdInfo().onExposured(view); |
| | | holder.fl_ad_show.setVisibility(View.VISIBLE); |
| | | } else { |
| | | |
| | | holder.fl_ad_show.setVisibility(View.GONE); |
| | | } |
| | | |
| | | view.findViewById(R.id.ll_live_girl_show).setVisibility( |
| | | View.VISIBLE); |
| | | try { |
| | |
| | | |
| | | @Override |
| | | public void onClick(final View v) { |
| | | if (mInfo.getAdInfo() == null) { |
| | | myClick(mInfo); |
| | | } else { |
| | | if (mInfo.getAdInfo().isAPP() && HanJuConstant.AD_CLICK_DOWNLOAD) { |
| | | DialogInterface.OnClickListener dialogOnclicListener = new DialogInterface.OnClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(DialogInterface dialog, |
| | | int which) { |
| | | switch (which) { |
| | | case Dialog.BUTTON_POSITIVE: |
| | | mInfo.getAdInfo().onClicked(v); |
| | | dialog.dismiss(); |
| | | break; |
| | | case Dialog.BUTTON_NEGATIVE: |
| | | dialog.dismiss(); |
| | | break; |
| | | } |
| | | } |
| | | }; |
| | | AdPromptDialog.Builder builder = new AdPromptDialog.Builder( |
| | | v.getContext()); // 先得到构造器 |
| | | builder.setPositiveButton("确认", dialogOnclicListener); |
| | | builder.setNegativeButton("取消", dialogOnclicListener); |
| | | builder.create().show(); |
| | | } else { |
| | | mInfo.getAdInfo().onClicked(v); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | View.GONE); |
| | | } |
| | | if (info1 != null) { |
| | | if (info1.getAdInfo() != null) { |
| | | info1.getAdInfo().onExposured(view); |
| | | } |
| | | view.findViewById(R.id.ll_live_girl_show2).setVisibility( |
| | | View.VISIBLE); |
| | | try { |
| | |
| | | |
| | | @Override |
| | | public void onClick(final View v) { |
| | | if (mInfo1.getAdInfo() == null) { |
| | | myClick(mInfo1); |
| | | } else { |
| | | if (mInfo1.getAdInfo().isAPP() && HanJuConstant.AD_CLICK_DOWNLOAD) { |
| | | //先new出一个监听器,设置好监听 |
| | | DialogInterface.OnClickListener dialogOnclicListener = new DialogInterface.OnClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(DialogInterface dialog, |
| | | int which) { |
| | | switch (which) { |
| | | case Dialog.BUTTON_POSITIVE: |
| | | mInfo1.getAdInfo().onClicked(v); |
| | | dialog.dismiss(); |
| | | break; |
| | | case Dialog.BUTTON_NEGATIVE: |
| | | dialog.dismiss(); |
| | | break; |
| | | } |
| | | } |
| | | }; |
| | | AdPromptDialog.Builder builder = new AdPromptDialog.Builder( |
| | | v.getContext()); // 先得到构造器 |
| | | builder.setPositiveButton("确认", dialogOnclicListener); |
| | | builder.setNegativeButton("取消", dialogOnclicListener); |
| | | builder.create().show(); |
| | | } else { |
| | | mInfo1.getAdInfo().onClicked(v); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("内部福利页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("内部福利页"); |
| | | } |
| | | |
| | | private void getVideoList() { |
| | |
| | | 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>>() { |
| | |
| | | // @Override |
| | | // public void onResume() { |
| | | // super.onResume(); |
| | | // MobclickAgent.onPageStart("分享页"); |
| | | // if (isShare) { |
| | | // SharedPreferences preferences = ShareActivity.this |
| | | // .getSharedPreferences("user", Context.MODE_PRIVATE); |
| | |
| | | // @Override |
| | | // public void onPause() { |
| | | // super.onPause(); |
| | | // MobclickAgent.onPageEnd("分享页"); |
| | | // } |
| | | // |
| | | // @Override |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.recommend.HomeSpecial; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.UserUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("分类详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("分类详情页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | 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>>() { |
| | |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | iv_download_failure.setVisibility(View.GONE); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | |
| | | |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | |
| | |
| | | else |
| | | adapter.initRecyclerViewDisplayWidthColumn3(rv_category_video); |
| | | } |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | data.getJSONArray("list").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | | }.getType()); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("娱乐直播详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("娱乐直播详情页"); |
| | | } |
| | | |
| | | /** |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.video.app.ui.SimpleBrowserActivity; |
| | | import com.hanju.video.app.util.ui.TextViewUtil; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | final UserProtocolDialog dialog = new UserProtocolDialog(context, R.style.Dialog); |
| | | dialog.setCanceledOnTouchOutside(true); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | final View layout = inflater.inflate(R.layout.dialog_user_protocol, null); |
| | | dialog.addContentView(layout, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | TextView tv_title = layout.findViewById(R.id.tv_title); |
| | | TextView tv_content = layout.findViewById(R.id.tv_content); |
| | | tv_content.setText(TextViewUtil.getClickableHtml(webviewData, context, Color.rgb(23,106,230))); |
| | | tv_content.setText(TextViewUtil.getClickableHtml(webviewData, context, Color.rgb(23,106,230), SimpleBrowserActivity.class)); |
| | | tv_content.setMovementMethod(LinkMovementMethod.getInstance()); |
| | | tv_content.setClickable(false); |
| | | |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.entity.video.ZhiBoContent; |
| | |
| | | if (page == 1) { |
| | | mList.clear(); |
| | | } |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | List<ZhiBoContent> list = gson.fromJson(jsonObject.optJSONObject("Data").optJSONArray("data").toString(), new TypeToken<List<ZhiBoContent>>() { |
| | | |
| | | List<ZhiBoContent> list = JsonUtil.videoGson.fromJson(jsonObject.optJSONObject("Data").optJSONArray("data").toString(), new TypeToken<List<ZhiBoContent>>() { |
| | | }.getType()); |
| | | mList.addAll(list); |
| | | if (mList.size() > 0) |
| | |
| | | if (!StringUtils.isEmpty(getSharedPreferences("user", Context.MODE_PRIVATE).getString("LoginUid", ""))) { |
| | | finish(); |
| | | } |
| | | MobclickAgent.onPageStart("登录页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("登录页"); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StorageUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getCategoriesChannel")); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HomeSpecial> categories = gson.fromJson( |
| | | |
| | | List<HomeSpecial> categories = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<HomeSpecial>>() { |
| | | }.getType()); |
New file |
| | |
| | | package com.hanju.video.app.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.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import androidx.fragment.app.Fragment; |
| | | import androidx.fragment.app.FragmentManager; |
| | | |
| | | /** |
| | | * 主页面--快手视频 |
| | | */ |
| | | public class DYNewsFragment extends MyRetainViewFragment { |
| | | 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() { |
| | | super.onResume(); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onResume(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().onPause(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void setUserVisibleHint(boolean isVisibleToUser) { |
| | | super.setUserVisibleHint(isVisibleToUser); |
| | | if (mIDPWidget != null && mIDPWidget.getFragment() != null) { |
| | | mIDPWidget.getFragment().setUserVisibleHint(isVisibleToUser); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onHiddenChanged(boolean 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.hanju.video.app.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.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.fragment.app.Fragment; |
| | | |
| | | /** |
| | | * 主页面--抖音沉浸式视频流 |
| | | */ |
| | | public class DYVideoFragment extends MyRetainViewFragment { |
| | | 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 com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.recommend.DiscoverVideosAdapter; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("主界面—分类—专题"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主界面—分类—专题"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | |
| | | |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | List<VideoInfo> videoInfos = gson.fromJson( |
| | | List<VideoInfo> videoInfos = JsonUtil.videoGson.fromJson( |
| | | data.getJSONArray("list").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | | }.getType()); |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.video.app.util.HanJuConstant; |
| | | import com.hanju.video.app.util.downutils.StringUtils; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("主界面—猜你喜欢"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主界面—猜你喜欢"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<VideoInfo> list = gson.fromJson( |
| | | |
| | | List<VideoInfo> list = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.annotation.Nullable; |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.entity.video.HomeNav; |
| | | import com.hanju.video.app.ui.mine.DownloadActivity; |
| | | import com.hanju.lib.library.util.cache.DiskLruCache; |
| | | import com.hanju.lib.library.util.common.StorageUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.CSJADConstant; |
| | | import com.hanju.video.app.util.ad.GDTADConstant; |
| | | import com.hanju.video.app.util.ad.IntertitialAdUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.video.youth.util.YouthUtil; |
| | | import com.viewpagerindicator.MainTabPageIndicator; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | private boolean isLogin = false; |
| | | |
| | | SharedPreferences preferences;// |
| | | |
| | | private AQuery mAquery; |
| | | |
| | | public HomeFragment() { |
| | | super(HomeFragment.class.getClass().getName()); |
| | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | getActivity().setTheme(R.style.AppTabThemeMain); |
| | | mAquery = new AQuery(contentView); |
| | | initView(contentView); |
| | | pager = contentView.findViewById(R.id.pager_recomend_category); |
| | | fl_indicator = contentView.findViewById(R.id.fl_indicator); |
| | |
| | | if (cache != null) { |
| | | snapshot = cache.get(getKey("getCategories")); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | List<HomeNav> list = gson.fromJson( |
| | | List<HomeNav> list = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<HomeNav>>() { |
| | | }.getType()); |
| | |
| | | super.onResume(); |
| | | isLogin = !StringUtils.isEmpty(preferences.getString("LoginUid", "")); |
| | | EventBus.getDefault().register(this); |
| | | |
| | | if (YouthUtil.isOpenYouthMode(getContext())) { |
| | | mAquery.id(R.id.ll_top).visibility(View.GONE); |
| | | } else { |
| | | mAquery.id(R.id.ll_top).visibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | |
| | | categories.clear(); |
| | | |
| | | List<HomeNav> list = gson.fromJson( |
| | | List<HomeNav> list = JsonUtil.videoGson.fromJson( |
| | | jsonObject.getJSONObject("Data") |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<HomeNav>>() { |
| | |
| | | try { |
| | | DiskLruCache.Editor editor = cache |
| | | .edit(getKey("getCategories")); |
| | | editor.set(0, gson.toJson(categories)); |
| | | editor.set(0, JsonUtil.videoGson.toJson(categories)); |
| | | editor.commit(); |
| | | } catch (IOException e) { |
| | | } |
| | |
| | | @Override |
| | | public void onFinish() { |
| | | super.onFinish(); |
| | | AdUtil.AD_TYPE adType = AdUtil.getAdType(getContext(), AdPositionEnum.homeInterstitial); |
| | | if (adType != null) { |
| | | //Android 5.0 |
| | | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT_WATCH) { |
| | | adType = AdUtil.AD_TYPE.gdt; |
| | | } |
| | | |
| | | if (adType == AdUtil.AD_TYPE.csj) { |
| | | IntertitialAdUtil.showAd(getActivity(), adType, CSJADConstant.HOME_INTERSTITIALAD); |
| | | } else { |
| | | IntertitialAdUtil.showAd(getActivity(), adType, GDTADConstant.HOME_INTERSTITIALAD); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | } |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | Gson gson = new GsonBuilder() |
| | | .create(); |
| | | List<String> hotSearchs = gson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.lib.library.util.FragmentSwitchHelper; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.CSJADConstant; |
| | | import com.hanju.video.app.util.ad.FullVideoAdManager; |
| | | import com.hanju.video.app.util.ad.GDTADConstant; |
| | | import com.hanju.video.app.util.ad.IntertitialAdUtil; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.BaseActivity; |
| | |
| | | import com.hanju.video.app.util.ui.ExitDialog; |
| | | import com.hanju.video.app.util.ui.StatusBarUtil; |
| | | import com.hanju.update.appupdate.AppUpdate; |
| | | import com.video.youth.util.YouthUtil; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | |
| | | Context.MODE_PRIVATE); |
| | | StatusBarUtil.init(this); |
| | | |
| | | initialer.run(); |
| | | // initialer.run(); |
| | | |
| | | mFragmentSwitchHelper = FragmentSwitchHelper.create( |
| | | R.id.fl_main_fragment_container, getSupportFragmentManager(), |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | findViewById(R.id.rb_nav_discover).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.GONE); |
| | | } else { |
| | | findViewById(R.id.rb_nav_discover).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | ExitDialog exitDialog = null; |
| | | ExitDialog.Builder exitDialogBuilder = null; |
| | | |
| | | boolean showFullAd = false; |
| | | |
| | | @Override |
| | | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| | | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| | | |
| | | //exit |
| | | AdUtil.AD_TYPE 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 = AdUtil.AD_TYPE.gdt; |
| | | } |
| | | |
| | | |
| | | if (adType == AdUtil.AD_TYPE.csj) { |
| | | FullVideoAdManager.getInstance().loadAd(MainActivity.this, AdUtil.AD_TYPE.csj, CSJADConstant.APP_EXIT_FULL_VIDEO, 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, AdUtil.AD_TYPE.gdt, GDTADConstant.APP_EXIT_FULL_VIDEO, 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 { |
| | | if (exitDialog != null) { |
| | | exitDialogBuilder.showAd(); |
| | | exitDialog.show(); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return super.onKeyDown(keyCode, event); |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | 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.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.database.HanJuSQLiteOpenHelper; |
| | |
| | | import com.hanju.video.app.ui.mine.WatchHistoryActivity; |
| | | import com.hanju.video.app.ui.recommend.SearchActivity; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | import com.video.youth.ui.YouthActivity; |
| | | import com.video.youth.util.YouthUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | |
| | | private RecyclerView rv_watch_history; |
| | | |
| | | private AQuery mAquery; |
| | | |
| | | List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> historyList = new ArrayList<>(); |
| | | |
| | | public static MineFragment newInstance() { |
| | |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | |
| | | mAquery = new AQuery(contentView); |
| | | tv_no_network = contentView.findViewById(R.id.tv_no_network); |
| | | rv_watch_history = contentView.findViewById(R.id.rv_watch_history); |
| | | tv_no_network.setOnClickListener(this); |
| | |
| | | contentView.findViewById(R.id.ll_mine_follow).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_mine_save).setOnClickListener(this); |
| | | contentView.findViewById(R.id.tv_mine_watch_history).setOnClickListener(this); |
| | | contentView.findViewById(R.id.ll_youth).setOnClickListener(this); |
| | | |
| | | |
| | | tv_mine_favourite = contentView.findViewById(R.id.tv_mine_favourite); |
| | | tv_mine_follow = contentView.findViewById(R.id.tv_mine_follow); |
| | |
| | | break; |
| | | case R.id.ll_mine_advice://建议 |
| | | startActivity(new Intent(getContext(), BrowserActivity.class).putExtra("title", "意见反馈").putExtra("url", "https://support.qq.com/embed/phone/343178/new-post/")); |
| | | break; |
| | | |
| | | case R.id.ll_youth://青少年模式 |
| | | startActivity(new Intent(getContext(), YouthActivity.class)); |
| | | break; |
| | | } |
| | | } |
| | |
| | | initLoginInfo(); |
| | | } |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("主页面—我的"); |
| | | |
| | | historyList.clear(); |
| | | List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> list = new ArrayList<>(); |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | if (YouthUtil.isOpenYouthMode(getContext())) { |
| | | mAquery.id(R.id.ll_video_mine).visibility(View.GONE); |
| | | mAquery.id(R.id.fl_history).visibility(View.GONE); |
| | | mAquery.id(R.id.rv_watch_history).visibility(View.GONE); |
| | | } else { |
| | | mAquery.id(R.id.ll_video_mine).visibility(View.VISIBLE); |
| | | mAquery.id(R.id.fl_history).visibility(View.VISIBLE); |
| | | mAquery.id(R.id.rv_watch_history).visibility(View.VISIBLE); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void getUserVideoDataCount() { |
| | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("主页面—我的"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | private List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> getWatchHistory() throws Exception { |
| | | List<WatchHistoryMineAdapter.MineWatchHistoryVideoInfo> videoInfoList = new ArrayList<>(); |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | |
| | | SQLiteDatabase database = new HanJuSQLiteOpenHelper(getContext()).getReadableDatabase(); |
| | | Cursor cursor = database.query(WatchHistoryTable.TABLE_NAME, new String[]{WatchHistoryTable._ID, WatchHistoryTable.VIDEO_ID, WatchHistoryTable.VIDEO_DETAIL_ID, WatchHistoryTable.VIDEO_DETAIL}, null, null, null, null, WatchHistoryTable.UPDATE_TIME + " DESC"); |
| | | cursor.moveToFirst(); |
| | |
| | | .getColumnIndex(WatchHistoryTable.VIDEO_DETAIL_ID)); |
| | | String videoInfoStr = cursor.getString(cursor |
| | | .getColumnIndexOrThrow(WatchHistoryTable.VIDEO_DETAIL)); |
| | | VideoInfo videoInfo = gson.fromJson(videoInfoStr, new TypeToken<VideoInfo>() { |
| | | VideoInfo videoInfo = JsonUtil.videoGson.fromJson(videoInfoStr, new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | String[] types = new String[]{"150", "151", "152", "153"}; |
| | | if (videoInfo.getVideoType() != null && Arrays.asList(types).contains(videoInfo.getVideoType().getId())) { |
New file |
| | |
| | | package com.hanju.video.app.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.hanju.video.app.R; |
| | | import com.hanju.video.app.ui.MyRetainViewFragment; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.fragment.app.FragmentManager; |
| | | |
| | | /** |
| | | * 小说 |
| | | */ |
| | | public class NovelFragment extends MyRetainViewFragment implements |
| | | OnClickListener { |
| | | private static final String TAG = "NovelFragment"; |
| | | private FragmentManager fragmentManager; |
| | | |
| | | 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.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.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(), |
| | |
| | | Play play = new Play(); |
| | | play.setPlayUrl(info); |
| | | EventBus.getDefault().post(play); |
| | | }else{ |
| | | Toast.makeText(getContext(), jsonObject.optString("Error"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 加载播放页第一条广告,先设置加载上下文环境和条件 |
| | | private void loadAD1() { |
| | | new ExpressAdManager(AdUtil.AD_TYPE.gdt2, getContext()).loadVideoDetailPlayerBottomAd(new ExpressAdManager.IAdLoadListener() { |
| | | ExpressAdManager expressAdManager = null; |
| | | try { |
| | | expressAdManager = new ExpressAdManager(AdUtil.AD_TYPE.gdt2, getContext()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (expressAdManager == null) |
| | | return; |
| | | |
| | | expressAdManager.loadVideoDetailPlayerBottomAd(new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) { |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | final List<VideoInfo> videoInfos = gson.fromJson( |
| | | |
| | | final 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>>() { |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | webview.reload(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestBuilder; |
| | | import com.bumptech.glide.load.model.GlideUrl; |
| | | import com.bumptech.glide.load.model.Headers; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.ui.video.PPTVPlayFragment; |
| | | import com.hanju.video.app.ui.video.VideoPlayerFragment; |
| | | import com.hanju.video.app.ui.video.parser.VideoPlayUrlParseFragment; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.ad.GDTADConstant; |
| | | import com.hanju.video.app.util.ad.IntertitialAdUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | 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.umeng.socialize.ShareAction; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.umeng.socialize.UMShareListener; |
| | |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | |
| | | resourceId = bundle.getString("ResourceId"); |
| | | detailid = bundle.getString("DetailId"); |
| | | } |
| | | //TODO 测试 |
| | | videoInfo.setId("8457562"); |
| | | if (!StringUtils.isNumeric(videoInfo.getId())) { |
| | | iv_favourite.setVisibility(View.GONE); |
| | | } else { |
| | |
| | | AdUtil.AD_TYPE adType = AdUtil.getAdType(getApplicationContext(), AdPositionEnum.videoDetailFullVideo); |
| | | if (adType != null) { |
| | | String pid = AdUtil.getAdPid(getApplicationContext(), AdPositionEnum.videoDetailFullVideo); |
| | | if (TTAdSdk.isInitSuccess() && adType == AdUtil.AD_TYPE.csj) { |
| | | try { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), pid, new FullVideoAdManager.IFullVideoAdListener() { |
| | | FullVideoAdManager.getInstance().loadAd(VideoDetailActivity.this, AdUtil.AD_TYPE.csj, pid, new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess() { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity.this); |
| | | public void onFail(String msg) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | |
| | | } |
| | | |
| | | }); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } else { |
| | | FullVideoAdManager.getInstance().loadAd(VideoDetailActivity.this, AdUtil.AD_TYPE.gdt, GDTADConstant.PID_VIDEO_DETAIL_INSERT, new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onFail(String msg) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFinish() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | private void clickPlay() { |
| | | if (playUrl == null) { |
| | | SingleToast.showToast(VideoDetailActivity.this, "初始化播放路径中,请稍候点击播放!"); |
| | | return; |
| | | } |
| | | |
| | |
| | | String tempUrl = playUrl.getUrl(); |
| | | |
| | | List<VideoPlayUrlParseFragment.ParseParams> parseParams = new ArrayList<>(); |
| | | String js = "function parseResult(url, data) {console.log(data); try {var result =JSON.parse( data);if (result.code == 200) {return result.url.replace('/\"/g', '');}} catch (e) {if (url.indexOf('.m3u8') > -1) { return url;}}return null;};"; |
| | | String js = "function parseResult(url, data) {console.log(data); try {var result =JSON.parse( data);if (result.code == 200) {return result.url.replace('/\"/g', '');}} catch (e) {if (url.indexOf('.m3u8') > -1) { " + |
| | | "return url;"+ |
| | | "}}return null;};"; |
| | | |
| | | |
| | | parseParams.add(new VideoPlayUrlParseFragment.ParseParams("^(https://){1}.*(\\.m3u8)$", js, false)); |
| | | |
| | | parseParams.add(new VideoPlayUrlParseFragment.ParseParams("^(https://jx\\.bolecdn\\.com/index2\\.php\\?url=){1}.*", js, false)); |
| | | |
| | | parseParams.add(new VideoPlayUrlParseFragment.ParseParams("^(https://chaoren\\.sc2yun\\.com/superman\\.php)", js, true)); |
| | | videoPlayUrlParseFragment.startParse(tempUrl, parseParams, new VideoPlayUrlParseFragment.IVideoParseListener() { |
| | |
| | | update(); |
| | | } |
| | | |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | final VideoInfo videoInfo = gson |
| | | .fromJson(jsonObject.getJSONObject("Data") |
| | | .toString(), |
| | | //判断PPTV, |
| | | JSONObject data = jsonObject.optJSONObject("Data"); |
| | | boolean pptv = data.optBoolean("pptv", false); |
| | | |
| | | if (pptv) { |
| | | String playUrl = data.optString("playUrl"); |
| | | mAquery.id(R.id.fl_pptv).visibility(View.VISIBLE); |
| | | mAquery.id(R.id.rl_page).visibility(View.GONE); |
| | | |
| | | |
| | | PPTVPlayFragment pptvPlayFragment = new PPTVPlayFragment(); |
| | | Bundle bundle = new Bundle(); |
| | | bundle.putString("playUrl", playUrl); |
| | | bundle.putString("videoId", data.optString("videoId")); |
| | | bundle.putString("name", data.optString("name")); |
| | | bundle.putBoolean("vip", data.optBoolean("vip", false)); |
| | | pptvPlayFragment.setArguments(bundle); |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fl_pptv, pptvPlayFragment).commit(); |
| | | if (progressDialog.isShowing()) { |
| | | progressDialog.dismiss(); |
| | | } |
| | | return; |
| | | } else { |
| | | mAquery.id(R.id.fl_pptv).visibility(View.GONE); |
| | | mAquery.id(R.id.rl_page).visibility(View.VISIBLE); |
| | | } |
| | | |
| | | |
| | | |
| | | final VideoInfo videoInfo = JsonUtil.videoGson |
| | | .fromJson(data.toString(), |
| | | new TypeToken<VideoInfo>() { |
| | | }.getType()); |
| | | |
| | |
| | | |
| | | initResource(); |
| | | |
| | | if (StringUtils.isEmpty(videoInfo.getPlayPicture())) { |
| | | Glide.with(getApplicationContext()) |
| | | .load(videoInfo.getPicture()).apply(new RequestOptions().centerCrop()).into(target); |
| | | } else { |
| | | Glide.with(getApplicationContext()) |
| | | .load(videoInfo.getPlayPicture()).apply(new RequestOptions().centerCrop()).into(target); |
| | | String playPicture = videoInfo.getPlayPicture(); |
| | | if (StringUtils.isEmpty(playPicture)) { |
| | | playPicture = videoInfo.getPicture(); |
| | | } |
| | | |
| | | RequestBuilder<Drawable> requestBuilder = null; |
| | | GlideUrl glideUrl = new GlideUrl(playPicture, new Headers() { |
| | | @Override |
| | | public Map<String, String> getHeaders() { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("Referer", "https://www.hmtv.me/"); |
| | | map.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14 Safari/602.1"); |
| | | return map; |
| | | } |
| | | }); |
| | | |
| | | if (playPicture != null && playPicture.contains("hmtv.me")) { |
| | | requestBuilder = Glide.with(getApplicationContext()).load(glideUrl); |
| | | } else { |
| | | requestBuilder = Glide.with(getApplicationContext()).load(playPicture); |
| | | } |
| | | |
| | | requestBuilder.apply(new RequestOptions().centerCrop()).into(target); |
| | | |
| | | |
| | | if (isSetup) { |
| | | int position = getIntent().getIntExtra( |
| | | "playing_position", 0); |
| | |
| | | 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(), |
| | |
| | | startPlay(); |
| | | isClick = false; |
| | | } |
| | | } else { |
| | | Toast.makeText(getApplicationContext(), jsonObject.optString("Error"), Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | }); |
| | |
| | | } |
| | | break; |
| | | case R.id.tv_resource: |
| | | if (popupWindow == null) |
| | | return; |
| | | if (popupWindow.isShowing()) { |
| | | // bug:listview 中的isShowing()可以正确获取而到了这里就一直不进入,原因是pop没设置焦点获取 |
| | | popupWindow.dismiss(); |
| | |
| | | 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)); |
| | | JsonUtil.videoGson.toJson(videoInfo)); |
| | | values.put(WatchHistoryTable.WATCH_TIME, 0); |
| | | values.put(WatchHistoryTable.VIDEO_RESOURCE, from); |
| | | values.put(WatchHistoryTable.VIDEO_RESOURCE_ID, resoureID); |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | EventBus.getDefault().register(this); |
| | | MobclickAgent.onPageStart("播放详情页—小屏播放"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | EventBus.getDefault().unregister(this); |
| | | MobclickAgent.onPageEnd("播放详情页——小屏播放"); |
| | | } |
| | | |
| | | List<VideoResource> urlList; |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | EventBus.getDefault().register(this); |
| | | MobclickAgent.onPageStart("播放详情—选集"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | EventBus.getDefault().unregister(this); |
| | | isShowMore = false; |
| | | page_varietyshow = 0; |
| | | MobclickAgent.onPageEnd("播放详情—选集"); |
| | | } |
| | | |
| | | public void onEventMainThread(VideoInfo info) { |
| | |
| | | */ |
| | | // 加载播放页第二条广告 |
| | | private void loadAD2() { |
| | | new ExpressAdManager(AdUtil.AD_TYPE.gdt2, getContext()).loadVideoDetailRelativeVideoBottomAd(new ExpressAdManager.IAdLoadListener() { |
| | | ExpressAdManager expressAdManager = null; |
| | | try { |
| | | expressAdManager = new ExpressAdManager(AdUtil.AD_TYPE.gdt2, getContext()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (expressAdManager == null) |
| | | return; |
| | | |
| | | expressAdManager.loadVideoDetailRelativeVideoBottomAd(new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | // webview.reload(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("帮助与反馈"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("帮助与反馈"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.hanju.lib.library.util.RefreshLayout; |
| | | import com.hanju.lib.library.util.SingleToast; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("收藏页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("收藏页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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>>() { |
| | |
| | | } else { |
| | | mBadge.hide(); |
| | | } |
| | | MobclickAgent.onPageStart("设置页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("设置页"); |
| | | AppUpdate.destoryAppUpdate(); |
| | | } |
| | | |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | // EventBus.getDefault().register(this); |
| | | MobclickAgent.onPageStart("我的消息"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | // EventBus.getDefault().unregister(this); |
| | | MobclickAgent.onPageEnd("我的消息"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("电视剧多集下载"); |
| | | Cursor cursor = getActivity().getContentResolver().query( |
| | | DownloadTable.CONTENT_URI, null, |
| | | DownloadTable.VIDEO_ID + " = ? ", |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.util.common.ConnectionUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.mozillaonline.providers.downloads.Downloads; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | |
| | | } 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.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.util.common.ConnectionUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.hanju.video.app.R; |
| | | import com.nostra13.universalimageloader.core.DisplayImageOptions; |
| | |
| | | } 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) { |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主页面——最近——缓存"); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("主页面——最近——缓存"); |
| | | mDownLoadAdapter.setSelectedMode(false); |
| | | } |
| | | |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.mozillaonline.providers.DownloadManager; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.database.DownloadTable; |
| | |
| | | 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)) { |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mAdapter.setSelectedMode(false); |
| | | MobclickAgent.onPageStart("主页面——最近——观看记录"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主页面——最近——观看记录"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | | import com.hanju.video.app.R; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder() |
| | | .setPrettyPrinting() |
| | | .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<CategoryRecommendVideo> list = gson.fromJson(jsonObject |
| | | |
| | | List<CategoryRecommendVideo> list = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<CategoryRecommendVideo>>() { |
| | | }.getType()); |
| | |
| | | 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 android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestBuilder; |
| | | import com.bumptech.glide.RequestManager; |
| | | import com.bumptech.glide.load.model.GlideUrl; |
| | | import com.bumptech.glide.load.model.Headers; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | |
| | | viewHolder.fl_ad.addView(bean.getAdView()); |
| | | } else { |
| | | viewHolder.rl_discover.setRatio(0.579f); |
| | | try { |
| | | glide.load(bean.getPicture()).placeholder(R.color.theme).error(R.color.theme).transition(withCrossFade()).into(viewHolder.iv_pic); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | RequestBuilder<Drawable> requestBuilder = null; |
| | | GlideUrl glideUrl = new GlideUrl(bean.getPicture(), new Headers() { |
| | | @Override |
| | | public Map<String, String> getHeaders() { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("Referer", "https://www.hmtv.me/"); |
| | | map.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14 Safari/602.1"); |
| | | return map; |
| | | } |
| | | }); |
| | | |
| | | if (bean.getPicture() != null && bean.getPicture().contains("hmtv.me")) { |
| | | requestBuilder = Glide.with(context).load(glideUrl); |
| | | } else { |
| | | requestBuilder = Glide.with(context).load(bean.getPicture()); |
| | | } |
| | | requestBuilder.apply(new RequestOptions().centerCrop()).into(viewHolder.iv_pic); |
| | | |
| | | |
| | | viewHolder.tv_name.setText(bean.getName()); |
| | | if (watchCountMap.get(bean.getId()) == null) { |
| | | watchCountMap.put(bean.getId(), (int) (Math.random() * 1000)); |
| | |
| | | likeCountMap.put(id, likeCountMap.get(id) - 1); |
| | | } |
| | | viewHolder.cb_like_count.setText(likeCountMap.get(bean.getId() + "") + ""); |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | toUniqueActivity(bean, convertView); |
| | | |
| | |
| | | import com.hanju.video.app.ui.common.VideosLiveActivity; |
| | | import com.hanju.video.app.ui.discover.StarsActivity; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.common.AppMarket; |
| | | import com.hanju.video.app.util.ui.GlideCircleTransform; |
| | | import com.hanju.video.app.util.downutils.ApkUtil; |
| | |
| | | // "com.hanju.video.app.ui.common.MVideosActivity")) {//去好评 |
| | | // mateAppMarket(mHomeType); |
| | | // } else { |
| | | Gson gson = new GsonBuilder() |
| | | .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | VideoType type = gson.fromJson(mHomeType.getParams().replace( |
| | | |
| | | VideoType type = JsonUtil.videoGson.fromJson(mHomeType.getParams().replace( |
| | | "\\" + "\"", "\""), VideoType.class); |
| | | try { |
| | | intent = new Intent(v.getContext(), Class.forName(mHomeType.getActivity())); |
| | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | |
| | | import com.hanju.lib.library.util.common.StorageUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.widget.RatioLayout; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.lzj.gallery.library.views.BannerViewPager; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.umeng.analytics.MobclickAgent; |
| | |
| | | import com.hanju.video.app.util.ui.GlideUtil; |
| | | import com.hanju.update.appupdate.GoReview; |
| | | import com.hanju.update.appupdate.service.DownLoadFileService; |
| | | import com.video.youth.entity.YouthModeChange; |
| | | import com.video.youth.util.YouthUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | |
| | | |
| | | private Set<String> emptyHomeTypes = new HashSet<>(); |
| | | |
| | | private SwipeRefreshLayout.OnRefreshListener refreshListener = new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | if (position == 0) { |
| | | getHotStars(); |
| | | } |
| | | page = 1; |
| | | //加载广告 |
| | | loadAd(); |
| | | getHomeAd(); |
| | | getRecommendSearchSpecial(); |
| | | Log.i("mResult", "onCreate---setOnRefreshListener---loadAD1"); |
| | | } |
| | | }; |
| | | |
| | | public static Fragment newInstance(HomeNav type, String position) { |
| | | if (Integer.parseInt(position) < 2) { |
| | | RecommendFragment fragment = new RecommendFragment(); |
| | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | EventBus.getDefault().register(this); |
| | | context = getActivity().getApplicationContext(); |
| | | try { |
| | | cache = DiskLruCache.open( |
| | |
| | | mHomeAds = new ArrayList<>(); |
| | | mHomeSpecials = new ArrayList<>(); |
| | | |
| | | rl_recommend.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | if (position == 0) { |
| | | getHotStars(); |
| | | } |
| | | page = 1; |
| | | //加载广告 |
| | | loadAd(); |
| | | getHomeAd(); |
| | | getRecommendSearchSpecial(); |
| | | Log.i("mResult", "onCreate---setOnRefreshListener---loadAD1"); |
| | | } |
| | | }); |
| | | rl_recommend.setOnRefreshListener(refreshListener); |
| | | |
| | | if (mHomeTypes == null) |
| | | mHomeTypes = new ArrayList(); |
| | |
| | | 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()); |
| | |
| | | try { |
| | | snapshot = cache.get(getKey("getRecommendSearchSpecial") + type.getId()); |
| | | if (snapshot != null) { |
| | | Gson gson = new GsonBuilder().setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE).create(); |
| | | List<HomeSpecial> homeSpecials = gson.fromJson( |
| | | |
| | | List<HomeSpecial> homeSpecials = JsonUtil.videoGson.fromJson( |
| | | snapshot.getString(0), |
| | | new TypeToken<List<HomeSpecial>>() { |
| | | }.getType()); |
| | |
| | | return new Md5FileNameGenerator().generate(method); |
| | | } |
| | | |
| | | |
| | | private static boolean needRefresh = false; |
| | | |
| | | public void onEventMainThread(YouthModeChange youth) { |
| | | needRefresh = true; |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("主页面—推荐"); |
| | | if (needRefresh) { |
| | | needRefresh = false; |
| | | if (refreshListener != null) { |
| | | rl_recommend.setRefreshing(true); |
| | | refreshListener.onRefresh(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("主页面—推荐"); |
| | | } |
| | | |
| | | private String content; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder() |
| | | .setPrettyPrinting() |
| | | .setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | List<HomeAd> homeAds = gson.fromJson(jsonObject |
| | | |
| | | List<HomeAd> homeAds = JsonUtil.videoGson.fromJson(jsonObject |
| | | .getJSONObject("Data").getJSONArray("data") |
| | | .toString(), new TypeToken<List<HomeAd>>() { |
| | | }.getType()); |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | Gson gson = new GsonBuilder().setVersion(1.0).setFieldNamingPolicy( |
| | | FieldNamingPolicy.UPPER_CAMEL_CASE) |
| | | .create(); |
| | | |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | totalCount = data.optInt("count"); |
| | | List<HomeType> homeTypes = new ArrayList<>(); |
| | |
| | | List<HomeVideo> homeList = new ArrayList<HomeVideo>(); |
| | | 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)); |
| | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | |
| | | private List<HomeVideo> adList1 = new ArrayList<>(); |
| | |
| | | throws Exception { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | hotStars.clear(); |
| | | 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 com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.ui.video.VideoAlbumAdapter; |
| | | import com.hanju.video.app.ui.video.VideoColumn2Adapter; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.video.VideoUtil; |
| | |
| | | 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())); |
| | |
| | | |
| | | |
| | | if (needAd) { |
| | | if (expressAdManager == null) |
| | | if (expressAdManager == null) { |
| | | try { |
| | | expressAdManager = new ExpressAdManager(AdUtil.getSmallExpressAdType(), mContext); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (expressAdManager != null) |
| | | |
| | | expressAdManager.loadRecommendSmallAd(new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.util.Log; |
| | | import android.view.KeyEvent; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.common.AppConfigUtil; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | |
| | | import java.util.List; |
| | | |
| | | public class SearchActivity extends BaseActivity implements OnClickListener { |
| | | |
| | | private final String TAG = SearchActivity.class.getSimpleName(); |
| | | |
| | | private AutoCompleteTextView et_search_key; |
| | | |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | getHistorySearch(); |
| | | MobclickAgent.onPageStart("搜索页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("搜索页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return; |
| | | } |
| | | |
| | | String pid = AdUtil.getAdPid(getApplicationContext(), AdPositionEnum.videoSearch); |
| | | if (com.hanju.video.app.util.downutils.StringUtils.isNullOrEmpty(pid)) { |
| | | return; |
| | | } |
| | | |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(SearchActivity.this, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | appId, HanJuConstant.GDT_SEARCH_NATIVE, new NativeExpressAD.NativeExpressADListener() { |
| | | appId, pid, new NativeExpressAD.NativeExpressADListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | runOnUiThread(new Runnable() { |
| | |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | Log.i(TAG, adError.toString()); |
| | | } |
| | | }); // 传入Activity |
| | | // 注意:如果您在联盟平台上新建原生模板广告位时,选择了支持视频,那么可以进行个性化设置(可选) |
| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hanju.lib.library.util.common.SoftKeyboardUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.util.JsonUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.hanju.video.app.util.http.BasicTextHttpResponseHandler; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | Header[] headers, JSONObject jsonObject) |
| | | 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>>() { |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("搜索结果页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("搜索结果页"); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.hanju.video.app.ui.video; |
| | | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.ActivityInfo; |
| | | import android.net.Uri; |
| | | import android.net.http.SslError; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.view.WindowManager; |
| | | import android.webkit.ConsoleMessage; |
| | | import android.webkit.SslErrorHandler; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.bytedance.sdk.openadsdk.AdSlot; |
| | | import com.bytedance.sdk.openadsdk.TTAdConstant; |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.google.gson.Gson; |
| | | import com.hanju.lib.library.RetainViewFragment; |
| | | import com.hanju.lib.library.util.common.ClipboardUtil; |
| | | import com.hanju.video.app.HanJuApplication; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.util.browser.PPHanJuJavaInterface; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | public class PPTVPlayFragment extends RetainViewFragment implements OnClickListener { |
| | | private final static int REQUEST_CODE_LOGIN = 1001; |
| | | |
| | | private final static int REQUEST_CODE_VIP = 1002; |
| | | |
| | | private int code = -1; |
| | | |
| | | |
| | | private final static String TAG = PPTVPlayFragment.class.getSimpleName(); |
| | | |
| | | private TextView tv_top_bar_left; |
| | | private WebView webview; |
| | | FrameLayout fl_ad; |
| | | FrameLayout fl_container; |
| | | private LinearLayout ll_top; |
| | | private TextView tv_title, tv_url; |
| | | |
| | | private boolean showAd = true; |
| | | |
| | | |
| | | private AQuery query; |
| | | |
| | | |
| | | private String[] getPPVideoInfo(String url) { |
| | | if (url.contains("cid=") && url.contains("vid=")) { |
| | | String[] sts = url.split("\\?"); |
| | | if (sts.length > 1) { |
| | | String params = sts[1]; |
| | | String[] ps = params.split("&"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | for (String p : ps) { |
| | | map.put(p.split("=")[0], p.split("=").length > 1 ? p.split("=")[1] : ""); |
| | | } |
| | | String cid = map.get("cid"); |
| | | String vid = map.get("vid"); |
| | | |
| | | return new String[]{cid, vid}; |
| | | |
| | | |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void initWebView(View view) { |
| | | fl_ad = view.findViewById(R.id.fl_ad); |
| | | webview = view.findViewById(R.id.webview); |
| | | webview.setWebViewClient(new WebViewClient() { |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | Log.i(TAG, "shouldOverrideUrlLoading:" + url); |
| | | if (url != null && (!url.startsWith("http"))) { |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onPageFinished(WebView webView, String s) { |
| | | super.onPageFinished(webView, s); |
| | | if (showAd) |
| | | playAd(); |
| | | else { |
| | | showAd = true; |
| | | adPlayFinish(); |
| | | } |
| | | String js = ""; |
| | | js += "function getQueryString(name) {\n" + |
| | | "\t\tvar reg = new RegExp(\"(^|&)\" + name + \"=([^&]*)(&|$)\", \"i\");\n" + |
| | | "\t\tvar r = window.location.search.substr(1).match(reg);\n" + |
| | | "\t\tif (r != null) return unescape(r[2]);\n" + |
| | | "\t\treturn null;\n" + |
| | | "\t}"; |
| | | |
| | | |
| | | js += "var getPlayInfo = function() {var video = document.querySelector(\"video\"); ppyestv.stopPlay(getQueryString('cid'),getQueryString('vid'),parseInt( video.currentTime)); };"; |
| | | js += "window.onbeforeunload =getPlayInfo;"; |
| | | webView.loadUrl("javascript:" + js); |
| | | } |
| | | |
| | | @Override |
| | | public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { |
| | | sslErrorHandler.proceed(); |
| | | } |
| | | }); |
| | | |
| | | webview.setWebChromeClient(new WebChromeClient() { |
| | | |
| | | View myVideoView; |
| | | View myNormalView; |
| | | CustomViewCallback callback; |
| | | |
| | | @Override |
| | | public boolean onConsoleMessage(ConsoleMessage consoleMessage) { |
| | | Log.i(TAG, consoleMessage.message()); |
| | | return super.onConsoleMessage(consoleMessage); |
| | | } |
| | | |
| | | @Override |
| | | public void onReceivedTitle(WebView view, String title) { |
| | | super.onReceivedTitle(view, title); |
| | | tv_url.setText(view.getUrl()); |
| | | // tv_title.setText(title); |
| | | } |
| | | |
| | | /** |
| | | * 全屏播放配置 |
| | | */ |
| | | @Override |
| | | public void onShowCustomView(View view, |
| | | CustomViewCallback customViewCallback) { |
| | | View normalView = fl_container; |
| | | ViewGroup viewGroup = (ViewGroup) normalView.getParent(); |
| | | viewGroup.removeView(normalView); |
| | | viewGroup.addView(view); |
| | | myVideoView = view; |
| | | myNormalView = normalView; |
| | | callback = customViewCallback; |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
| | | WindowManager.LayoutParams attrs = getActivity().getWindow().getAttributes(); |
| | | attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | getActivity().getWindow().setAttributes(attrs); |
| | | ll_top.setVisibility(View.GONE); |
| | | query.id(R.id.tv_top_bar_left1).visibility(View.VISIBLE); |
| | | } |
| | | |
| | | @Override |
| | | public void onHideCustomView() { |
| | | if (callback != null) { |
| | | callback.onCustomViewHidden(); |
| | | callback = null; |
| | | } |
| | | if (myVideoView != null) { |
| | | ViewGroup viewGroup = (ViewGroup) myVideoView.getParent(); |
| | | viewGroup.removeView(myVideoView); |
| | | viewGroup.addView(myNormalView); |
| | | } |
| | | // ll_bottom.setVisibility(View.VISIBLE); |
| | | ll_top.setVisibility(View.VISIBLE); |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | WindowManager.LayoutParams attrs = getActivity().getWindow().getAttributes(); |
| | | attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | getActivity().getWindow().setAttributes(attrs); |
| | | query.id(R.id.tv_top_bar_left1).visibility(View.GONE); |
| | | } |
| | | }); |
| | | initWebSetting(); |
| | | //开启硬件加速 |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { |
| | | webview.setLayerType(View.LAYER_TYPE_HARDWARE, null); |
| | | } |
| | | |
| | | |
| | | webview.addJavascriptInterface(new PPHanJuJavaInterface(HanJuApplication.application, new PPHanJuJavaInterface.IEventListener() { |
| | | @Override |
| | | public void onLogin() { |
| | | if (getActivity() != null) |
| | | getActivity().runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | // code = REQUEST_CODE_LOGIN; |
| | | // Intent intent = new Intent(getContext(), LoginActivity.class); |
| | | // intent.putExtra("result", true); |
| | | // startActivityForResult(intent, REQUEST_CODE_LOGIN); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onTryPlayFinish() { |
| | | Log.i(TAG, "onTryPlayFinish"); |
| | | if (getActivity() != null) |
| | | getActivity().runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onPlayFinish() { |
| | | if (getActivity() != null) |
| | | getActivity().runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }), "ppyestv"); |
| | | } |
| | | |
| | | private void initWebSetting() { |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webSetting.setBlockNetworkImage(false); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setJavaScriptCanOpenWindowsAutomatically(true); |
| | | webSetting.setAllowFileAccess(true); |
| | | webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); |
| | | webSetting.setSupportZoom(false); |
| | | webSetting.setBuiltInZoomControls(true); |
| | | webSetting.setUseWideViewPort(true); |
| | | webSetting.setSupportMultipleWindows(true); |
| | | webSetting.setLoadWithOverviewMode(true); |
| | | webSetting.setAppCacheEnabled(true); |
| | | webSetting.setDatabaseEnabled(true); |
| | | webSetting.setDomStorageEnabled(true); |
| | | webSetting.setGeolocationEnabled(true); |
| | | webSetting.setAppCacheMaxSize(Long.MAX_VALUE); |
| | | webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND); |
| | | webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); |
| | | } |
| | | } |
| | | |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | |
| | | return super.onCreateView(inflater, container, savedInstanceState); |
| | | } |
| | | |
| | | @Override |
| | | public int getContentResource() { |
| | | return R.layout.browser_pptv_activity; |
| | | } |
| | | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | query = new AQuery(contentView); |
| | | initView(contentView); |
| | | Bundle bundle = getArguments(); |
| | | if (bundle != null) { |
| | | String url = bundle.getString("playUrl", ""); |
| | | String title = bundle.getString("name", ""); |
| | | tv_url.setText(url); |
| | | tv_title.setText(title); |
| | | webview.loadUrl(url); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void initView(View view) { |
| | | initWebView(view); |
| | | tv_top_bar_left = view.findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_left.setOnClickListener(this); |
| | | fl_container = view.findViewById(R.id.fl_container); |
| | | |
| | | ll_top = view.findViewById(R.id.ll_top); |
| | | tv_title = view.findViewById(R.id.tv_title); |
| | | tv_url = view.findViewById(R.id.tv_url); |
| | | query.id(R.id.tv_top_bar_left1).clicked(this); |
| | | |
| | | |
| | | tv_url.setOnClickListener(new OnClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (tv_url.getText() != null) { |
| | | ClipboardUtil.copy(getContext(), tv_url.getText().toString()); |
| | | Toast.makeText(getContext(), "链接复制成功", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | } |
| | | }); |
| | | tv_url.setOnLongClickListener(new View.OnLongClickListener() { |
| | | @Override |
| | | public boolean onLongClick(View v) { |
| | | if (tv_url.getText() != null) { |
| | | ClipboardUtil.copy(getContext(), tv_url.getText().toString()); |
| | | Toast.makeText(getContext(), "链接复制成功", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | return true; |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | int j = -1; |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | switch (code) { |
| | | case REQUEST_CODE_LOGIN: |
| | | |
| | | case REQUEST_CODE_VIP: |
| | | break; |
| | | } |
| | | code = -1; |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | } |
| | | |
| | | @Override |
| | | public void onDestroy() { |
| | | if (webview != null) { |
| | | webview.loadUrl("javascript:getPlayInfo();"); |
| | | webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); |
| | | webview.clearHistory(); |
| | | |
| | | ((ViewGroup) webview.getParent()).removeView(webview); |
| | | webview.destroy(); |
| | | webview = null; |
| | | } |
| | | if (mttFullVideoAd != null) { |
| | | mttFullVideoAd = null; |
| | | } |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_top_bar_left: |
| | | case R.id.tv_top_bar_left1: { |
| | | if (getActivity().getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { |
| | | if (webview != null) |
| | | webview.loadUrl("javascript:exitFullScreenPlay();"); |
| | | getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | WindowManager.LayoutParams attrs = getActivity().getWindow().getAttributes(); |
| | | attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; |
| | | getActivity().getWindow().setAttributes(attrs); |
| | | } else { |
| | | getActivity().finish(); |
| | | } |
| | | } |
| | | break; |
| | | case R.id.iv_add_to_favourite: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | private PPTVVideoState videoState; |
| | | |
| | | private synchronized void playAd() { |
| | | videoState = null; |
| | | adPlayFinish(); |
| | | } |
| | | |
| | | |
| | | private void adPlayFinish() { |
| | | if (webview != null) { |
| | | webview.loadUrl("javascript:adPlayFinish();"); |
| | | //TODO 设置上次视频播放进度 |
| | | String js = "var video = document.querySelector('video');\n" + |
| | | "video.play = function() {\n" + |
| | | "\tsetTimeout(function() {\n" + |
| | | "\t\tvideo.currentTime = {播放位置}; video.play=null; \n" + |
| | | "\t}, 2000);\n" + |
| | | "\tconsole.log('获取到资源长度');\n" + |
| | | "\treturn false;\n" + |
| | | "};"; |
| | | if (videoState != null && videoState.getPlayPosition() != null && videoState.getPlayPosition() > 0) |
| | | webview.loadUrl("javascript:" + js.replace("{播放位置}", videoState.getPlayPosition() + "")); |
| | | |
| | | // webview.loadUrl("javascript: setTimeout(function(){H5Player.seekVideo(300);},2000);"); |
| | | } |
| | | } |
| | | |
| | | TTFullScreenVideoAd mttFullVideoAd = null; |
| | | |
| | | public class PPTVVideoState { |
| | | private boolean vipUser; |
| | | private boolean vipVideo; |
| | | private boolean bought; |
| | | private boolean canBuy; |
| | | private String title; |
| | | private Integer playPosition; |
| | | //是否显示插屏广告 |
| | | private boolean showInterstitialAd; |
| | | private boolean showPreVideoAd; |
| | | |
| | | public boolean isShowPreVideoAd() { |
| | | return showPreVideoAd; |
| | | } |
| | | |
| | | public void setShowPreVideoAd(boolean showPreVideoAd) { |
| | | this.showPreVideoAd = showPreVideoAd; |
| | | } |
| | | |
| | | public boolean isShowInterstitialAd() { |
| | | return showInterstitialAd; |
| | | } |
| | | |
| | | public void setShowInterstitialAd(boolean showInterstitialAd) { |
| | | this.showInterstitialAd = showInterstitialAd; |
| | | } |
| | | |
| | | public Integer getPlayPosition() { |
| | | return playPosition; |
| | | } |
| | | |
| | | public void setPlayPosition(Integer playPosition) { |
| | | this.playPosition = playPosition; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public boolean isVipUser() { |
| | | return vipUser; |
| | | } |
| | | |
| | | public void setVipUser(boolean vipUser) { |
| | | this.vipUser = vipUser; |
| | | } |
| | | |
| | | public boolean isVipVideo() { |
| | | return vipVideo; |
| | | } |
| | | |
| | | public void setVipVideo(boolean vipVideo) { |
| | | this.vipVideo = vipVideo; |
| | | } |
| | | |
| | | public boolean isBought() { |
| | | return bought; |
| | | } |
| | | |
| | | public void setBought(boolean bought) { |
| | | this.bought = bought; |
| | | } |
| | | |
| | | public boolean isCanBuy() { |
| | | return canBuy; |
| | | } |
| | | |
| | | public void setCanBuy(boolean canBuy) { |
| | | this.canBuy = canBuy; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.graphics.drawable.Drawable; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestBuilder; |
| | | import com.bumptech.glide.RequestManager; |
| | | import com.bumptech.glide.load.model.GlideUrl; |
| | | import com.bumptech.glide.load.model.Headers; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.video.app.entity.video.VideoDetailInfo; |
| | | import com.hanju.video.app.entity.video.VideoInfo; |
| | |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.R; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; |
| | | |
| | |
| | | if(StringUtils.isBlank(pic)) |
| | | pic=info.getPicture(); |
| | | |
| | | Glide.with(mContext).load(pic).transition(withCrossFade()).placeholder(R.color.black).into(albumVideoHolder.iv_picture); |
| | | pic=pic.replace( "img.hmtv.me","hmtv.bolecdn.com"); |
| | | |
| | | GlideUrl glideUrl = new GlideUrl(pic, new Headers() { |
| | | @Override |
| | | public Map<String, String> getHeaders() { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("Referer", "https://www.hmtv.me/"); |
| | | map.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14 Safari/602.1"); |
| | | return map; |
| | | } |
| | | }); |
| | | |
| | | RequestBuilder<Drawable> requestBuilder; |
| | | if (pic != null && pic.contains("hmtv.me")) { |
| | | requestBuilder = Glide.with(mContext).load(glideUrl); |
| | | } else { |
| | | requestBuilder = Glide.with(mContext).load(pic); |
| | | } |
| | | requestBuilder.transition(withCrossFade()).placeholder(R.color.black).into(albumVideoHolder.iv_picture); |
| | | |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | import android.content.Intent; |
| | | import android.graphics.Canvas; |
| | | import android.graphics.Rect; |
| | | |
| | | import androidx.recyclerview.widget.GridLayoutManager; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.graphics.drawable.Drawable; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | |
| | | import android.widget.ImageView; |
| | | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.RequestBuilder; |
| | | import com.bumptech.glide.load.model.GlideUrl; |
| | | import com.bumptech.glide.load.model.Headers; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.hanju.lib.library.util.common.DimenUtils; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; |
| | | |
| | |
| | | defaultPicture = info.getVpicture(); |
| | | } |
| | | |
| | | String picture = null; |
| | | |
| | | |
| | | if (StringUtils.isEmpty(defaultPicture)) { |
| | | Glide.with(mContext).load(info.getPicture()).transition(withCrossFade()) |
| | | .apply(new RequestOptions().centerCrop().placeholder(R.drawable.shape_default_cover).error(R.drawable.shape_default_cover)) |
| | | .into(holder.iv_movie_cover); |
| | | } else { |
| | | defaultPicture = info.getPicture(); |
| | | |
| | | } |
| | | |
| | | try { |
| | | Glide.with(mContext).load(defaultPicture).transition(withCrossFade()) |
| | | RequestBuilder<Drawable> requestBuilder = null; |
| | | GlideUrl glideUrl = new GlideUrl(defaultPicture, new Headers() { |
| | | @Override |
| | | public Map<String, String> getHeaders() { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("Referer", "https://www.hmtv.me/"); |
| | | map.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14 Safari/602.1"); |
| | | return map; |
| | | } |
| | | }); |
| | | |
| | | if (defaultPicture != null && defaultPicture.contains("hmtv.me")) { |
| | | requestBuilder = Glide.with(mContext).load(glideUrl); |
| | | } else { |
| | | requestBuilder = Glide.with(mContext).load(defaultPicture); |
| | | } |
| | | |
| | | requestBuilder.transition(withCrossFade()) |
| | | .apply(new RequestOptions().centerCrop().placeholder(R.drawable.shape_default_cover).error(R.drawable.shape_default_cover)) |
| | | .into(holder.iv_movie_cover); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | holder.tv_movie_title.setText(info.getName()); |
| | | |
| | | String tag = StringUtils.isBlank(info.getTag()) ? "" : info |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | webview.reload(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void onReceiveValue(String value) { |
| | | if (StringUtils.isNullOrEmpty(value)) |
| | | return; |
| | | if (value.contains("url=")) { |
| | | String ps = value.split("\\?")[1]; |
| | | String[] sts = ps.split("&"); |
| | | for (String st : sts) { |
| | | if (st.contains("url=")) { |
| | | value = st.replace("url=", ""); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Log.i(TAG, "解析结果:" + value); |
| | | if (videoParseListener != null) { |
| | | videoParseListener.onSuccess(value.replace("\"", "")); |
| | |
| | | |
| | | public class WriteHandlingWebViewClient extends WebViewClient { |
| | | |
| | | private static final String TAG = "WriteHandlingWebViewClient"; |
| | | private final String MARKER = "AJAXINTERCEPT"; |
| | | |
| | | /** |
| | |
| | | OkHttpClient client = new OkHttpClient(); |
| | | try { |
| | | String url = request.getUrl().toString(); |
| | | Log.i(TAG,"url:"+url); |
| | | // if (!Pattern.matches(regex, url)) { |
| | | // return super.shouldInterceptRequest(view, request); |
| | | // } |
| | |
| | | String mime = response.getMimeType(); |
| | | |
| | | // WebResourceResponse的mime必须为"text/html",不能是"text/html; charset=utf-8" |
| | | if (mime.contains("text/html")) { |
| | | if (mime != null && mime.contains("text/html")) { |
| | | mime = "text/html"; |
| | | } |
| | | |
| | |
| | | private InputStream injectInterceptToStream(Context context, InputStream is, String mime, String charset) { |
| | | try { |
| | | byte[] pageContents = Utils.consumeInputStream(is); |
| | | if (mime.contains("text/html")) { |
| | | if (mime != null && mime.contains("text/html")) { |
| | | pageContents = AjaxInterceptJavascriptInterface |
| | | .enableIntercept(context, pageContents) |
| | | .getBytes(charset); |
New file |
| | |
| | | package com.hanju.video.app.util; |
| | | |
| | | 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.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.entity.ad.AdTypeVO; |
| | |
| | | if (!StringUtils.isNullOrEmpty(config)) {//万一没设置起就用广点通 |
| | | try { |
| | | JSONObject object = new JSONObject(config); |
| | | return AD_TYPE.valueOf(object.optString(positionName.getPositionName())); |
| | | return AD_TYPE.valueOf(object.optJSONObject(positionName.getPositionName()).optString("type")); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e1) { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 穿山甲广告是否需要初始化 |
| | | * |
| | | * @return |
| | | */ |
| | | public static boolean isCanInitCSJ() { |
| | | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; |
| | | // return true; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public static String APP_EXIT="945469133"; |
| | | |
| | | public static String INVALID_AD = "111111111"; |
| | | |
| | | public static String HOME_INTERSTITIALAD = "947193782"; |
| | | |
| | | public static String APP_EXIT_FULL_VIDEO = "947193812"; |
| | | |
| | | |
| | | } |
| | |
| | | private Context mContext; |
| | | |
| | | |
| | | public ExpressAdManager(AdUtil.AD_TYPE adSource, Context context) { |
| | | public ExpressAdManager(AdUtil.AD_TYPE adSource, Context context) throws Exception { |
| | | sourceType = adSource; |
| | | this.mContext = context; |
| | | if (sourceType == AdUtil.AD_TYPE.csj) { |
| | |
| | | |
| | | 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.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.hanju.video.app.ui.media.VideoDetailActivity; |
| | | import com.hanju.video.app.util.common.DimenUtils; |
| | | 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; |
| | | |
| | | public class FullVideoAdManager { |
| | | |
| | |
| | | return fullVideoAdManager; |
| | | } |
| | | |
| | | public void loadAd(final Context context, String pid, final IFullVideoAdListener adListener) { |
| | | int w = DimenUtils.getScreenWidth(context); |
| | | int h = DimenUtils.getScreenHeight(context); |
| | | public void loadAd(final Activity context, AdUtil.AD_TYPE adType, String pid, final IFullVideoAdListener adListener) { |
| | | |
| | | if (adType == AdUtil.AD_TYPE.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(pid) |
| | | .setSupportDeepLink(true) |
| | | .setExpressViewAcceptedSize(w, h) |
| | | .setOrientation(TTAdConstant.VERTICAL) |
| | | .build(); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | mTTAdNative = ttAdManager.createAdNative(context); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (ttAdManager == null) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | ttFullScreenVideoAd.showFullScreenVideoAd(activity); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | 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); |
| | | } |
| | | |
| | | @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(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 展示广告 |
| | | * |
| | | * @param activity |
| | | */ |
| | | public void showAd(Activity activity) { |
| | | if (mttFullVideoAd != null) { |
| | | mttFullVideoAd.showFullScreenVideoAd(activity); |
| | | mttFullVideoAd = null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否已经缓存了广告 |
| | | * |
| | | * @return |
| | | */ |
| | | public boolean isCacahed() { |
| | | return mttFullVideoAd != null; |
| | | } |
| | | |
| | | public interface IFullVideoAdListener { |
| | | void onSuccess(); |
| | | void onFail(String msg); |
| | | void onFinish(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public static String PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = "7001426565143389"; |
| | | |
| | | public static String PID_SPLASH="2002520811288038"; |
| | | |
| | | //视频详情插屏 |
| | | public static String PID_VIDEO_DETAIL_INSERT="7062649756554638"; |
| | | |
| | | public static String HOME_INTERSTITIALAD = "6092865527203989"; |
| | | |
| | | public static String APP_EXIT_FULL_VIDEO = "6002467567814144"; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.hanju.video.app.util.ad; |
| | | |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Context; |
| | | |
| | | 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; |
| | | |
| | | public class IntertitialAdUtil { |
| | | |
| | | |
| | | public static void showAd(Activity context, AdUtil.AD_TYPE adType, String pid) { |
| | | if (adType == null) { |
| | | return; |
| | | } |
| | | |
| | | if (adType == AdUtil.AD_TYPE.csj) { |
| | | loadCSJ(context, pid); |
| | | } else if (adType == AdUtil.AD_TYPE.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(); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTSplashAd; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.qq.e.ads.splash.SplashAD; |
| | | import com.qq.e.ads.splash.SplashADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | |
| | | } |
| | | |
| | | private static void loadGDT(Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) { |
| | | |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = HanJuConstant.GDT_SPLASH_POSITION_ID; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = HanJuConstant.GDT_SPLASH_VIVO_POSITION_ID; |
| | | } |
| | | new SplashAD(context, skip, code, new SplashADListener() { |
| | | String code = GDTADConstant.PID_SPLASH;//AdUtil.getAdPid(context, AdPositionEnum.splash); |
| | | new SplashAD(context, code, new SplashADListener() { |
| | | @Override |
| | | public void onADDismissed() { |
| | | splashAdListener.close(); |
| | |
| | | */ |
| | | private static void loadCSJ(Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) { |
| | | skip.setVisibility(View.GONE); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ttAdManager == null) { |
| | | if (splashAdListener != null) |
| | | splashAdListener.noAd(); |
| | | return; |
| | | } |
| | | TTAdNative mTTAdNative = ttAdManager.createAdNative(context.getApplicationContext()); |
| | | //穿山甲广告 |
| | | int width = DimenUtils.getScreenWidth(context.getApplicationContext()); |
| | |
| | | width = 720; |
| | | if (height == 0) |
| | | height = 1080; |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = CSJADConstant.SPLASH_AD; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = CSJADConstant.SPLASH_AD_VIVO; |
| | | } |
| | | |
| | | String code = AdUtil.getAdPid(context, AdPositionEnum.splash); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(code) |
| | | .setSupportDeepLink(true) |
| | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, 5000); |
| | | |
| | | |
| | | } |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | |
| | | /** |
| | | * 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用 |
| | | */ |
| | | public class TTAdManagerHolder { |
| | | |
| | | private static boolean sInit; |
| | | |
| | | |
| | | public static TTAdManager get() { |
| | | if (!sInit) { |
| | | throw new RuntimeException("TTAdSdk is not init, please check."); |
| | | public static TTAdManager get() throws Exception { |
| | | if (!TTAdSdk.isInitSuccess()) { |
| | | throw new Exception("TTAdSdk is not init, please check."); |
| | | } |
| | | return TTAdSdk.getAdManager(); |
| | | } |
| | | |
| | | public static void init(Context context,String appId) { |
| | | doInit(context,appId); |
| | | public static void init(Context context, String appId, TTAdSdk.InitCallback initCallback) { |
| | | doInit(context, appId, initCallback); |
| | | } |
| | | |
| | | //step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明 |
| | | private static void doInit(Context context,String appId) { |
| | | if (!sInit) { |
| | | TTAdSdk.init(context, buildConfig(context,appId)); |
| | | sInit = true; |
| | | private static void doInit(Context context, String appId, TTAdSdk.InitCallback initCallback) { |
| | | if (!TTAdSdk.isInitSuccess()) { |
| | | TTAdSdk.init(context, buildConfig(context, appId), initCallback); |
| | | } else { |
| | | initCallback.success(); |
| | | } |
| | | } |
| | | |
| | | private static TTAdConfig buildConfig(Context context,String appId) { |
| | | return new TTAdConfig.Builder() |
| | | |
| | | |
| | | TTAdConfig.Builder builder = new TTAdConfig.Builder() |
| | | .appId(appId) |
| | | .useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView |
| | | .appName(context.getString(R.string.app_name)) |
| | |
| | | .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 |
| | | .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合 |
| | | .supportMultiProcess(true)//是否支持多进程 |
| | | .needClearTaskReset() |
| | | .needClearTaskReset(); |
| | | //.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。 |
| | | .build(); |
| | | if (AdUtil.getAdType(context, AdPositionEnum.splashHotStart) != null) { |
| | | builder.directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI); |
| | | } |
| | | |
| | | return builder.build(); |
| | | } |
| | | } |
| | |
| | | |
| | | public SearchResultAdManager(Context context) { |
| | | mContext = context; |
| | | if (expressAdManager == null) |
| | | if (expressAdManager == null) { |
| | | try { |
| | | expressAdManager = new ExpressAdManager(AdUtil.AD_TYPE.gdt, mContext); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static SearchResultAdManager getInstance(Context context) { |
| | |
| | | * @param count |
| | | */ |
| | | public void loadAD(int count, final ExpressAdManager.IAdLoadListener adLoadListener) { |
| | | if (expressAdManager == null) |
| | | return; |
| | | expressAdManager.loadSearchResultSmallAd(count, new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | |
| | | import com.hanju.lib.library.util.common.PackageUtils2; |
| | | import com.hanju.lib.library.util.common.StringUtils; |
| | | import com.hanju.lib.library.util.security.MD5Utils; |
| | | import com.hanju.video.app.R; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.ut.device.UTDevice; |
| | | import com.hanju.video.app.util.http.HttpApiUtil; |
| | |
| | | return PackageUtils2.getVersionCode(mContext) + ""; |
| | | } |
| | | |
| | | |
| | | @JavascriptInterface |
| | | public String getAppName() { |
| | | return mContext.getString(R.string.app_name)+ ""; |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void toast(String str) { |
| | | Toast.makeText(mContext, str, Toast.LENGTH_LONG).show(); |
New file |
| | |
| | | package com.hanju.video.app.util.browser; |
| | | |
| | | import android.content.Context; |
| | | import android.webkit.JavascriptInterface; |
| | | |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class PPHanJuJavaInterface { |
| | | private static final String TAG = "PPJavaInterface"; |
| | | private Context mContext; |
| | | private IEventListener eventListener; |
| | | |
| | | public PPHanJuJavaInterface(Context context, IEventListener eventListener) { |
| | | mContext = context; |
| | | this.eventListener = eventListener; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转登录页 |
| | | */ |
| | | @JavascriptInterface |
| | | public void login() { |
| | | eventListener.onLogin(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回用户信息(JSON格式)。 |
| | | * code为0标识用户未登录,data的值为空; |
| | | * code为1表示用户已经登录,data为用户信息 |
| | | * 如: {"code":1,"data":{"code":"123","nickname":"昵称","isSVip":false,"isCoupon":false}} |
| | | * |
| | | * @return |
| | | */ |
| | | @JavascriptInterface |
| | | public String getUserInfo() { |
| | | try { |
| | | JSONObject root = new JSONObject(); |
| | | root.put("code", 0); |
| | | return root.toString(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 试看结束 |
| | | */ |
| | | @JavascriptInterface |
| | | public void tryPlayFinish() { |
| | | eventListener.onTryPlayFinish(); |
| | | } |
| | | |
| | | /** |
| | | * 视频播放完成 |
| | | */ |
| | | @JavascriptInterface |
| | | public void playFinish() { |
| | | eventListener.onPlayFinish(); |
| | | } |
| | | |
| | | /** |
| | | * 视频信息回调 |
| | | * |
| | | * @param name 视频名称 |
| | | * @param cid |
| | | * @param vid |
| | | */ |
| | | @JavascriptInterface |
| | | public void videoInfo(String name, String cid, String vid) { |
| | | |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void stopPlay(String cid, String vid, int currentTime) { |
| | | } |
| | | |
| | | |
| | | public interface IEventListener { |
| | | public void onLogin(); |
| | | |
| | | public void onTryPlayFinish(); |
| | | |
| | | public void onPlayFinish(); |
| | | |
| | | } |
| | | } |
| | |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.ut.device.UTDevice; |
| | | import com.video.youth.util.YouthUtil; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | |
| | | } |
| | | params.put("Sign", MD5Utils.getMD532(sign.toString())); |
| | | params.put("Platform", "Android"); |
| | | params.put("YouthMode", YouthUtil.isOpenYouthMode(context) + ""); |
| | | params.put("Channel", ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL")); |
| | | return params; |
| | | } |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.lib.library.util.SystemCommon; |
| | | import com.qq.e.ads.nativ.NativeADDataRef; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.hanju.video.app.R; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.hanju.video.app.entity.ad.ExpressAdContainer; |
| | | import com.hanju.video.app.util.ad.AdUtil; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager; |
| | | import com.hanju.video.app.util.ad.ExpressAdManager.IAdEventListener; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | public Builder(Activity context) { |
| | | this.context = context; |
| | | try { |
| | | expressAdManager = new ExpressAdManager(AdUtil.getAdType(context, AdPositionEnum.exitApp), context); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return dialog; |
| | | } |
| | | |
| | | NativeADDataRef adDataRef; |
| | | |
| | | private NativeExpressAD nativeExpressAD; |
| | | |
| | | // 1.加载广告,先设置加载上下文环境和条件 |
| | | private void loadAd() { |
| | | if (expressAdManager == null) { |
| | | return; |
| | | } |
| | | |
| | | expressAdManager.loadAppExitAd(new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | |
| | | * @param context |
| | | * @return |
| | | */ |
| | | public static CharSequence getClickableHtml(String html, Context context, Integer color) { |
| | | public static CharSequence getClickableHtml(String html, Context context, Integer color,Class jumpClass) { |
| | | Spanned spannedHtml = Html.fromHtml(html); |
| | | SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml); |
| | | URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class); |
| | | for (final URLSpan span : urls) { |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color); |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color,jumpClass); |
| | | } |
| | | return clickableHtmlBuilder; |
| | | } |
| | |
| | | /** |
| | | * 设置点击超链接对应的处理内容 |
| | | */ |
| | | private static void setLinkClickable(final SpannableStringBuilder clickableHtmlBuilder, final URLSpan urlSpan, final Context context, final Integer linkColor) { |
| | | private static void setLinkClickable(final SpannableStringBuilder clickableHtmlBuilder, final URLSpan urlSpan, final Context context, final Integer linkColor,Class jumpClass) { |
| | | int start = clickableHtmlBuilder.getSpanStart(urlSpan); |
| | | int end = clickableHtmlBuilder.getSpanEnd(urlSpan); |
| | | int flags = clickableHtmlBuilder.getSpanFlags(urlSpan); |
| | | |
| | | ClickableSpan clickableSpan = new ClickableSpan() { |
| | | public void onClick(View view) { |
| | | context.startActivity(new Intent(context, BrowserActivity.class).putExtra("url", urlSpan.getURL())); |
| | | context.startActivity(new Intent(context, jumpClass).putExtra("url", urlSpan.getURL())); |
| | | } |
| | | |
| | | public void updateDrawState(TextPaint ds) { |
| | |
| | | maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } |
| | | jcenter() |
| | | mavenCentral() |
| | | |
| | | maven{url 'https://artifact.bytedance.com/repository/Volcengine/'} |
| | | |
| | | maven { url 'https://artifact.bytedance.com/repository/pangle'} |
| | | } |
| | | |
| | | dependencies { |
| | |
| | | // maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| | | maven { url 'http://developer.huawei.com/repo/' } |
| | | |
| | | |
| | | maven{url 'https://artifact.bytedance.com/repository/Volcengine/'} |
| | | |
| | | maven { url 'https://artifact.bytedance.com/repository/pangle'} |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | plugins { |
| | | id 'com.android.library' |
| | | } |
| | | |
| | | android { |
| | | compileSdkVersion 28 |
| | | buildToolsVersion "28.0.3" |
| | | |
| | | defaultConfig { |
| | | minSdkVersion 17 |
| | | targetSdkVersion 28 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | consumerProguardFiles "consumer-rules.pro" |
| | | |
| | | } |
| | | |
| | | buildTypes { |
| | | release { |
| | | minifyEnabled false |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | } |
| | | } |
| | | compileOptions { |
| | | sourceCompatibility JavaVersion.VERSION_1_8 |
| | | targetCompatibility JavaVersion.VERSION_1_8 |
| | | } |
| | | } |
| | | |
| | | dependencies { |
| | | |
| | | implementation 'androidx.appcompat:appcompat:1.1.0' |
| | | implementation 'com.google.android.material:material:1.1.0' |
| | | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' |
| | | implementation project(path: ':library-mine') |
| | | testImplementation 'junit:junit:4.+' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | |
| | | |
| | | api files('libs/tbs_sdk_thirdapp_v4.3.0.185_44085.jar') |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.ec.search; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.test.platform.app.InstrumentationRegistry; |
| | | import androidx.test.ext.junit.runners.AndroidJUnit4; |
| | | |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Instrumented test, which will execute on an Android device. |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | @RunWith(AndroidJUnit4.class) |
| | | public class ExampleInstrumentedTest { |
| | | @Test |
| | | public void useAppContext() { |
| | | // Context of the app under test. |
| | | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
| | | assertEquals("com.yeshi.ec.search.test", appContext.getPackageName()); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| | | package="com.video.base"> |
| | | |
| | | <application> |
| | | |
| | | </application> |
| | | </manifest> |
New file |
| | |
| | | package com.video.base.ui; |
| | | |
| | | import android.content.res.Configuration; |
| | | import android.content.res.Resources; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | |
| | | import androidx.fragment.app.FragmentActivity; |
| | | //import com.umeng.message.PushAgent; |
| | | |
| | | public class BaseActivity extends FragmentActivity { |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle arg0) { |
| | | super.onCreate(arg0); |
| | | // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);// 锁定竖屏 |
| | | // PushAgent.getInstance(this).onAppStart(); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| | | Window window = getWindow(); |
| | | window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, |
| | | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onConfigurationChanged(Configuration newConfig) { |
| | | if (newConfig.fontScale != 1)//非默认值 |
| | | getResources(); |
| | | super.onConfigurationChanged(newConfig); |
| | | } |
| | | |
| | | @Override |
| | | public Resources getResources() { |
| | | Resources res = super.getResources(); |
| | | if (res.getConfiguration().fontScale != 1.0) {//非默认值 |
| | | Configuration newConfig = new Configuration(); |
| | | newConfig.setToDefaults();//设置默认 |
| | | newConfig.fontScale = 1.0f; |
| | | res.updateConfiguration(newConfig, res.getDisplayMetrics()); |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | } |
| | | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.video.base.ui.subview; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.content.Context; |
| | | import android.graphics.Canvas; |
| | | import android.util.AttributeSet; |
| | | import android.view.View; |
| | | import android.widget.TextView; |
| | | |
| | | import com.tencent.smtt.sdk.CookieSyncManager; |
| | | import com.tencent.smtt.sdk.WebSettings; |
| | | import com.tencent.smtt.sdk.WebSettings.LayoutAlgorithm; |
| | | import com.tencent.smtt.sdk.WebView; |
| | | import com.tencent.smtt.sdk.WebViewClient; |
| | | |
| | | public class X5WebView extends WebView { |
| | | TextView title; |
| | | private WebViewClient client = new WebViewClient() { |
| | | /** |
| | | * 防止加载网页时调起系统浏览器 |
| | | */ |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | view.loadUrl(url); |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | @SuppressLint("SetJavaScriptEnabled") |
| | | public X5WebView(Context arg0, AttributeSet arg1) { |
| | | super(arg0, arg1); |
| | | this.setWebViewClient(client); |
| | | // this.setWebChromeClient(chromeClient); |
| | | // WebStorage webStorage = WebStorage.getInstance(); |
| | | initWebViewSettings(); |
| | | this.getView().setClickable(true); |
| | | } |
| | | |
| | | private void initWebViewSettings() { |
| | | WebSettings webSetting = this.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | // webSetting.setJavaScriptCanOpenWindowsAutomatically(true); |
| | | webSetting.setAllowFileAccess(true); |
| | | webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS); |
| | | webSetting.setSupportZoom(false); |
| | | webSetting.setBuiltInZoomControls(true); |
| | | webSetting.setUseWideViewPort(true); |
| | | webSetting.setSupportMultipleWindows(true); |
| | | // webSetting.setLoadWithOverviewMode(true); |
| | | webSetting.setAppCacheEnabled(true); |
| | | // webSetting.setDatabaseEnabled(true); |
| | | webSetting.setDomStorageEnabled(true); |
| | | webSetting.setGeolocationEnabled(true); |
| | | webSetting.setAppCacheMaxSize(Long.MAX_VALUE); |
| | | // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY); |
| | | webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND); |
| | | // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH); |
| | | webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE); |
| | | |
| | | // this.getSettingsExtension().setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension |
| | | // settings 的设计 |
| | | webSetting.setUserAgent(webSetting.getUserAgentString().replace("TBS","BUWAN").replace("MQQBrowser","BUWANBrowser")); |
| | | webSetting.setTextZoom(100); |
| | | |
| | | CookieSyncManager.createInstance(getContext()); |
| | | CookieSyncManager.getInstance().sync(); |
| | | } |
| | | |
| | | @Override |
| | | protected boolean drawChild(Canvas canvas, View child, long drawingTime) { |
| | | boolean ret = super.drawChild(canvas, child, drawingTime); |
| | | canvas.save(); |
| | | // Paint paint = new Paint(); |
| | | // paint.setColor(0x7fff0000); |
| | | // paint.setTextSize(24.f); |
| | | // paint.setAntiAlias(true); |
| | | // if (getX5WebViewExtension() != null) { |
| | | // canvas.drawText(this.getContext().getPackageName() + "-pid:" |
| | | // + android.os.Process.myPid(), 10, 50, paint); |
| | | // canvas.drawText( |
| | | // "X5 Core:" + QbSdk.getTbsVersion(this.getContext()), 10, |
| | | // 100, paint); |
| | | // } else { |
| | | // canvas.drawText(this.getContext().getPackageName() + "-pid:" |
| | | // + android.os.Process.myPid(), 10, 50, paint); |
| | | // canvas.drawText("Sys Core", 10, 100, paint); |
| | | // } |
| | | // canvas.drawText(Build.MANUFACTURER, 10, 150, paint); |
| | | // canvas.drawText(Build.MODEL, 10, 200, paint); |
| | | // canvas.restore(); |
| | | return ret; |
| | | } |
| | | |
| | | public X5WebView(Context arg0) { |
| | | super(arg0); |
| | | setBackgroundColor(85621); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/shape_btn" android:state_enabled="true"></item> |
| | | <item android:drawable="@drawable/shape_btn_invalid" android:state_enabled="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="40dp" /> |
| | | |
| | | <solid android:color="@color/btn_bg_color" /> |
| | | |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="40dp" /> |
| | | |
| | | <solid android:color="@color/btn_invalid_bg_color" /> |
| | | |
| | | </shape> |
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="#CECECE" /> |
| | | |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | |
| | | |
| | | </resources> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | |
| | | </resources> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | |
| | | |
| | | </resources> |
New file |
| | |
| | | package com.yeshi.ec.search; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Example local unit test, which will execute on the development machine (host). |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | public class ExampleUnitTest { |
| | | @Test |
| | | public void addition_isCorrect() { |
| | | assertEquals(4, 2 + 2); |
| | | } |
| | | } |
| | |
| | | api files('libs/android-query-full.0.26.7.jar') |
| | | // api 'com.github.giswangsj:AndRatingBar:1.0.3' |
| | | api files('libs/AndRatingBar-1.0.3.aar') |
| | | // api 'com.loopj.android:android-async-http:1.4.9' |
| | | } |
| | | |
| | | android { |
| | | compileSdkVersion 26 |
| | | compileSdkVersion 29 |
| | | buildToolsVersion '28.0.3' |
| | | defaultConfig { |
| | | minSdkVersion 16 |
| | | targetSdkVersion 26 |
| | | targetSdkVersion 29 |
| | | } |
| | | sourceSets { |
| | | main { |
| | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | public static String getVersionName(Context context) { |
| | | try { |
| | | PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); |
| | | return pi.versionName; |
| | | } catch (NameNotFoundException e) { |
| | | e.printStackTrace(); |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | plugins { |
| | | id 'com.android.library' |
| | | } |
| | | |
| | | android { |
| | | compileSdkVersion 28 |
| | | buildToolsVersion "28.0.3" |
| | | |
| | | defaultConfig { |
| | | minSdkVersion 17 |
| | | targetSdkVersion 28 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | consumerProguardFiles "consumer-rules.pro" |
| | | } |
| | | |
| | | buildTypes { |
| | | release { |
| | | minifyEnabled false |
| | | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
| | | } |
| | | } |
| | | compileOptions { |
| | | sourceCompatibility JavaVersion.VERSION_1_8 |
| | | targetCompatibility JavaVersion.VERSION_1_8 |
| | | } |
| | | } |
| | | |
| | | dependencies { |
| | | |
| | | implementation 'androidx.appcompat:appcompat:1.1.0' |
| | | implementation 'com.google.android.material:material:1.1.0' |
| | | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' |
| | | implementation project(path: ':library-mine') |
| | | api project(path: ':library-base') |
| | | testImplementation 'junit:junit:4.+' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.ec.search; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import androidx.test.platform.app.InstrumentationRegistry; |
| | | import androidx.test.ext.junit.runners.AndroidJUnit4; |
| | | |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Instrumented test, which will execute on an Android device. |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | @RunWith(AndroidJUnit4.class) |
| | | public class ExampleInstrumentedTest { |
| | | @Test |
| | | public void useAppContext() { |
| | | // Context of the app under test. |
| | | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
| | | assertEquals("com.yeshi.ec.search.test", appContext.getPackageName()); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| | | package="com.video.youth"> |
| | | |
| | | <application> |
| | | <activity |
| | | android:name=".ui.YouthActivity" |
| | | android:screenOrientation="portrait"></activity> |
| | | <activity |
| | | android:name=".ui.YouthPwdActivity" |
| | | android:screenOrientation="portrait"></activity> |
| | | <activity |
| | | android:name=".ui.BrowserActivity" |
| | | android:screenOrientation="portrait"></activity> |
| | | </application> |
| | | </manifest> |
New file |
| | |
| | | package com.video.youth.entity; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class YouthModeChange implements Serializable { |
| | | |
| | | private boolean open; |
| | | |
| | | public YouthModeChange(boolean open) { |
| | | this.open = open; |
| | | } |
| | | |
| | | public boolean isOpen() { |
| | | return open; |
| | | } |
| | | |
| | | public void setOpen(boolean open) { |
| | | this.open = open; |
| | | } |
| | | } |
New file |
| | |
| | | package com.video.youth.ui; |
| | | |
| | | import android.Manifest; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.PixelFormat; |
| | | import android.net.Uri; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.webkit.JavascriptInterface; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.hanju.lib.library.util.common.ClipboardUtil; |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | import com.tencent.smtt.export.external.interfaces.SslError; |
| | | import com.tencent.smtt.export.external.interfaces.SslErrorHandler; |
| | | import com.tencent.smtt.export.external.interfaces.WebResourceRequest; |
| | | import com.tencent.smtt.sdk.ValueCallback; |
| | | import com.tencent.smtt.sdk.WebChromeClient; |
| | | import com.tencent.smtt.sdk.WebSettings; |
| | | import com.tencent.smtt.sdk.WebView; |
| | | import com.tencent.smtt.sdk.WebViewClient; |
| | | import com.video.base.ui.BaseActivity; |
| | | import com.video.youth.R; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | public class BrowserActivity extends BaseActivity implements OnClickListener { |
| | | private final static int FILECHOOSER_RESULTCODE = 10002; |
| | | |
| | | private static final String TAG = BrowserActivity.class.getSimpleName(); |
| | | private TextView tv_top_bar_left; |
| | | private TextView tv_top_bar_middle; |
| | | private WebView webview; |
| | | ProgressBar progressBar; |
| | | private ValueCallback mUploadMessage; |
| | | |
| | | |
| | | private void initX5WebView() { |
| | | webview = findViewById(R.id.webview); |
| | | webview.setWebViewClient(new WebViewClient() { |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | Log.i(TAG, "url:" + url); |
| | | if (url != null && url.startsWith("weixin://")) { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | startActivity(intent); |
| | | return true; |
| | | } else if (url != null && (!url.startsWith("http"))) { |
| | | return true; |
| | | } |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | } |
| | | |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) { |
| | | String url = webResourceRequest.getUrl().toString(); |
| | | Log.i(TAG, "url:" + url); |
| | | return super.shouldOverrideUrlLoading(webView, webResourceRequest); |
| | | } |
| | | |
| | | @Override |
| | | public void onPageFinished(WebView webView, String s) { |
| | | super.onPageFinished(webView, s); |
| | | } |
| | | |
| | | @Override |
| | | public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) { |
| | | } |
| | | }); |
| | | |
| | | webview.setWebChromeClient(new WebChromeClient() { |
| | | |
| | | @Override |
| | | public void onReceivedTitle(WebView view, String title) { |
| | | if (!StringUtils.isNullOrEmpty(wholeTitle)) |
| | | return; |
| | | tv_top_bar_middle.setText(title); |
| | | } |
| | | |
| | | @Override |
| | | public void onProgressChanged(WebView webView, int i) { |
| | | if (i == 100) { |
| | | progressBar.setVisibility(View.GONE); |
| | | } else { |
| | | if (View.INVISIBLE == progressBar.getVisibility()) { |
| | | progressBar.setVisibility(View.VISIBLE); |
| | | } |
| | | progressBar.setProgress(i); |
| | | } |
| | | super.onProgressChanged(webView, i); |
| | | } |
| | | |
| | | @Override |
| | | public void openFileChooser(ValueCallback<Uri> valueCallback, String acceptType, String capture) { |
| | | if (mUploadMessage != null) { |
| | | mUploadMessage.onReceiveValue(null); |
| | | } |
| | | if (lacksPermissions(Manifest.permission.READ_EXTERNAL_STORAGE)) { //存储权限未开启 |
| | | valueCallback.onReceiveValue(null); |
| | | ActivityCompat.requestPermissions(BrowserActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 10023); |
| | | return; |
| | | } |
| | | mUploadMessage = valueCallback; |
| | | Intent i = new Intent(Intent.ACTION_GET_CONTENT); |
| | | i.addCategory(Intent.CATEGORY_OPENABLE); |
| | | String type = TextUtils.isEmpty(acceptType) ? "*/*" : acceptType; |
| | | i.setType(type); |
| | | startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); |
| | | super.openFileChooser(valueCallback, acceptType, capture); |
| | | } |
| | | |
| | | // 判断权限集合 是否授权 false授权 true未授权 |
| | | public boolean lacksPermissions(String... permissions) { |
| | | for (String permission : permissions) { |
| | | if (lacksPermission(permission)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // 判断是否缺少权限 |
| | | private boolean lacksPermission(String permission) { |
| | | //权限未授权 |
| | | return ContextCompat.checkSelfPermission(getApplicationContext(), permission) == PackageManager.PERMISSION_DENIED; |
| | | } |
| | | |
| | | @Override |
| | | public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, FileChooserParams fileChooserParams) { |
| | | if (mUploadMessage != null) { |
| | | mUploadMessage.onReceiveValue(null); |
| | | } |
| | | if (lacksPermissions(Manifest.permission.READ_EXTERNAL_STORAGE)) { //存储权限未开启 |
| | | valueCallback.onReceiveValue(null); |
| | | ActivityCompat.requestPermissions(BrowserActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 10023); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | mUploadMessage = valueCallback; |
| | | Intent i = new Intent(Intent.ACTION_GET_CONTENT); |
| | | i.addCategory(Intent.CATEGORY_OPENABLE); |
| | | if (fileChooserParams != null && fileChooserParams.getAcceptTypes() != null |
| | | && fileChooserParams.getAcceptTypes().length > 0) { |
| | | i.setType(fileChooserParams.getAcceptTypes()[0]); |
| | | } else { |
| | | i.setType("*/*"); |
| | | } |
| | | startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); |
| | | return true; |
| | | } |
| | | }); |
| | | WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webSetting.setDomStorageEnabled(true); |
| | | webview.addJavascriptInterface(new MyJavaInterface(), "yestv"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | } |
| | | |
| | | private String wholeTitle; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | getWindow().setFormat(PixelFormat.TRANSLUCENT); |
| | | setContentView(R.layout.activity_browser_youth); |
| | | tv_top_bar_left = findViewById(R.id.tv_left); |
| | | tv_top_bar_middle = findViewById(R.id.tv_middle); |
| | | |
| | | tv_top_bar_left.setOnClickListener(this); |
| | | |
| | | progressBar = findViewById(R.id.myProgressBar); |
| | | progressBar.setMax(100); |
| | | progressBar.setProgressDrawable(this.getResources() |
| | | .getDrawable(R.drawable.color_progressbar)); |
| | | initX5WebView(); |
| | | webview.loadUrl(getIntent().getStringExtra("url")); |
| | | wholeTitle = getIntent().getStringExtra("title"); |
| | | if (!StringUtils.isNullOrEmpty(wholeTitle)) { |
| | | tv_top_bar_middle.setText(wholeTitle); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | if (webview != null) { |
| | | webview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); |
| | | webview.clearHistory(); |
| | | |
| | | ((ViewGroup) webview.getParent()).removeView(webview); |
| | | webview.destroy(); |
| | | webview = null; |
| | | } |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (v.getId() == R.id.tv_left) { |
| | | if (!webview.canGoBack()) |
| | | finish(); |
| | | else { |
| | | webview.goBack(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 设置回退 |
| | | // 覆盖Activity类的onKeyDown(int keyCoder,KeyEvent event)方法 |
| | | @Override |
| | | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| | | if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) { |
| | | webview.goBack(); // goBack()表示返回WebView的上一页面 |
| | | return true; |
| | | } |
| | | return super.onKeyDown(keyCode, event); |
| | | } |
| | | |
| | | class MyJavaInterface { |
| | | |
| | | @JavascriptInterface |
| | | public void toast(String st) { |
| | | Toast.makeText(BrowserActivity.this, st, Toast.LENGTH_SHORT).show(); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public void copyText(String st) { |
| | | ClipboardUtil.copy(getApplicationContext(), st); |
| | | } |
| | | |
| | | @JavascriptInterface |
| | | public String getAppName() { |
| | | return getString(R.string.app_name) + ""; |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.video.youth.ui; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.video.youth.util.YouthUtil; |
| | | import com.video.youth.R; |
| | | |
| | | public class YouthActivity extends Activity implements |
| | | OnClickListener { |
| | | |
| | | |
| | | private AQuery mAquery; |
| | | |
| | | |
| | | private void initView() { |
| | | mAquery = new AQuery(this); |
| | | mAquery.id(R.id.tv_middle).text("青少年模式"); |
| | | mAquery.id(R.id.tv_left).clicked(this); |
| | | mAquery.id(R.id.tv_open).clicked(this); |
| | | } |
| | | |
| | | private void init() { |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | mAquery.id(R.id.tv_open).text("关闭青少年模式"); |
| | | } else { |
| | | mAquery.id(R.id.tv_open).text("开启青少年模式"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_youth); |
| | | initView(); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | init(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | |
| | | int id = v.getId(); |
| | | if (id == R.id.tv_left) { |
| | | finish(); |
| | | } else if (id == R.id.tv_open) { |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | startActivity(new Intent(this, YouthPwdActivity.class).putExtra("type", YouthPwdActivity.TYPE_VERIFY)); |
| | | } else { |
| | | if (YouthUtil.isSetPwd(getApplicationContext())) { |
| | | YouthUtil.openYouthMode(getApplicationContext()); |
| | | init(); |
| | | Toast.makeText(this, "已开启青少年模式", Toast.LENGTH_SHORT).show(); |
| | | } else |
| | | startActivity(new Intent(this, YouthPwdActivity.class).putExtra("type", YouthPwdActivity.TYPE_SET)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.video.youth.ui; |
| | | |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Toast; |
| | | |
| | | import com.androidquery.AQuery; |
| | | import com.video.youth.ui.subview.VerifyCodeViewShowLine; |
| | | import com.video.youth.util.YouthUtil; |
| | | import com.video.youth.R; |
| | | |
| | | public class YouthPwdActivity extends Activity implements |
| | | OnClickListener { |
| | | |
| | | //设置密码 |
| | | public final static int TYPE_SET = 1; |
| | | //验证密码 |
| | | public final static int TYPE_VERIFY = 2; |
| | | //修改密码-原密码 |
| | | public final static int TYPE_UPDATE_OLD = 3; |
| | | //修改密码-新密码 |
| | | public final static int TYPE_UPDATE_NEW = 4; |
| | | |
| | | |
| | | private AQuery mAquery; |
| | | |
| | | private VerifyCodeViewShowLine vcvs; |
| | | |
| | | |
| | | private void initView() { |
| | | mAquery = new AQuery(this); |
| | | vcvs = (VerifyCodeViewShowLine) mAquery.id(R.id.vcvs_pwd).getView(); |
| | | mAquery.id(R.id.tv_middle).text("青少年模式"); |
| | | mAquery.id(R.id.tv_left).clicked(this); |
| | | mAquery.id(R.id.tv_btn).clicked(this); |
| | | mAquery.id(R.id.tv_pwd_forget).clicked(this); |
| | | mAquery.id(R.id.tv_pwd_update).clicked(this); |
| | | } |
| | | |
| | | int type; |
| | | |
| | | private void init() { |
| | | type = getIntent().getIntExtra("type", TYPE_SET); |
| | | switch (type) { |
| | | case TYPE_SET: |
| | | mAquery.id(R.id.tv_title).text("设置密码"); |
| | | mAquery.id(R.id.tv_btn).text("确认设置"); |
| | | break; |
| | | case TYPE_VERIFY: |
| | | mAquery.id(R.id.tv_title).text("输入密码"); |
| | | mAquery.id(R.id.tv_btn).text("确定"); |
| | | break; |
| | | case TYPE_UPDATE_OLD: |
| | | mAquery.id(R.id.tv_title).text("请输入原密码"); |
| | | mAquery.id(R.id.tv_btn).text("下一步"); |
| | | break; |
| | | case TYPE_UPDATE_NEW: |
| | | mAquery.id(R.id.tv_title).text("请输入新密码"); |
| | | mAquery.id(R.id.tv_btn).text("确定"); |
| | | break; |
| | | } |
| | | |
| | | vcvs.setInputCompleteListener(new VerifyCodeViewShowLine.InputCompleteListener() { |
| | | @Override |
| | | public void inputComplete() { |
| | | mAquery.id(R.id.tv_btn).enabled(true); |
| | | } |
| | | |
| | | @Override |
| | | public void invalidContent() { |
| | | mAquery.id(R.id.tv_btn).enabled(false); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_youth_password); |
| | | initView(); |
| | | init(); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | init(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | |
| | | //获取输入的密码 |
| | | private String getInputPwd() { |
| | | return vcvs.getEditContent(); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | int id = v.getId(); |
| | | if (id == R.id.tv_left) { |
| | | finish(); |
| | | } else if (id == R.id.tv_pwd_update) { |
| | | if (type != TYPE_VERIFY) { |
| | | return; |
| | | } |
| | | startActivity(new Intent(this, YouthPwdActivity.class).putExtra("type", TYPE_UPDATE_OLD)); |
| | | } else if (id == R.id.tv_pwd_forget) { |
| | | startActivity(new Intent(this, BrowserActivity.class).putExtra("url", getString(R.string.forget_pwd))); |
| | | } else if (id == R.id.tv_btn) { |
| | | switch (type) { |
| | | case TYPE_SET: { |
| | | String pwd = getInputPwd(); |
| | | YouthUtil.setPwd(getApplicationContext(), pwd); |
| | | Toast.makeText(this, "密码设置成功", Toast.LENGTH_SHORT).show(); |
| | | YouthUtil.openYouthMode(getApplicationContext()); |
| | | finish(); |
| | | } |
| | | |
| | | break; |
| | | case TYPE_VERIFY: { |
| | | String pwd = getInputPwd(); |
| | | if (!YouthUtil.isPwdRight(getApplicationContext(), pwd)) { |
| | | Toast.makeText(this, "密码错误", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | YouthUtil.closeYouthMode(getApplicationContext()); |
| | | Toast.makeText(this, "青少年模式已关闭", Toast.LENGTH_SHORT).show(); |
| | | } else { |
| | | YouthUtil.openYouthMode(getApplicationContext()); |
| | | Toast.makeText(this, "青少年模式已开启", Toast.LENGTH_SHORT).show(); |
| | | } |
| | | finish(); |
| | | } |
| | | |
| | | break; |
| | | case TYPE_UPDATE_OLD: { |
| | | String pwd = getInputPwd(); |
| | | if (!YouthUtil.isPwdRight(getApplicationContext(), pwd)) { |
| | | Toast.makeText(this, "原密码错误", Toast.LENGTH_SHORT).show(); |
| | | return; |
| | | } |
| | | startActivity(new Intent(this, YouthPwdActivity.class).putExtra("type", TYPE_UPDATE_NEW)); |
| | | finish(); |
| | | } |
| | | break; |
| | | case TYPE_UPDATE_NEW: { |
| | | String content = getInputPwd(); |
| | | YouthUtil.setPwd(getApplicationContext(), content); |
| | | Toast.makeText(this, "密码修改成功", Toast.LENGTH_SHORT).show(); |
| | | finish(); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.video.youth.ui.subview; |
| | | |
| | | import android.content.Context; |
| | | import android.util.AttributeSet; |
| | | import android.view.MotionEvent; |
| | | |
| | | import androidx.appcompat.widget.AppCompatEditText; |
| | | |
| | | public class MyEditText extends AppCompatEditText { |
| | | |
| | | private long lastTime = 0; |
| | | |
| | | public MyEditText(Context context) { |
| | | super(context); |
| | | } |
| | | |
| | | public MyEditText(Context context, AttributeSet attrs) { |
| | | super(context, attrs); |
| | | } |
| | | |
| | | public MyEditText(Context context, AttributeSet attrs, int defStyleAttr) { |
| | | super(context, attrs, defStyleAttr); |
| | | } |
| | | |
| | | @Override |
| | | protected void onSelectionChanged(int selStart, int selEnd) { |
| | | super.onSelectionChanged(selStart, selEnd); |
| | | this.setSelection(this.getText().length()); |
| | | } |
| | | |
| | | @Override |
| | | public boolean onTouchEvent(MotionEvent event) { |
| | | switch (event.getAction()) { |
| | | case MotionEvent.ACTION_DOWN: |
| | | long currentTime = System.currentTimeMillis(); |
| | | if (currentTime - lastTime < 500) { |
| | | lastTime = currentTime; |
| | | return true; |
| | | } else { |
| | | lastTime = currentTime; |
| | | } |
| | | break; |
| | | } |
| | | return super.onTouchEvent(event); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.video.youth.ui.subview; |
| | | |
| | | import android.content.Context; |
| | | import android.text.Editable; |
| | | import android.text.TextWatcher; |
| | | import android.util.AttributeSet; |
| | | import android.view.LayoutInflater; |
| | | import android.view.MotionEvent; |
| | | import android.view.View; |
| | | import android.widget.EditText; |
| | | import android.widget.RelativeLayout; |
| | | import android.widget.TextView; |
| | | |
| | | |
| | | import com.video.youth.R; |
| | | |
| | | import androidx.appcompat.widget.AppCompatEditText; |
| | | |
| | | public class VerifyCodeViewShowLine extends RelativeLayout { |
| | | |
| | | public EditText editText; |
| | | private TextView[] textViews; |
| | | private static int MAX = 4; |
| | | private String inputContent; |
| | | |
| | | public VerifyCodeViewShowLine(Context context) { |
| | | this(context, null); |
| | | } |
| | | |
| | | public VerifyCodeViewShowLine(Context context, AttributeSet attrs) { |
| | | this(context, attrs, 0); |
| | | } |
| | | |
| | | public VerifyCodeViewShowLine(Context context, AttributeSet attrs, int defStyleAttr) { |
| | | super(context, attrs, defStyleAttr); |
| | | View.inflate(context, R.layout.view_input_code, this); |
| | | textViews = new TextView[MAX]; |
| | | textViews[0] = findViewById(R.id.tv_code_1); |
| | | textViews[1] = findViewById(R.id.tv_code_2); |
| | | textViews[2] = findViewById(R.id.tv_code_3); |
| | | textViews[3] = findViewById(R.id.tv_code_4); |
| | | editText = findViewById(R.id.edit_text_view); |
| | | |
| | | editText.setCursorVisible(false);//隐藏光标 |
| | | setEditTextListener(); |
| | | } |
| | | |
| | | private void setEditTextListener() { |
| | | editText.addTextChangedListener(new TextWatcher() { |
| | | |
| | | @Override |
| | | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable editable) { |
| | | inputContent = editText.getText().toString(); |
| | | |
| | | if (inputCompleteListener != null) { |
| | | if (inputContent.length() >= MAX) { |
| | | inputCompleteListener.inputComplete(); |
| | | } else { |
| | | inputCompleteListener.invalidContent(); |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < MAX; i++) { |
| | | if (i < inputContent.length()) { |
| | | textViews[i].setText(String.valueOf(inputContent.charAt(i))); |
| | | } else { |
| | | textViews[i].setText(""); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | private InputCompleteListener inputCompleteListener; |
| | | |
| | | public void setInputCompleteListener(InputCompleteListener inputCompleteListener) { |
| | | this.inputCompleteListener = inputCompleteListener; |
| | | } |
| | | |
| | | public interface InputCompleteListener { |
| | | |
| | | void inputComplete(); |
| | | |
| | | void invalidContent(); |
| | | } |
| | | |
| | | public String getEditContent() { |
| | | return inputContent; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.video.youth.util; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.hanju.update.appupdate.util.StringUtils; |
| | | import com.video.youth.entity.YouthModeChange; |
| | | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | public class YouthUtil { |
| | | |
| | | /** |
| | | * 是否开启了青少年模式 |
| | | * |
| | | * @param context |
| | | * @return |
| | | */ |
| | | public static boolean isOpenYouthMode(Context context) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("youth_setting", Context.MODE_PRIVATE); |
| | | return sharedPreferences.getBoolean("open", false); |
| | | } |
| | | |
| | | /** |
| | | * 关闭青少年模式 |
| | | * |
| | | * @param context |
| | | */ |
| | | public static void openYouthMode(Context context) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("youth_setting", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putBoolean("open", true); |
| | | editor.commit(); |
| | | EventBus.getDefault().post(new YouthModeChange(true)); |
| | | } |
| | | |
| | | /** |
| | | * 关闭青少年模式 |
| | | * |
| | | * @param context |
| | | */ |
| | | public static void closeYouthMode(Context context) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("youth_setting", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putBoolean("open", false); |
| | | editor.commit(); |
| | | EventBus.getDefault().post(new YouthModeChange(false)); |
| | | } |
| | | |
| | | /** |
| | | * 设置密码 |
| | | * |
| | | * @param context |
| | | * @param pwd |
| | | */ |
| | | public static void setPwd(Context context, String pwd) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("youth_setting", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putString("pwd", pwd); |
| | | editor.commit(); |
| | | } |
| | | |
| | | /** |
| | | * 密码是否正确 |
| | | * |
| | | * @param context |
| | | * @param pwd |
| | | * @return |
| | | */ |
| | | public static boolean isPwdRight(Context context, String pwd) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("youth_setting", Context.MODE_PRIVATE); |
| | | String old = sharedPreferences.getString("pwd", ""); |
| | | return old.equalsIgnoreCase(pwd); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否设置了密码 |
| | | * |
| | | * @param context |
| | | * @return |
| | | */ |
| | | public static boolean isSetPwd(Context context) { |
| | | SharedPreferences sharedPreferences = context.getSharedPreferences("youth_setting", Context.MODE_PRIVATE); |
| | | String old = sharedPreferences.getString("pwd", ""); |
| | | return !StringUtils.isNullOrEmpty(old); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item android:drawable="@drawable/shape_btn" android:state_enabled="true"></item> |
| | | <item android:drawable="@drawable/shape_btn_invalid" android:state_enabled="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="40dp" /> |
| | | |
| | | <solid android:color="@color/btn_bg_color" /> |
| | | |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="40dp" /> |
| | | |
| | | <solid android:color="@color/btn_invalid_bg_color" /> |
| | | |
| | | </shape> |
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="#CECECE" /> |
| | | |
| | | </shape> |
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="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <include layout="@layout/item_nav"></include> |
| | | |
| | | <ProgressBar |
| | | android:id="@+id/myProgressBar" |
| | | style="?android:attr/progressBarStyleHorizontal" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" |
| | | android:background="#0B78E3" /> |
| | | |
| | | |
| | | <com.tencent.smtt.sdk.WebView |
| | | android:id="@+id/webview" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"></com.tencent.smtt.sdk.WebView> |
| | | |
| | | |
| | | </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="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <include layout="@layout/item_nav"></include> |
| | | |
| | | |
| | | <com.hanju.lib.library.widget.RatioLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.408"> |
| | | |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:src="@drawable/ic_youth_banner"></ImageView> |
| | | </com.hanju.lib.library.widget.RatioLayout> |
| | | |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_margin="22dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="@string/youth_notify_1" |
| | | android:textColor="#ff00a365" |
| | | android:textSize="15sp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="36dp" |
| | | android:text="@string/youth_notify_2" |
| | | android:textColor="#ff333333" |
| | | android:textSize="15sp" /> |
| | | |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:lineSpacingExtra="5dp" |
| | | android:text="建议青少年们适当观看本App中与学习课程、科普知识相关的内容等" |
| | | android:textColor="#fffe3c69" |
| | | android:textSize="15sp" /> |
| | | |
| | | |
| | | </LinearLayout> |
| | | </ScrollView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_open" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="50dp" |
| | | android:background="#35C791" |
| | | android:gravity="center" |
| | | android:text="开启青少年模式" |
| | | android:textColor="#FFFFFF" |
| | | android:textSize="18sp"> |
| | | |
| | | |
| | | </TextView> |
| | | |
| | | </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="match_parent" |
| | | android:background="#FFFFFF" |
| | | android:orientation="vertical"> |
| | | |
| | | |
| | | <include layout="@layout/item_nav"></include> |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" |
| | | android:background="#E0E0E0"></View> |
| | | |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="1" |
| | | android:paddingLeft="46dp" |
| | | android:paddingTop="46dp" |
| | | android:paddingRight="46dp"> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_title" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="23dp" |
| | | android:gravity="center" |
| | | android:text="请设置密码" |
| | | android:textColor="#ff000000" |
| | | android:textSize="24sp" /> |
| | | |
| | | |
| | | <com.video.youth.ui.subview.VerifyCodeViewShowLine |
| | | android:id="@+id/vcvs_pwd" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="140dp" |
| | | android:inputType="number" |
| | | android:maxLength="4"></com.video.youth.ui.subview.VerifyCodeViewShowLine> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_btn" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="44dp" |
| | | android:layout_marginTop="46dp" |
| | | android:background="@drawable/selector_btn" |
| | | android:enabled="false" |
| | | android:gravity="center" |
| | | android:text="确认设置" |
| | | android:textColor="@color/btn_text_color" |
| | | android:textSize="17sp" /> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_password" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="60dp" |
| | | android:gravity="center"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_pwd_update" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="修改密码" |
| | | android:textColor="@color/btn_bg_color" |
| | | android:textSize="11sp" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_pwd_forget" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="43dp" |
| | | android:text="找回密码" |
| | | android:textColor="@color/btn_bg_color" |
| | | android:textSize="11sp" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | | </ScrollView> |
| | | |
| | | |
| | | </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="48dp"> |
| | | |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/fl_nav" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#010101" |
| | | android:gravity="center_vertical"> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_left" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:layout_gravity="left|center_vertical" |
| | | android:drawableLeft="@drawable/ic_back" |
| | | android:drawablePadding="12dp" |
| | | android:gravity="center" |
| | | android:paddingLeft="10dp" |
| | | android:paddingRight="10dp" |
| | | android:text="返回" |
| | | android:textAppearance="?android:attr/textAppearanceMedium" |
| | | android:textColor="#ffffffff" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_middle" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:ellipsize="end" |
| | | android:maxLength="10" |
| | | android:textAppearance="?android:attr/textAppearanceLarge" |
| | | android:textColor="#ffffffff" /> |
| | | |
| | | |
| | | </FrameLayout> |
| | | |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:focusable="true" |
| | | android:focusableInTouchMode="true"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:clickable="false" |
| | | android:gravity="center"> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_code_1" |
| | | style="@style/code" |
| | | android:text=""></TextView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_code_2" |
| | | style="@style/code" |
| | | android:text=""></TextView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_code_3" |
| | | style="@style/code" |
| | | android:text=""></TextView> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_code_4" |
| | | style="@style/code" |
| | | android:text=""></TextView> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <EditText |
| | | android:id="@+id/edit_text_view" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="60dp" |
| | | android:background="@color/transparent" |
| | | android:inputType="number" |
| | | android:longClickable="false" |
| | | android:maxLength="4" |
| | | android:textColor="@color/transparent" |
| | | android:textSize="14sp" /> |
| | | |
| | | |
| | | </RelativeLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | <color name="btn_bg_color">#FF067cf6</color> |
| | | <color name="btn_text_color">#FFFFFF</color> |
| | | |
| | | <color name="btn_invalid_bg_color">#CECECE</color> |
| | | |
| | | |
| | | </resources> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | |
| | | <string name="youth_notify_1" translatable="false">为呵护未成年人健康成长、适度合理使用本App,影视大全推出青少年模式,该模式下包括但不限于对观看时间、付费购买VIP等有所限制,会提醒用户注意休息和提醒支付风险等,请找家长帮忙协助调整限制。</string> |
| | | <string name="youth_notify_2" translatable="false">青少年默认限制观看时长限制\n |
| | | 每天40分钟\n\n |
| | | 青少年默认限制观看时间段限制\n |
| | | 早上6:00-晚上10:00\n\n |
| | | 青少年默认限制资金往来\n |
| | | 购买视频VIP和发起本App内的任何支付\n\n |
| | | </string> |
| | | |
| | | <string name="forget_pwd" translatable="false">http://h5.hanju.yeshitv.com/hanju/youth/forget.html</string> |
| | | |
| | | </resources> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | |
| | | |
| | | <!-- 视频搜索结果页专辑视频按钮样式--> |
| | | <style name="code"> |
| | | <item name="android:layout_width">43dp</item> |
| | | <item name="android:layout_height">48dp</item> |
| | | <item name="android:gravity">center</item> |
| | | <item name="android:maxLength">1</item> |
| | | <item name="android:textColor">#000000</item> |
| | | <item name="android:textSize">20sp</item> |
| | | <item name="android:background">@drawable/shape_code_input</item> |
| | | <item name="android:layout_marginLeft">4.5dp</item> |
| | | <item name="android:layout_marginRight">4.5dp</item> |
| | | <item name="android:clickable">false</item> |
| | | </style> |
| | | |
| | | |
| | | </resources> |
New file |
| | |
| | | package com.yeshi.ec.search; |
| | | |
| | | import org.junit.Test; |
| | | |
| | | import static org.junit.Assert.*; |
| | | |
| | | /** |
| | | * Example local unit test, which will execute on the development machine (host). |
| | | * |
| | | * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> |
| | | */ |
| | | public class ExampleUnitTest { |
| | | @Test |
| | | public void addition_isCorrect() { |
| | | assertEquals(4, 2 + 2); |
| | | } |
| | | } |
| | |
| | | include ':library-ViewPagerIndicator' |
| | | include ':MDownloadProvider' |
| | | include ':library-mine' |
| | | include ':library-youth' |
| | | include ':library-base' |
| | | include ':app' |
| | | include ':APPUpdate' |
| | | include ':gallery' |
| | |
| | | api fileTree(include: '*', dir: 'libs') |
| | | |
| | | // api 'com.sina.weibo.sdk:core:4.4.3:openDefaultRelease@aar' |
| | | |
| | | api 'com.umeng.umsdk:common:9.4.2'// 必选 |
| | | api 'com.umeng.umsdk:asms:1.4.1'// 必选 |
| | | api 'com.umeng.umsdk:apm:1.4.2' // 错误分析升级为独立SDK,看crash数据请一定集成,可选 |
| | | |
| | | |
| | | api files('libs/umeng-apm-armeabi-v1.5.2.aar') |
| | | api files('libs/umeng-common-9.4.4.jar') |
| | | api files('libs/umeng-asms-armeabi-v1.4.1.aar') |
| | | api files('libs/open_sdk_r8353806_lite.jar') |
| | | api files('libs/umeng-share-core-7.1.6.jar') |
| | | api files('libs/umeng-share-QQ-full-7.1.6.jar') |
| | |
| | | api files('libs/umeng-sharetool-7.1.6.jar') |
| | | |
| | | api 'com.umeng.sdk:utdid:1.1.5.3' |
| | | |
| | | } |
| | | |
| | | android { |