15个文件已删除
67个文件已修改
54个文件已添加
| | |
| | | android:name=".ui.recommend.SearchActivity" |
| | | android:label="@string/app_name" |
| | | android:windowSoftInputMode="stateHidden"></activity> |
| | | |
| | | |
| | | <activity |
| | | android:name=".ui.SimpleBrowserActivity" |
| | | android:label="@string/app_name" |
| | | android:windowSoftInputMode="stateHidden"></activity> |
| | | <activity |
| | | android:name=".ui.mine.SystemMessageActivity" |
| | | android:label="@string/app_name"></activity> |
| | |
| | | <activity |
| | | android:name=".ui.category.StarDetailActivity" |
| | | android:label="@string/app_name"></activity> |
| | | |
| | | |
| | | |
| | | |
| | | <service android:name=".service.DownLoadFileService" /> |
| | |
| | | android:authorities="${applicationId}.TTMultiProvider" |
| | | android:exported="false" /> |
| | | |
| | | |
| | | <!--百度内容联盟 --> |
| | | <activity |
| | | android:name="com.baidu.mobads.AppActivity" |
| | |
| | | api project(':MyselfSuperAd') |
| | | api project(':social_sdk_library_project') |
| | | api files('lib/wup-1.0.0.E-SNAPSHOT.jar') |
| | | api files('lib/Xg_sdk_v3.0_20170301_1733.jar') |
| | | api files('lib/jg_filter_sdk_1.1.jar') |
| | | api files('lib/fastjson-1.2.9.jar') |
| | | api files('lib/open_ad_sdk.aar') |
| | | api files('lib/open_ad_sdk_4.0.0.6.aar') |
| | | |
| | | implementation 'androidx.legacy:legacy-support-v4:1.0.0' |
| | | //阿里百川 |
| | |
| | | implementation project(path: ':library-base') |
| | | implementation project(path: ':library-search') |
| | | implementation project(path: ':library-video') |
| | | implementation project(path: ':library-youth') |
| | | |
| | | |
| | | } |
| | | android { |
| | | signingConfigs { |
| | | debug { |
| | | storeFile file('D:\\项目\\影音\\签名\\FastTortoisekey') |
| | | storePassword 'weikou2014' |
| | | keyAlias '乌龟快快' |
| | | keyPassword 'weikou2014' |
| | | // storeFile file('D:\\项目\\影音\\签名\\FastTortoisekey') |
| | | // storePassword 'weikou2014' |
| | | // keyAlias '乌龟快快' |
| | | // keyPassword 'weikou2014' |
| | | //华为木瓜 |
| | | storeFile file('D:\\项目\\影音\\签名\\qumikey') |
| | | storePassword 'weikou2016' |
| | | keyAlias 'qumi' |
| | | keyPassword 'weikou2016' |
| | | } |
| | | } |
| | | buildTypes { |
| | |
| | | targetCompatibility JavaVersion.VERSION_1_8 |
| | | } |
| | | defaultConfig { |
| | | applicationId "com.mugua.mgvideo" |
| | | versionCode 84 |
| | | versionName "2.4.4" |
| | | // applicationId "com.mugua.mgvideo" |
| | | applicationId "com.qm.fbvideo" |
| | | //84 |
| | | versionCode 85 |
| | | versionName "2.4.5" |
| | | multiDexEnabled = true |
| | | ndk { |
| | | abiFilters "armeabi-v7a", "x86", "armeabi" |
| | | abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' |
| | | } |
| | | |
| | | // resValue "string", "app_name", "影视大全精简版" |
| | |
| | | resValue "string", "about_us_url", "http://h5.mugua.yeshitv.com/abountOur/index.html" |
| | | manifestPlaceholders = [app_icon: "@drawable/ic_launcher", splashLayout: "activity_splash"] |
| | | |
| | | //木瓜 |
| | | // resValue "string", "umeng_key", "55360d5b67e58eaf86002c0d" |
| | | // resValue "string", "qq_id", "1104492673" |
| | | // resValue "string", "qq_key", "AI6ri4IcDhsacEoP" |
| | | // resValue "string", "ad_csj_app_id", "5123000" |
| | | |
| | | //*********华为木瓜开始********** |
| | | resValue "string", "umeng_key", "56a1dfbe67e58e6bb10002a2" |
| | | resValue "string", "qq_id", "" |
| | | resValue "string", "qq_key", "AI6ri4IcDhsacEoP" |
| | | resValue "string", "ad_csj_app_id", "5123000" |
| | | resValue "string", "ad_csj_pid_splash", "887407507" |
| | | resValue "string", "ad_csj_pid_video_detail_fullvideo", "945640921" |
| | | resValue "string", "ad_csj_pid_recommend_big", "946382923" |
| | | resValue "string", "ad_csj_pid_pptv_insert", "946909947" |
| | | |
| | | |
| | | //华为木瓜 |
| | | // resValue "string", "umeng_key", "56a1dfbe67e58e6bb10002a2" |
| | | // resValue "string", "qq_id", "" |
| | | // resValue "string", "qq_key", "" |
| | | // resValue "string", "ad_csj_app_id", "5123000" |
| | | |
| | | |
| | | resValue "string", "ad_gdt_app_id", "1106495463" |
| | | resValue "string", "ad_gdt_pid_splash", "4011340484841820" |
| | | resValue "string", "ad_gdt_pid_home_recommend", "5011840464486076" |
| | | resValue "string", "ad_gdt_pid_2_video_list_column2", "6032700999360323" |
| | | resValue "string", "ad_gdt_pid_2_video_list_column3", "4042804929362396" |
| | | resValue "string", "ad_gdt_pid_2_search_result_album", "1052004949566734" |
| | | resValue "string", "ad_gdt_pid_home_and_play_big_picture", "5011840464486076" |
| | | resValue "string", "ad_gdt_pid_template_search_result", "" |
| | | resValue "string", "ad_gdt_pid_exit_dialog", "3071141484940803" |
| | | resValue "string", "ad_gdt_pid_video_detail_insert", "1002940790571485" |
| | | resValue "string", "ad_gdt_pid_pptv_insert", "8072445701746253" |
| | | |
| | | |
| | | |
| | | resValue "string", "baidu_app_id", "b085a885" |
| | | //*********华为木瓜结束********** |
| | | } |
| | | |
| | | // productFlavors { |
New file |
| | |
| | | { |
| | | "version": 2, |
| | | "artifactType": { |
| | | "type": "APK", |
| | | "kind": "Directory" |
| | | }, |
| | | "applicationId": "com.qm.fbvideo", |
| | | "variantName": "processReleaseResources", |
| | | "elements": [ |
| | | { |
| | | "type": "SINGLE", |
| | | "filters": [], |
| | | "versionCode": 85, |
| | | "versionName": "2.4.5", |
| | | "outputFile": "MGVideo-release.apk" |
| | | } |
| | | ] |
| | | } |
| | |
| | | android:textColor="@color/black" |
| | | android:textSize="20sp" /> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | android:autoLink="all" |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_height="260dp" |
| | | android:layout_marginLeft="10dp" |
| | | android:textSize="10sp" |
| | | android:lineSpacingExtra="8sp" |
| | | android:background="@null" |
| | | android:layout_marginRight="10dp"></TextView> |
| | | android:layout_marginRight="10dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:autoLink="all" |
| | | android:background="@null" |
| | | android:lineSpacingExtra="8sp" |
| | | android:textSize="14sp"></TextView> |
| | | |
| | | </ScrollView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | android:drawableRight="@drawable/arrow_right" |
| | | android:gravity="center_vertical" /> |
| | | </RelativeLayout> |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" /> |
| | | <RelativeLayout |
| | | android:id="@+id/rl_youth" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
| | | android:background="@drawable/selector_color_item_bg" |
| | | android:padding="8dp" > |
| | | |
| | | <TextView |
| | | style="@style/TextBlackMedium" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_alignParentLeft="true" |
| | | android:layout_alignParentStart="true" |
| | | android:layout_centerVertical="true" |
| | | android:drawableLeft="@drawable/ic_youth" |
| | | android:drawablePadding="8dp" |
| | | android:drawableStart="@drawable/ic_youth" |
| | | android:gravity="center_vertical" |
| | | android:text="青少年模式" /> |
| | | |
| | | <TextView |
| | | style="@style/TextGrayNormal" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_alignParentEnd="true" |
| | | android:layout_alignParentRight="true" |
| | | android:layout_centerVertical="true" |
| | | android:drawableEnd="@drawable/arrow_right" |
| | | android:drawablePadding="8dp" |
| | | android:drawableRight="@drawable/arrow_right" |
| | | android:gravity="center_vertical" /> |
| | | </RelativeLayout> |
| | | |
| | | <View |
| | | 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> |
| | |
| | | <string name="after_login">登录后享受更多服务</string> |
| | | <string name="review_edit">我也来说两句...</string> |
| | | <string name="review_deliver">发表</string> |
| | | <string name="umeng_key">55360d5b67e58eaf86002c0d</string> |
| | | <string name="qq_id">1104492673</string> |
| | | <string name="qq_key">AI6ri4IcDhsacEoP</string> |
| | | |
| | | |
| | | |
| | | |
| | |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.base.utils.http.API; |
| | | |
| | | public class MGVideoAPI { |
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | public static void commonGet(Context context, String url, |
| | | LinkedHashMap<String, String> params, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | params.put("Package",PackageUtils2.getPackageName(context)); |
| | | params.put("Package", PackageUtils2.getPackageName(context)); |
| | | LinkedHashMap<String, String> map = validateParams(params, context); |
| | | |
| | | RequestParams requestParams = new RequestParams(map); |
| | |
| | | package com.mugua.mgvideo; |
| | | |
| | | import android.Manifest; |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.content.pm.PackageManager.NameNotFoundException; |
| | | import android.graphics.Bitmap.Config; |
| | | import android.os.Build; |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.Log; |
| | | |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | | import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback; |
| | | import com.baidu.mobads.AppActivity; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.fun.xm.FSPlayer; |
| | | import com.funshion.playsdk.callback.FunshionPlayInitCallback; |
| | | import com.funshion.playsdk.register.IAuthCodeGetter; |
| | |
| | | import com.lcjian.library.util.common.PackageUtils2; |
| | | import com.mugua.mgvideo.util.CrashHandler; |
| | | import com.mugua.mgvideo.util.FunshionConstant; |
| | | import com.mugua.mgvideo.util.SDCardUtil; |
| | | import com.mugua.mgvideo.util.UserUtil; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.assist.QueueProcessingType; |
| | | import com.qq.e.comm.managers.GDTADManager; |
| | | import com.qq.e.comm.managers.GDTAdSdk; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.umeng.socialize.PlatformConfig; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.ad.CSJConstant; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.ad.TTAdManagerHolder; |
| | | import com.yeshi.base.utils.downutil.StringUtils; |
| | |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.multidex.MultiDex; |
| | | |
| | | public class MGVideoApplication extends Application { |
| | | |
| | |
| | | public static String MMNumber; |
| | | public static boolean showAd = true; |
| | | private static String TAG = "MGVideoApplication"; |
| | | |
| | | public static boolean inited; |
| | | |
| | | //兼容4.4以下版本 |
| | | protected void attachBaseContext(Context newBase) { |
| | | super.attachBaseContext(newBase); |
| | | MultiDex.install(this); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onCreate() { |
| | |
| | | super.onCreate(); |
| | | //同意用户协议 |
| | | if (UserUtil.isAgreeUserProtocol(this) || BeibeiConstant.DEBUG) { |
| | | init(this); |
| | | init(this, null); |
| | | } |
| | | } |
| | | |
| | | public static void init(Application application) { |
| | | public static void init(Application application, final InitListener initListener) { |
| | | inited = true; |
| | | try { |
| | | TelephonyManager manager = (TelephonyManager) application.getSystemService(TELEPHONY_SERVICE); |
| | | Build bd = new Build(); |
| | | String model = bd.MODEL; |
| | | MGVideoApplication.deviceName = model; |
| | | if ((ActivityCompat.checkSelfPermission(application, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)) { |
| | | MGVideoApplication.deviceNumber = manager.getDeviceId(); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | // 初始化大设备 |
| | | SDCardUtil.initStorage(application); |
| | | |
| | | initImageLoader(application); |
| | | //友盟初始化 |
| | | UMConfigure.setLogEnabled(true); |
| | | String description = ManifestDataUtil.getAppMetaData(application, "UMENG_CHANNEL"); |
| | | UMConfigure.setEncryptEnabled(true); |
| | | UMConfigure.preInit(application, application.getResources().getString(R.string.umeng_key), description); |
| | | UMConfigure.init(application, application.getResources().getString(R.string.umeng_key), description, UMConfigure.DEVICE_TYPE_PHONE, null); |
| | | // 选用AUTO页面采集模式 |
| | | MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); |
| | |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | initAd(application); |
| | | initFunshion(application); |
| | | initAd(application, initListener); |
| | | // initFunshion(application); |
| | | ARouter.init(application); |
| | | ARouter.openDebug(); |
| | | ARouter.openLog(); |
| | | } |
| | | |
| | | private static void initFunshion(Application application) { |
| | |
| | | /** |
| | | * 穿山甲广告初始化 |
| | | */ |
| | | private static void initAd(Application application) { |
| | | TTAdManagerHolder.init(application); |
| | | GDTADManager.getInstance().initWith(application, application.getString(R.string.ad_gdt_app_id)); |
| | | private static void initAd(Application application, final InitListener initListener) { |
| | | //初始化广告位 |
| | | CSJConstant.SPLASH_AD = application.getString(R.string.ad_csj_pid_splash); |
| | | CSJConstant.CODE_FULL_VIDEO_VIDEO_DETAIL = application.getString(R.string.ad_csj_pid_video_detail_fullvideo); |
| | | CSJConstant.RECOMMEND_BIG_IMG_AD = application.getString(R.string.ad_csj_pid_recommend_big); |
| | | |
| | | GDTConstant.GDT_SPLASH_AD_ID = application.getString(R.string.ad_gdt_pid_home_and_play_big_picture); |
| | | GDTConstant.PID_HOME_RECOMMEND_BIG_IMG = application.getString(R.string.ad_gdt_pid_home_recommend); |
| | | GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN2 = application.getString(R.string.ad_gdt_pid_2_video_list_column2); |
| | | GDTConstant.PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 = application.getString(R.string.ad_gdt_pid_2_video_list_column3); |
| | | GDTConstant.PID_2_SEARCH_RESULT_ALBUM = application.getString(R.string.ad_gdt_pid_2_search_result_album); |
| | | GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE = application.getString(R.string.ad_gdt_pid_home_and_play_big_picture); |
| | | GDTConstant.GDT_TEMPLATE_SEARCH_RESULT = application.getString(R.string.ad_gdt_pid_template_search_result); |
| | | GDTConstant.GDT_EXIT_DIALOG = application.getString(R.string.ad_gdt_pid_exit_dialog); |
| | | |
| | | GDTAdSdk.init(application, application.getString(R.string.ad_gdt_app_id)); |
| | | |
| | | TTAdManagerHolder.init(application, 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(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | //初始化监听 |
| | | public interface InitListener { |
| | | public void onFinish(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | } |
| | | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.mugua.mgvideo.ui; |
| | | |
| | | import android.app.Activity; |
| | | import android.graphics.PixelFormat; |
| | | import android.net.http.SslError; |
| | | import android.view.KeyEvent; |
| | | import android.view.View.OnClickListener; |
| | | import android.view.ViewGroup; |
| | | import android.webkit.SslErrorHandler; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.ProgressBar; |
| | | |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.util.browser.BaseBWJavaInterface; |
| | | |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | public class SimpleBrowserActivity extends FragmentActivity implements OnClickListener { |
| | | private final static String TAG = "SimpleBrowserActivity"; |
| | | |
| | | private android.widget.TextView tv_top_bar_left; |
| | | private android.widget.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) { |
| | | android.util.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(android.view.View.GONE); |
| | | } else { |
| | | if (android.view.View.INVISIBLE == progressBar.getVisibility()) { |
| | | progressBar.setVisibility(android.view.View.VISIBLE); |
| | | } |
| | | progressBar.setProgress(i); |
| | | } |
| | | super.onProgressChanged(webView, i); |
| | | } |
| | | }); |
| | | android.webkit.WebSettings webSetting = webview.getSettings(); |
| | | webSetting.setJavaScriptEnabled(true); |
| | | webSetting.setTextZoom(100); |
| | | webview.addJavascriptInterface(new BaseBWJavaInterface(this), "yestv"); |
| | | } |
| | | |
| | | private boolean needSetResult = false; |
| | | |
| | | @Override |
| | | protected void onCreate(android.os.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_left.setVisibility(android.view.View.VISIBLE); |
| | | tv_top_bar_middle = findViewById(R.id.tv_top_bar_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(); |
| | | 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(android.view.View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_top_bar_left: { |
| | | if (!webview.canGoBack()) |
| | | finishPage(); |
| | | else { |
| | | webview.goBack(); |
| | | } |
| | | } |
| | | 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 com.mugua.mgvideo.util.ad.SplashAdUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.ad.AdTypeEnum; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.CSJConstant; |
| | |
| | | import java.util.List; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | 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; |
| | | |
| | |
| | | return; |
| | | } |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | |
| | | String splashLayout = ManifestDataUtil.getAppMetaData(this, "SPLASH_LAYOUT"); |
| | | |
| | | int resourceId = getResources().getIdentifier(splashLayout, |
| | | "layout", getPackageName()); |
| | | |
| | | |
| | | setContentView(resourceId); |
| | | fl_ad = findViewById(R.id.fl_splash_ad); |
| | | 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 = bd.MODEL; |
| | | MGVideoApplication.deviceName = model; |
| | | if ((ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)) { |
| | | MGVideoApplication.deviceNumber = manager.getDeviceId(); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | // 初始化大设备 |
| | | SDCardUtil.initStorage(this); |
| | | showProtocol(); |
| | | } |
| | | |
| | | |
| | | private void showProtocol() { |
| | | String appName = getString(R.string.app_name); |
| | | |
| | | String data = "感谢您对" + appName + "一直以来的信任!<br>"; |
| | | data += "我们依照新的监管要求条例更新了"; |
| | | String data = "尊敬的用户:<br>感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | | data += "我们非常尊重并保护您的个人信息、隐私。为了更好的保障您的权利,在您使用我们的产品之前,请您务必审慎阅读"; |
| | | data += String.format("<a href='%s'>《隐私政策》</a>和", getString(R.string.privacy)); |
| | | data += String.format("<a href='%s'>《用户协议》</a>", getString(R.string.agreement)); |
| | | data += "为采取相应安全保护措施,尽力保护您的个人信息安全可控,特向你说明如下:<br>" + |
| | | "1、您在使用" + appName + "各项产品或服务时,将会提供与具体功能相关的个人信息(可能涉及帐号、位置、存储等信息)。<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>" + |
| | | "如您对协议有任何疑虑,可通过电子邮箱: kaouapp@qq.com 向我们询问,我们将为您竭诚解答。您点击“同意并继续”的行为代表您已阅读完毕并接受以上协议全部条款。如您同意以上协议内容,请您点击“同意并继续”,开始使用您的产品。"; |
| | | |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())) { |
| | | new UserProtocolDialog.Builder(this).setNegativeButton("不同意", new DialogInterface.OnClickListener() { |
| | |
| | | }).setPositiveButton("同意并继续", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | |
| | | dialog.dismiss(); |
| | | UserUtil.agreeUserProtocol(getApplicationContext()); |
| | | MGVideoApplication.init(MGVideoApplication.application); |
| | | //进行下一步 |
| | | if (Build.VERSION.SDK_INT >= 23) { |
| | | checkAndRequestPermission(); |
| | |
| | | MGVideoAPI.getUid(this, "", MGVideoAPI.getDeviceId(this), null, |
| | | null, "", "", |
| | | new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, |
| | | Header[] headers, JSONObject jsonObject) |
| | |
| | | }); |
| | | } |
| | | |
| | | private void next() { |
| | | int delayMS = 1000; |
| | | |
| | | private void nextStep() { |
| | | getUid(); |
| | | fl_ad.postDelayed(new Runnable() { |
| | | @Override |
| | |
| | | if (StringUtils.isBlank(pid)) { |
| | | if (splash != null) { |
| | | if (splash == AdTypeEnum.csj) { |
| | | pid = CSJConstant.SPLASH_AD; |
| | | pid = getString(R.string.ad_csj_pid_splash);//CSJConstant.SPLASH_AD; |
| | | } else if (splash == AdTypeEnum.gdt) { |
| | | pid = GDTConstant.PID_SPLASH_HOT; |
| | | pid = getString(R.string.ad_gdt_pid_splash);//GDTConstant.GDT_SPLASH_AD_ID; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | }, 1000); |
| | | }, delayMS); |
| | | } |
| | | |
| | | private void next() { |
| | | if (!MGVideoApplication.inited) { |
| | | MGVideoApplication.init(MGVideoApplication.application, new MGVideoApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | delayMS = 1; |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | nextStep(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | nextStep(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("欢迎页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("欢迎页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @TargetApi(Build.VERSION_CODES.M) |
| | | private void checkAndRequestPermission() { |
| | | List<String> lackedPermission = new ArrayList<String>(); |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | boolean showPermission = sharedPreferences.getBoolean("show", true); |
| | | |
| | | if (!(ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED)) { |
| | | |
| | | lackedPermission.add(Manifest.permission.READ_PHONE_STATE); |
| | | } |
| | | |
| | | if (!(ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) { |
| | | lackedPermission.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); |
| | | } |
| | | // if (!(ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) { |
| | | // lackedPermission.add(Manifest.permission.WRITE_EXTERNAL_STORAGE); |
| | | // } |
| | | |
| | | if (lackedPermission.size() != 0) { |
| | | if (lackedPermission.size() != 0 && showPermission) { |
| | | // 请求所缺少的权限,在onRequestPermissionsResult中再看是否获得权限,如果获得权限就可以调用SDK,否则不要调用SDK。 |
| | | String[] requestPermissions = new String[lackedPermission.size()]; |
| | | lackedPermission.toArray(requestPermissions); |
| | |
| | | for (int i = 0; i < permissions.length; i++) { |
| | | if (grantResults[i] == PERMISSION_GRANTED) {//选择了“始终允许” |
| | | checkAndRequestPermission(); |
| | | } else if (grantResults[i] == PERMISSION_DENIED) { |
| | | //记录禁止状态 |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putBoolean("show", false); |
| | | editor.commit(); |
| | | next(); |
| | | } else { |
| | | next(); |
| | | } |
| | |
| | | @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("明星详情页"); |
| | | } |
| | | |
| | | private void getHotStarDetail() { |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("主界面—分类—频道"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主界面—分类—频道"); |
| | | } |
| | | |
| | | private String getKey(String method) { |
| | |
| | | @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 |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("内部福利页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("内部福利页"); |
| | | } |
| | | |
| | | private void getVideoList() { |
| | |
| | | // @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 |
| | |
| | | // @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 |
| | |
| | | |
| | | private void loadAD() { |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(getContext(), new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | GDTConstant.GDT_APP_ID, GDTConstant.GDT_TEMPLATE_SEARCH_RESULT, new NativeExpressAD.NativeExpressADListener() { |
| | | GDTConstant.GDT_TEMPLATE_SEARCH_RESULT, new NativeExpressAD.NativeExpressADListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | if (list != null && list.size() > 0) { |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("娱乐直播详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("娱乐直播详情页"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.ui.SimpleBrowserActivity; |
| | | import com.mugua.mgvideo.util.ui.TextViewUtil; |
| | | import com.ysh.wpc.appupdate.util.StringUtils; |
| | | |
| | |
| | | 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 android.telephony.TelephonyManager; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.widget.RadioButton; |
| | | import android.widget.RadioGroup; |
| | | import android.widget.RadioGroup.OnCheckedChangeListener; |
| | |
| | | import com.mugua.mgvideo.R; |
| | | import com.mugua.mgvideo.entity.recommend.HomeClass; |
| | | import com.umeng.socialize.UMShareAPI; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.MGVideoApplication; |
| | |
| | | if (isLogin) { |
| | | getNewInfo(); |
| | | } |
| | | |
| | | if (YouthUtil.isOpenYouthMode(getApplicationContext())) { |
| | | findViewById(R.id.rb_nav_short_video).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.GONE); |
| | | } else { |
| | | findViewById(R.id.rb_nav_short_video).setVisibility(View.GONE); |
| | | findViewById(R.id.rb_nav_category).setVisibility(View.VISIBLE); |
| | | findViewById(R.id.rb_shop).setVisibility(View.VISIBLE); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.RequestOptions; |
| | | import com.google.gson.FieldNamingPolicy; |
| | |
| | | import com.umeng.socialize.media.UMWeb; |
| | | import com.yeshi.base.ui.LoginActivity; |
| | | import com.yeshi.base.ui.PersonInfoActivity; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.mugua.mgvideo.MGVideoAPI; |
| | | import com.mugua.mgvideo.db.MessageTable; |
| | |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.mugua.mgvideo.util.GlideCircleTransform; |
| | | import com.mugua.mgvideo.widget.BadgeView; |
| | | import com.yeshi.ec.youth.ui.YouthActivity; |
| | | |
| | | import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; |
| | | |
| | |
| | | @Override |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | |
| | | ARouter.getInstance().inject(this); |
| | | tv_no_network = contentView.findViewById(R.id.tv_no_network); |
| | | tv_no_network.setOnClickListener(this); |
| | | contentView.findViewById(R.id.rl_youth).setOnClickListener(this); |
| | | |
| | | mChangeHelper = new ConnectivityChangeHelper(getActivity(), |
| | | new OnConnectivityChangeListener() { |
| | |
| | | //意见反馈 |
| | | startActivity(new Intent(getContext(), SuggestionActivity.class)); |
| | | break; |
| | | |
| | | case R.id.rl_youth: |
| | | // ARouter.getInstance().build(RouteConstant.PATH_YOUTH) |
| | | // .navigation(); |
| | | getContext().startActivity(new Intent(getContext(), YouthActivity.class)); |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | getUserInfo(); |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("主页面—我的"); |
| | | SharedPreferences preferences2 = getActivity().getSharedPreferences( |
| | | "update", Context.MODE_PRIVATE); |
| | | if (preferences2.getBoolean("status", false)) { |
| | |
| | | } else { |
| | | mUpdateBadgeView.hide(); |
| | | } |
| | | |
| | | if (YouthUtil.isOpenYouthMode(getContext())) { |
| | | rl_history.setVisibility(View.GONE); |
| | | rl_favourites.setVisibility(View.GONE); |
| | | } else { |
| | | rl_history.setVisibility(View.VISIBLE); |
| | | rl_favourites.setVisibility(View.VISIBLE); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("主页面—我的"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | mChangeHelper.registerReceiver(); |
| | | btn_delete.setChecked(false); |
| | | ll_recent_bottom.setVisibility(View.GONE); |
| | | MobclickAgent.onPageStart("主页面—最近"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("主页面—最近"); |
| | | } |
| | | |
| | | boolean isSelected = false; |
| | |
| | | import com.yeshi.base.entity.JumpDetail; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.entity.ad.ExpressAdContainer; |
| | | import com.yeshi.base.entity.eventbus.YouthModeChange; |
| | | import com.yeshi.base.entity.video.VideoInfo; |
| | | import com.yeshi.base.utils.JumpActivityUtil; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.CSJConstant; |
| | | import com.yeshi.base.utils.ad.ExpressAdManager; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.base.utils.ui.DividerItemDecoration; |
| | | import com.yeshi.video.ui.VideoDetailActivity; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONArray; |
| | |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | public class RecommendNewFragment extends RetainViewFragment implements |
| | | OnClickListener { |
| | |
| | | |
| | | private TextView tv_go_search; |
| | | |
| | | private SwipeRefreshLayout.OnRefreshListener mRefreshListener = new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | //加载广告 |
| | | loadAd(); |
| | | getHomeAd(); |
| | | Log.i("mResult", "onCreate---setOnRefreshListener---loadAD1"); |
| | | } |
| | | }; |
| | | |
| | | public static Fragment newInstance(HomeClass homeClass, int position) { |
| | | RecommendNewFragment fragment = new RecommendNewFragment(); |
| | | Bundle bundle = new Bundle(); |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | EventBus.getDefault().register(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | }); |
| | | |
| | | rl_recommend.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | |
| | | //加载广告 |
| | | loadAd(); |
| | | getHomeAd(); |
| | | Log.i("mResult", "onCreate---setOnRefreshListener---loadAD1"); |
| | | } |
| | | }); |
| | | rl_recommend.setOnRefreshListener(mRefreshListener); |
| | | |
| | | if (mHomeTypes == null) |
| | | mHomeTypes = new ArrayList(); |
| | |
| | | return new Md5FileNameGenerator().generate(method); |
| | | } |
| | | |
| | | private static boolean needRefresh = false; |
| | | |
| | | public void onEventMainThread(YouthModeChange youth) { |
| | | needRefresh = true; |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | indicator_recommend.setViewPager(vp_recommend); |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("主页面—推荐"); |
| | | if (YouthUtil.isOpenYouthMode(getContext())) { |
| | | tv_go_search.setVisibility(View.GONE); |
| | | } else { |
| | | tv_go_search.setVisibility(View.VISIBLE); |
| | | } |
| | | if (needRefresh) { |
| | | needRefresh = false; |
| | | rl_recommend.setRefreshing(true); |
| | | mRefreshListener.onRefresh(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("主页面—推荐"); |
| | | } |
| | | |
| | | private String content; |
| | |
| | | @Override |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | |
| | | private List<HomeVideo> adList1 = new ArrayList<>(); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("帮助与反馈"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("帮助与反馈"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("收藏页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("收藏页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } else { |
| | | mBadge.hide(); |
| | | } |
| | | MobclickAgent.onPageStart("设置页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("设置页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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 + " = ? ", |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | // MobclickAgent.onPageStart("主页面——最近——下载"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主页面——最近——缓存"); |
| | | } |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("主页面——最近——缓存"); |
| | | if (mStatus) { |
| | | ll_storage.setVisibility(View.GONE); |
| | | } else { |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mAdapter.setSelectedMode(false); |
| | | MobclickAgent.onPageStart("主页面——最近——观看记录"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主页面——最近——观看记录"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | getHotSearch(); |
| | | getHistorySearch(); |
| | | guessLike();// 聚效广告取消 |
| | | if (AdUtil.getAdType(getApplicationContext(), AdPositionEnum.other) != null) { |
| | | loadAD(); |
| | | } else { |
| | | } |
| | | guessLike(); |
| | | loadAD(); |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("搜索页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("搜索页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (AdUtil.getAdType(this, AdPositionEnum.videoSearch) == null) |
| | | return; |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(this, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | GDTConstant.GDT_APP_ID, GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() { |
| | | GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | tv_back.post(new Runnable() { |
| | |
| | | if (AdUtil.getAdType(context, AdPositionEnum.exitApp) == null) |
| | | return; |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(context, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | GDTConstant.GDT_APP_ID, GDTConstant.GDT_EXIT_DIALOG, new NativeExpressAD.NativeExpressADListener() { |
| | | GDTConstant.GDT_EXIT_DIALOG, new NativeExpressAD.NativeExpressADListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | fl_advertisement.post(new Runnable() { |
| | |
| | | .setExpressViewAcceptedSize(w, h) |
| | | .setOrientation(TTAdConstant.VERTICAL) |
| | | .build(); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (ttAdManager == null) { |
| | | return; |
| | | } |
| | | |
| | | mTTAdNative = ttAdManager.createAdNative(context); |
| | | //加载全屏视频 |
| | | mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() { |
| | |
| | | @Override |
| | | public void onFullScreenVideoCached() { |
| | | } |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | mttFullVideoAd = ttFullScreenVideoAd; |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | package com.mugua.mgvideo.util.ad; |
| | | |
| | | import android.app.Activity; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.TextView; |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTSplashAd; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.mugua.mgvideo.R; |
| | | import com.qq.e.ads.splash.SplashAD; |
| | | import com.qq.e.ads.splash.SplashADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | |
| | | import com.yeshi.base.utils.downutil.StringUtils; |
| | | |
| | | public class SplashAdUtil { |
| | | |
| | | private static final String TAG ="SplashAdUtil" ; |
| | | |
| | | /** |
| | | * 加载开屏广告 |
| | |
| | | |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | if (StringUtils.isNullOrEmpty(code)) |
| | | code = GDTConstant.GDT_SPLASH_AD_ID; |
| | | new SplashAD(context, GDTConstant.GDT_APP_ID, code, new SplashADListener() { |
| | | code =context.getString(R.string.ad_gdt_pid_splash); |
| | | new SplashAD(context, context.getString(com.yeshi.video.R.string.ad_gdt_app_id), code, new SplashADListener() { |
| | | @Override |
| | | public void onADDismissed() { |
| | | splashAdListener.close(); |
| | |
| | | private static void loadCSJ(String code, Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) { |
| | | if (skip != null) |
| | | skip.setVisibility(View.GONE); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (ttAdManager == null) { |
| | | splashAdListener.noAd(); |
| | | return; |
| | | } |
| | | |
| | | TTAdNative mTTAdNative = ttAdManager.createAdNative(context.getApplicationContext()); |
| | | //穿山甲广告 |
| | | int width = DimenUtils.getScreenWidth(context.getApplicationContext()); |
| | |
| | | |
| | | @Override |
| | | public void onError(int i, String s) { |
| | | Log.i(TAG,s); |
| | | splashAdListener.noAd(); |
| | | } |
| | | |
| | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | },3500); |
| | | |
| | | |
| | | } |
| | |
| | | * @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) { |
| | |
| | | public final static int VIEW_TYPE_SMALLVIDEO = 2; |
| | | public final static int VIEW_TYPE_VIDEO = 3; |
| | | |
| | | private final String YOUR_APP_ID = "fc4e132a"; // 双引号中填写自己的APPSID |
| | | private String YOUR_APP_ID = "fc4e132a"; // 双引号中填写自己的APPSID |
| | | private List<IBasicCPUData> nrAdList = new ArrayList<IBasicCPUData>(); |
| | | private NativeCPUManager mCpuManager; |
| | | private int mChannelId = 1001; // 默认娱乐频道 |
| | |
| | | viewType = bundle.getInt("viewType"); |
| | | bundle.clear(); |
| | | mChannelId = item.getId(); |
| | | |
| | | YOUR_APP_ID = getString(R.string.baidu_app_id); |
| | | mCpuManager = new NativeCPUManager(getContext(), YOUR_APP_ID, this); |
| | | /** |
| | | * 可选设置: 设置暗黑模式或调整内容详情页的字体大小 |
New file |
| | |
| | | <resources> |
| | | <string name="baidu_app_id">fc4e132a</string> |
| | | </resources> |
| | |
| | | implementation 'com.google.android.material:material:1.1.0' |
| | | implementation project(path: ':library-common') |
| | | api files('libs/android-async-http-1.4.8.jar') |
| | | implementation project(path: ':EventBus') |
| | | testImplementation 'junit:junit:4.+' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | api files("libs/open_ad_sdk.aar") |
| | | api 'com.qq.e.union:union:+' |
| | | api files("libs/open_ad_sdk_4.0.0.6.aar") |
| | | //广点通SDK |
| | | api 'com.qq.e.union:union:4.420.1290' |
| | | api 'org.apache.httpcomponents:httpcore:4.4.2' |
| | | //加载动画库 |
| | | api 'com.github.ybq:Android-SpinKit:1.4.0' |
| | | |
| | | api project(':social_sdk_library_project') |
| | | |
| | | api files('libs/tbs_sdk_thirdapp_v3.5.0.1004_43500_sharewithdownload_withoutGame_obfs_20170801_113025.jar') |
| | | api files('libs/tbs_sdk_thirdapp_v4.3.0.185_44085.jar') |
| | | |
| | | |
| | | //安全组件 |
New file |
| | |
| | | package com.yeshi.base.entity.eventbus; |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | // MobclickAgent.onResume(this); |
| | | } |
| | | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | // MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | tv_login.setOnClickListener(this); |
| | | findViewById(R.id.tv_user_agreement).setOnClickListener(this); |
| | | findViewById(R.id.tv_privacy).setOnClickListener(this); |
| | | //查询 |
| | | if (StringUtils.isEmpty(getString(R.string.qq_id))) { |
| | | findViewById(R.id.ll_third_login).setVisibility(View.GONE); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | Context.MODE_PRIVATE).getString("LoginUid", ""))) { |
| | | finish(); |
| | | } |
| | | MobclickAgent.onPageStart("登陆页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("登陆页"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | public final static String PATH_VIDEO_DETAIL = "/video/detail"; |
| | | |
| | | public final static String PATH_YOUTH = "/setting/youth"; |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.base.utils; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.yeshi.base.entity.eventbus.YouthModeChange; |
| | | import com.yeshi.base.utils.downutil.StringUtils; |
| | | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.base.utils.ad; |
| | | |
| | | public class CSJConstant { |
| | | public final static String APP_ID="5115334"; |
| | | |
| | | |
| | | //视频详情 |
| | | public static String CODE_FULL_VIDEO_VIDEO_DETAIL = "945573782"; |
| | | |
| | |
| | | |
| | | //开屏广告 |
| | | public static String SPLASH_AD = "887396145"; |
| | | |
| | | //开屏广告热启动 |
| | | public static String SPLASH_AD_HOT = "887455481"; |
| | | |
| | | //软件退出广告 |
| | | public static String APP_EXIT = "945469133"; |
| | | |
| | | //视频前贴 |
| | | public static String PLAY_VIDEO_PRE = "945379614"; |
| | | |
| | | //视频详情页视频播放器底部 |
| | | public static String VIDEO_DETAIL_PLAYER_BOTTOM = "945548900"; |
| | | |
| | | //视频详情页猜你喜欢底部 |
| | | public static String VIDEO_DETAIL_GUESSLIKE_TOP = "945548915"; |
| | | |
| | | //视频搜索页 |
| | | public static String VIDEO_SEARCH = "945552227"; |
| | | |
| | | //PPTV激励视频 |
| | | public static String VIDEO_REWARD_PPTV = "945914112"; |
| | | |
| | | |
| | | //影视豆激励视频 |
| | | public static String GOLDCORN_REWARD_PPTV = "946039290"; |
| | | |
| | | |
| | | //无效广告 |
| | | public static String INVALID_AD = "111111111"; |
| | | |
| | | public static String PPTV_INTERSTITIALAD="946078773"; |
| | | |
| | |
| | | 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) { |
| | |
| | | ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | |
| | | }); |
| | | ad.getCsj().render(); |
| | |
| | | if (activity != null) |
| | | ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() { |
| | | |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s) { |
| | | public void onShow() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSelected(int i, String s, boolean b) { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRefuse() { |
| | | |
| | | } |
| | | |
| | | }); |
| | | } |
| | |
| | | |
| | | public class GDTConstant { |
| | | |
| | | public static String GDT_APP_ID = "1106112837"; |
| | | |
| | | public static String GDT_SPLASH_AD_ID = "6081008616843580";// 开屏广告位ID |
| | | |
| | | public static String PID_HOME_RECOMMEND_BIG_IMG = "2002104884851984"; |
| | | |
| | | public static String PID_VIDEO_DETAIL_PLAYER = "5061928359494942"; |
| | | |
| | | public static String PID_SPLASH_HOT = "4081479119572059"; |
| | | //视频播放器下方广告位 |
| | | public static String PID_2_VIDEO_DETAIL_PLAY_EXPRESS1 = "9031528552257617"; |
| | | //相关视频下方广告位 |
| | | public static String PID_2_VIDEO_DETAIL_PLAY_EXPRESS2 = "7091428572856609"; |
| | | //视频列表 - 自渲染 |
| | | public static String PID_2_VIDEO_LIST_SMALL_AD_COLUMN3 = "4061924585347177"; |
| | | //自渲染 |
| | |
| | | //专辑搜索结果 |
| | | public static String PID_2_SEARCH_RESULT_ALBUM = "4062403844473309"; |
| | | |
| | | |
| | | //PPTV视频前贴 |
| | | public static String PID_2_VIDEO_DETAIL_PLAYER_PRE_PPTV = "5091266068484315"; |
| | | |
| | | //PPTV激励视频 |
| | | public static String PID_2_VIDEO_DETAIL_PLAYER_REWARD_PPTV = "9051467743649673"; |
| | | |
| | | //影视豆激励视频 |
| | | public static String PID_2_GOLDCORN_REWARD = "9051467743649673"; |
| | | |
| | | //搜索 |
| | | public static final String GDT_HOME_AND_PLAY_BIG_PICTURE = "3041305616723820"; |
| | | public static String GDT_HOME_AND_PLAY_BIG_PICTURE = "3041305616723820"; |
| | | |
| | | //视频列表页面 |
| | | public static String GDT_TEMPLATE_SEARCH_RESULT="9071202636920710"; |
| | | public static String GDT_TEMPLATE_SEARCH_RESULT = "9071202636920710"; |
| | | |
| | | //APP退出 |
| | | public static final String GDT_EXIT_DIALOG = "8051402676338159"; |
| | | public static String GDT_EXIT_DIALOG = "8051402676338159"; |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.base.utils.ad; |
| | | |
| | | import android.content.Context; |
| | | import android.util.Log; |
| | | |
| | | import com.bytedance.sdk.openadsdk.TTAdConfig; |
| | | import com.bytedance.sdk.openadsdk.TTAdConstant; |
| | |
| | | */ |
| | | public class TTAdManagerHolder { |
| | | |
| | | private static boolean sInit; |
| | | private static final String TAG = "TTAdManagerHolder"; |
| | | |
| | | |
| | | 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) { |
| | | doInit(context); |
| | | public static void init(Context context, TTAdSdk.InitCallback initCallback) { |
| | | doInit(context, initCallback); |
| | | } |
| | | |
| | | //step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明 |
| | | private static void doInit(Context context) { |
| | | if (!sInit) { |
| | | private static void doInit(Context context, TTAdSdk.InitCallback initCallback) { |
| | | if (!TTAdSdk.isInitSuccess()) { |
| | | try { |
| | | TTAdSdk.init(context, buildConfig(context)); |
| | | sInit = true; |
| | | TTAdSdk.init(context, buildConfig(context), initCallback); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } else { |
| | | if (initCallback != null) { |
| | | initCallback.success(); |
| | | } |
| | | } |
| | | } |
| | |
| | | .appName(context.getString(R.string.app_name)) |
| | | .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK) |
| | | .allowShowNotify(true) //是否允许sdk展示通知栏提示 |
| | | .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页 |
| | | .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 |
| | | .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) |
| | | .supportMultiProcess(true)//是否支持多进程 |
| | | .asyncInit(true) |
| | | .needClearTaskReset() |
| | | //.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。 |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | import com.loopj.android.http.RequestParams; |
| | | import com.loopj.android.http.ResponseHandlerInterface; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | |
| | | : params.get("Uid")).append(params.get("System")); |
| | | 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; |
| | | } |
| | |
| | | } |
| | | |
| | | public static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler) { |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler) { |
| | | commonPost(context, url, params, files, handler, true); |
| | | } |
| | | |
| | | public static void commonPost(Context context, String url, |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | LinkedHashMap<String, String> params, HashMap<String, File> files, |
| | | ResponseHandlerInterface handler, boolean asyn) { |
| | | params.put("Package", "com.mugua.mgvideo");//context.getPackageName() |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | params.put("Version", version + ""); |
| | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/ll_third_login" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="30dp" |
| | |
| | | <resources> |
| | | <string name="agreement" translatable="false">http://111.231.250.166/mugua/userAgreenment.html</string> |
| | | <string name="privacy" translatable="false">http://111.231.250.166/mugua/userAgreenment.html</string> |
| | | <string name="rule_email">0123456789abcdefghijklmnopqrstuvwxyz@.</string> |
| | | <string name="rule_password">0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`¬!"£$%^*()~=#{}[];':,./?/*-_+<>@&</string> |
| | | <string name="user_agreement">用户使用协议&隐私条款</string> |
| | | <!-- 广告 --> |
| | | <string name="ad_csj_app_id">5115334</string> |
| | | <string name="ad_gdt_app_id">1106112837</string> |
| | | <string name="rule_email" translatable="false">0123456789abcdefghijklmnopqrstuvwxyz@.</string> |
| | | <string name="rule_password" translatable="false">0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`¬!"£$%^*()~=#{}[];':,./?/*-_+<>@&</string> |
| | | <string name="user_agreement" translatable="false">用户使用协议&隐私条款</string> |
| | | <!-- ##########穿山甲广告开始########## --> |
| | | <string name="ad_csj_app_id" translatable="false">5115334</string> |
| | | <!-- 开屏 --> |
| | | <string name="ad_csj_pid_splash" translatable="false">887396145</string> |
| | | <!-- 视频详情 --> |
| | | <string name="ad_csj_pid_video_detail_fullvideo" translatable="false">945573782</string> |
| | | <!-- 首页推荐大图 --> |
| | | <string name="ad_csj_pid_recommend_big" translatable="false">946360135</string> |
| | | |
| | | <string name="ad_csj_pid_pptv_insert" translatable="false">946909932</string> |
| | | |
| | | <!-- ##########穿山甲广告结束########## --> |
| | | |
| | | |
| | | <!-- ##########广点通广告开始########## --> |
| | | <string name="ad_gdt_app_id" translatable="false">1106112837</string> |
| | | <string name="ad_gdt_pid_splash" translatable="false">6081008616843580</string> |
| | | <string name="ad_gdt_pid_home_recommend" translatable="false">2002104884851984</string> |
| | | <string name="ad_gdt_pid_2_video_list_column2" translatable="false">3002604884575372</string> |
| | | <string name="ad_gdt_pid_2_video_list_column3" translatable="false">4061924585347177</string> |
| | | <string name="ad_gdt_pid_2_search_result_album" translatable="false">4062403844473309</string> |
| | | <string name="ad_gdt_pid_home_and_play_big_picture" translatable="false">3041305616723820</string> |
| | | <string name="ad_gdt_pid_template_search_result" translatable="false">9071202636920710</string> |
| | | <string name="ad_gdt_pid_exit_dialog" translatable="false">8051402676338159</string> |
| | | <string name="ad_gdt_pid_video_detail_insert" translatable="false">6062144740668570</string> |
| | | <string name="ad_gdt_pid_pptv_insert" translatable="false">2062545731747292</string> |
| | | |
| | | |
| | | <!-- ##########广点通广告结束########## --> |
| | | |
| | | <string name="umeng_key" translatable="false">55360d5b67e58eaf86002c0d</string> |
| | | <string name="qq_id" translatable="false">1104492673</string> |
| | | <string name="qq_key" translatable="false">AI6ri4IcDhsacEoP</string> |
| | | |
| | | </resources> |
| | |
| | | } |
| | | |
| | | public static String getPackageName(Context context) { |
| | | return context.getPackageName(); |
| | | return "com.mugua.mgvideo";//context.getPackageName(); |
| | | } |
| | | } |
| | |
| | | api files('libs/FunshionBase-2.0.0.0.aar') |
| | | api files('libs/FunshionPlaySDK-2.0.0.2-buwanysdq.aar') |
| | | |
| | | provided files('libs/library-VideoPlayer.aar') |
| | | api files('libs/library-VideoPlayer.aar') |
| | | annotationProcessor'com.alibaba:arouter-compiler:1.2.2' |
| | | |
| | | } |
| | |
| | | if (AdUtil.getAdType(getContext(), AdPositionEnum.other) == null) |
| | | return; |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(getContext(), new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | GDTConstant.GDT_APP_ID, GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() { |
| | | GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | if (list.size() > 0) { |
| | |
| | | import com.yeshi.base.utils.user.UserUtil; |
| | | import com.yeshi.video.R; |
| | | import com.yeshi.video.entity.FunshionPlayInfo; |
| | | import com.yeshi.video.player.common.IVideoPlayerListener; |
| | | import com.yeshi.video.player.common.VideoDefinition; |
| | | import com.yeshi.video.player.common.VideoEpisode; |
| | | import com.yeshi.video.player.common.VideoPlayerController; |
| | |
| | | import androidx.annotation.Nullable; |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | public class FunshionPlayerFragment extends RetainViewFragment implements OnClickListener, VideoPlayerController.IVideoPlayerListener { |
| | | public class FunshionPlayerFragment extends RetainViewFragment implements OnClickListener, IVideoPlayerListener { |
| | | private final static String TAG = FunshionPlayerFragment.class.getName(); |
| | | |
| | | //媒体视频播放器 |
| | |
| | | episodes.add(es); |
| | | } |
| | | |
| | | vpc_funshion.setContentView(fl_container).setVideoInfo(episodes, info.getPosition(), mVideoInfo.getShowType(), "风行").setVideoPlayerListener(this).build(getActivity(), FunshionPlayerFragment.this); |
| | | try { |
| | | vpc_funshion.setContentView(fl_container).setVideoInfo(episodes, info.getPosition(), mVideoInfo.getShowType(), "风行").setVideoPlayerListener(this).build(getActivity(), FunshionPlayerFragment.this); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // loadAD(new IADLoadListener() { |
| | | // @Override |
| | | // public void finishAd() { |
| | |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.lcjian.library.RetainViewFragment; |
| | | import com.lcjian.library.util.common.ClipboardUtil; |
| | | 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.analytics.MobclickAgent; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | | import com.yeshi.base.ui.dialog.LoadingDialogUtil; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.CSJConstant; |
| | | import com.yeshi.video.R; |
| | | import com.yeshi.video.utils.PPJavaInterface; |
| | |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | |
| | | showInterstitialAd(); |
| | | return super.onCreateView(inflater, container, savedInstanceState); |
| | | } |
| | | |
| | |
| | | TTFullScreenVideoAd mttFullVideoAd = null; |
| | | |
| | | private boolean isInterstitialAdShown = false; |
| | | private UnifiedInterstitialAD iad; |
| | | |
| | | private void showInterstitialAd() { |
| | | if (isInterstitialAdShown) |
| | | return; |
| | | if (AdUtil.getAdType(getContext(), AdPositionEnum.videoDetailFullVideo) == null) { |
| | | return; |
| | | } |
| | | |
| | | TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(getContext()); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(CSJConstant.PPTV_INTERSTITIALAD) |
| | | //模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可 |
| | | .setExpressViewAcceptedSize(300, 500) |
| | | .setSupportDeepLink(true) |
| | | .setOrientation(TTAdConstant.VERTICAL)//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL |
| | | .build(); |
| | | mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() { |
| | | //请求广告失败 |
| | | @Override |
| | | public void onError(int code, String message) { |
| | | boolean csj = TTAdSdk.isInitSuccess(); |
| | | if (csj) { |
| | | TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(getContext()); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(getString(R.string.ad_csj_pid_pptv_insert)) |
| | | //模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可 |
| | | .setExpressViewAcceptedSize(300, 500) |
| | | .setSupportDeepLink(true) |
| | | .setOrientation(TTAdConstant.VERTICAL)//必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL |
| | | .build(); |
| | | mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() { |
| | | //请求广告失败 |
| | | @Override |
| | | public void onError(int code, String message) { |
| | | |
| | | } |
| | | |
| | | //广告物料加载完成的回调 |
| | | @Override |
| | | public void onFullScreenVideoAdLoad(TTFullScreenVideoAd ad) { |
| | | mttFullVideoAd = ad; |
| | | mttFullVideoAd.setFullScreenVideoAdInteractionListener(new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() { |
| | | //广告的展示回调 |
| | | @Override |
| | | public void onAdShow() { |
| | | isInterstitialAdShown = true; |
| | | } |
| | | |
| | | //广告的下载bar点击回调 |
| | | @Override |
| | | public void onAdVideoBarClick() { |
| | | |
| | | } |
| | | |
| | | //广告关闭的回调 |
| | | @Override |
| | | public void onAdClose() { |
| | | |
| | | } |
| | | |
| | | //视频播放完毕的回调 |
| | | @Override |
| | | public void onVideoComplete() { |
| | | |
| | | } |
| | | |
| | | //跳过视频播放 |
| | | @Override |
| | | public void onSkippedVideo() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //广告视频/图片加载完成的回调,接入方可以在这个回调后展示广告 |
| | | @Override |
| | | public void onFullScreenVideoCached() { |
| | | if (mttFullVideoAd != null) { |
| | | //展示广告,并传入广告展示的场景 |
| | | if (getActivity() != null) |
| | | mttFullVideoAd.showFullScreenVideoAd(getActivity(), TTAdConstant.RitScenes.GAME_GIFT_BONUS, null); |
| | | mttFullVideoAd = null; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | //广告物料加载完成的回调 |
| | | @Override |
| | | public void onFullScreenVideoAdLoad(TTFullScreenVideoAd ad) { |
| | | mttFullVideoAd = ad; |
| | | mttFullVideoAd.setFullScreenVideoAdInteractionListener(new TTFullScreenVideoAd.FullScreenVideoAdInteractionListener() { |
| | | //广告的展示回调 |
| | | @Override |
| | | public void onAdShow() { |
| | | isInterstitialAdShown = true; |
| | | } |
| | | |
| | | //广告的下载bar点击回调 |
| | | @Override |
| | | public void onAdVideoBarClick() { |
| | | |
| | | } |
| | | |
| | | //广告关闭的回调 |
| | | @Override |
| | | public void onAdClose() { |
| | | |
| | | } |
| | | |
| | | //视频播放完毕的回调 |
| | | @Override |
| | | public void onVideoComplete() { |
| | | |
| | | } |
| | | |
| | | //跳过视频播放 |
| | | @Override |
| | | public void onSkippedVideo() { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //广告视频/图片加载完成的回调,接入方可以在这个回调后展示广告 |
| | | @Override |
| | | public void onFullScreenVideoCached() { |
| | | if (mttFullVideoAd != null) { |
| | | //展示广告,并传入广告展示的场景 |
| | | if (getActivity() != null) |
| | | mttFullVideoAd.showFullScreenVideoAd(getActivity(), TTAdConstant.RitScenes.GAME_GIFT_BONUS, null); |
| | | mttFullVideoAd = null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | if (ttFullScreenVideoAd != null) { |
| | | //展示广告,并传入广告展示的场景 |
| | | if (getActivity() != null) |
| | | ttFullScreenVideoAd.showFullScreenVideoAd(getActivity(), TTAdConstant.RitScenes.GAME_GIFT_BONUS, null); |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | iad = new UnifiedInterstitialAD(getActivity(), getString(R.string.ad_gdt_pid_pptv_insert), new UnifiedInterstitialADListener() { |
| | | |
| | | @Override |
| | | public void onADReceive() { |
| | | iad.showAsPopupWindow(getActivity()); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoCached() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | |
| | | Log.i("gdt", adError.toString()); |
| | | } |
| | | |
| | | @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() { |
| | | |
| | | } |
| | | }); |
| | | VideoOption.Builder builder = new VideoOption.Builder(); |
| | | VideoOption |
| | | option = builder.setAutoPlayMuted(true) |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI).build(); |
| | | iad.setVideoOption(option); |
| | | iad.loadAD(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.bumptech.glide.Glide; |
| | | import com.bumptech.glide.request.target.SimpleTarget; |
| | | import com.bumptech.glide.request.transition.Transition; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.bytedance.sdk.openadsdk.TTFullScreenVideoAd; |
| | | import com.google.gson.FieldNamingPolicy; |
| | | import com.google.gson.Gson; |
| | |
| | | import com.lcjian.library.util.SystemCommon; |
| | | import com.lcjian.library.util.common.DimenUtils; |
| | | import com.lcjian.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.UMShareAPI; |
| | | import com.yeshi.base.entity.AccumulateRule; |
| | | import com.yeshi.base.entity.ad.AdPositionEnum; |
| | |
| | | import com.yeshi.base.utils.BeibeiConstant; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.ad.AdUtil; |
| | | import com.yeshi.base.utils.ad.GDTConstant; |
| | | import com.yeshi.base.utils.ad.TTAdManagerHolder; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.video.R; |
| | | import com.yeshi.video.entity.PushEpisode; |
| | |
| | | if (!mFunshionPlayerFragment.isAdded()) { |
| | | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_video_play_container, mFunshionPlayerFragment).commit(); |
| | | } |
| | | fl_video_play_background.setVisibility(View.GONE); |
| | | hideImage(); |
| | | |
| | | |
| | | } else {// |
| | |
| | | /** |
| | | * 加载全屏视频广告 |
| | | */ |
| | | private UnifiedInterstitialAD iad; |
| | | |
| | | private void loadFullVideoAd() { |
| | | if (adShown) |
| | | return; |
| | | adShown = true; |
| | | |
| | | if (AdUtil.getAdType(getApplicationContext(), AdPositionEnum.videoDetailFullVideo) != null) { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess(TTFullScreenVideoAd ad) { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity.this); |
| | | } |
| | | }); |
| | | |
| | | if (TTAdSdk.isInitSuccess()) { |
| | | FullVideoAdManager.getInstance().loadAd(getApplicationContext(), new FullVideoAdManager.IFullVideoAdListener() { |
| | | @Override |
| | | public void onSuccess(TTFullScreenVideoAd ad) { |
| | | FullVideoAdManager.getInstance().showAd(VideoDetailActivity.this); |
| | | } |
| | | }); |
| | | } else { |
| | | iad = new UnifiedInterstitialAD(this, getString(R.string.ad_gdt_pid_video_detail_insert), new UnifiedInterstitialADListener() { |
| | | |
| | | @Override |
| | | public void onADReceive() { |
| | | iad.showAsPopupWindow(VideoDetailActivity.this); |
| | | } |
| | | |
| | | @Override |
| | | public void onVideoCached() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | |
| | | Log.i("gdt", adError.toString()); |
| | | } |
| | | |
| | | @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() { |
| | | |
| | | } |
| | | }); |
| | | VideoOption.Builder builder = new VideoOption.Builder(); |
| | | VideoOption |
| | | option = builder.setAutoPlayMuted(true) |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI).build(); |
| | | iad.setVideoOption(option); |
| | | iad.loadAD(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | EventBus.getDefault().register(this); |
| | | MobclickAgent.onPageStart("播放详情页—小屏播放"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | EventBus.getDefault().unregister(this); |
| | | MobclickAgent.onPageEnd("播放详情页——小屏播放"); |
| | | } |
| | | |
| | | public void onEventMainThread(ContentValues values) { |
| | |
| | | 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) { |
| | |
| | | if (AdUtil.getAdType(getContext(), AdPositionEnum.other) == null) |
| | | return; |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(getContext(), new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), |
| | | GDTConstant.GDT_APP_ID, GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() { |
| | | GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() { |
| | | @Override |
| | | public void onADLoaded(final List<NativeExpressADView> list) { |
| | | if (list.size() > 1) { |
| | |
| | | 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("播放详情页或者电视剧下载页——下载"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("播放详情页或者电视剧下载页——下载"); |
| | | } |
| | | |
| | | // 提交缓存记录 |
| | |
| | | @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("播放详情-评论"); |
| | | EventBus.getDefault().register(this); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("播放详情-评论"); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | |
| | |
| | | .setExpressViewAcceptedSize(w, h) |
| | | .setOrientation(TTAdConstant.VERTICAL) |
| | | .build(); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (ttAdManager == null) { |
| | | return; |
| | | } |
| | | |
| | | mTTAdNative = ttAdManager.createAdNative(context); |
| | | //加载全屏视频 |
| | | mTTAdNative.loadFullScreenVideoAd(adSlot, new TTAdNative.FullScreenVideoAdListener() { |
| | |
| | | @Override |
| | | public void onFullScreenVideoCached() { |
| | | } |
| | | |
| | | @Override |
| | | public void onFullScreenVideoCached(TTFullScreenVideoAd ttFullScreenVideoAd) { |
| | | mttFullVideoAd = ttFullScreenVideoAd; |
| | | } |
| | | }); |
| | | } |
| | | |
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" |
| | | |
| | | javaCompileOptions { |
| | | annotationProcessorOptions { |
| | | arguments = [AROUTER_MODULE_NAME: project.getName()] |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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 project(path: ':library-base') |
| | | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' |
| | | implementation project(path: ':library-common') |
| | | testImplementation 'junit:junit:4.+' |
| | | androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
| | | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
| | | |
| | | annotationProcessor'com.alibaba:arouter-compiler:1.2.2' |
| | | |
| | | } |
New file |
| | |
| | | # Add project specific ProGuard rules here. |
| | | # You can control the set of applied configuration files using the |
| | | # proguardFiles setting in build.gradle. |
| | | # |
| | | # For more details, see |
| | | # http://developer.android.com/guide/developing/tools/proguard.html |
| | | |
| | | # If your project uses WebView with JS, uncomment the following |
| | | # and specify the fully qualified class name to the JavaScript interface |
| | | # class: |
| | | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
| | | # public *; |
| | | #} |
| | | |
| | | # Uncomment this to preserve the line number information for |
| | | # debugging stack traces. |
| | | #-keepattributes SourceFile,LineNumberTable |
| | | |
| | | # If you keep the line number information, uncomment this to |
| | | # hide the original source file name. |
| | | #-renamesourcefileattribute SourceFile |
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.yeshi.ec.youth"> |
| | | |
| | | <application> |
| | | <activity |
| | | android:name=".ui.YouthActivity" |
| | | android:screenOrientation="portrait"></activity> |
| | | <activity |
| | | android:name=".ui.YouthPwdActivity" |
| | | android:screenOrientation="portrait"></activity> |
| | | </application> |
| | | </manifest> |
New file |
| | |
| | | package com.yeshi.ec.youth.ui; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.android.arouter.facade.annotation.Route; |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | import com.androidquery.AQuery; |
| | | import com.yeshi.base.ui.BaseActivity; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.ec.youth.R; |
| | | |
| | | @Route(path = RouteConstant.PATH_YOUTH) |
| | | public class YouthActivity extends BaseActivity 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); |
| | | ARouter.getInstance().inject(this); |
| | | 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.yeshi.ec.youth.ui; |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextWatcher; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.widget.EditText; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.android.arouter.facade.annotation.Route; |
| | | import com.alibaba.android.arouter.launcher.ARouter; |
| | | import com.androidquery.AQuery; |
| | | import com.yeshi.base.ui.BaseActivity; |
| | | import com.yeshi.base.ui.BrowserActivity; |
| | | import com.yeshi.base.utils.RouteConstant; |
| | | import com.yeshi.base.utils.YouthUtil; |
| | | import com.yeshi.ec.youth.R; |
| | | import com.yeshi.ec.youth.ui.subview.VerifyCodeViewShowLine; |
| | | |
| | | import org.w3c.dom.Text; |
| | | |
| | | public class YouthPwdActivity extends BaseActivity 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); |
| | | ARouter.getInstance().inject(this); |
| | | 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.yeshi.ec.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.yeshi.ec.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.yeshi.ec.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.yeshi.ec.youth.util; |
| | | |
| | | import android.content.Context; |
| | | |
| | | import com.lcjian.library.util.common.StringUtils; |
| | | import com.yeshi.base.utils.http.API; |
| | | import com.yeshi.base.utils.http.BasicTextHttpResponseHandler; |
| | | import com.yeshi.base.utils.user.UserUtil; |
| | | |
| | | import java.util.LinkedHashMap; |
| | | |
| | | import static com.yeshi.base.utils.http.API.commonPost; |
| | | |
| | | public class YouthApiUtil { |
| | | |
| | | /** |
| | | * 建议搜索 |
| | | * |
| | | * @param context |
| | | * @param key |
| | | * @param responseHandler |
| | | */ |
| | | public static void suggestSearch(Context context, String key, |
| | | BasicTextHttpResponseHandler responseHandler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | params.put("Key", key); |
| | | String uid = UserUtil.getUid(context); |
| | | if (!StringUtils.isEmpty(uid)) { |
| | | params.put("Uid", uid); |
| | | } |
| | | params.put("Method","suggestSearch"); |
| | | commonPost(context, API.BASE_URL+"user", params, responseHandler); |
| | | } |
| | | |
| | | |
| | | public static void search(Context context, String key, String videoType, int page, |
| | | BasicTextHttpResponseHandler responseHandler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
| | | if (key != null) |
| | | params.put("Key", key); |
| | | if (videoType != null) |
| | | params.put("Type", videoType); |
| | | String uid = UserUtil.getUid(context); |
| | | if (!StringUtils.isEmpty(uid)) { |
| | | params.put("Uid", uid); |
| | | } |
| | | params.put("Method","searchNew"); |
| | | params.put("Page", page + ""); |
| | | commonPost(context, API.BASE_URL+"user", params, responseHandler); |
| | | } |
| | | |
| | | |
| | | } |
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> |
| | | |
| | | |
| | | <com.lcjian.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.lcjian.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.yeshi.ec.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.yeshi.ec.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">#0036FF</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.mugua.yeshitv.com/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-base' |
| | | include ':library-search' |
| | | include ':library-youth' |
| | | include ':library-video' |
| | | include ':MyselfSuperAd' |
| | | include ':GuangDianTongSDK' |
| | |
| | | |
| | | dependencies { |
| | | api fileTree(include: '*.jar', dir: 'libs') |
| | | api files('libs/umeng-asms-armeabi-v1.1.3.aar') |
| | | api files('libs/umeng-common-9.2.4.jar') |
| | | api files('libs/umeng-crash-armeabi-v0.0.4.aar') |
| | | 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.1.jar') |
| | | api files('libs/umeng-share-QQ-full-7.1.1.jar') |
| | | api files('libs/umeng-share-sina-full-7.1.1.jar') |
| | | api files('libs/umeng-share-wechat-full-7.1.1.jar') |
| | | api files('libs/umeng-sharetool-7.1.1.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-share-sina-full-7.1.6.jar') |
| | | api files('libs/umeng-share-wechat-full-7.1.6.jar') |
| | | api files('libs/umeng-sharetool-7.1.6.jar') |
| | | |
| | | } |
| | | |
| | | android { |