From 1981dee5aec45793d3c4ebdbc4e637528c71b3c5 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 03 二月 2021 19:20:47 +0800 Subject: [PATCH] 'PPTV' --- BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoApplication.java | 92 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 77 insertions(+), 15 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoApplication.java b/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoApplication.java index b96f4ad..48eb81d 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoApplication.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/BeibeiVideoApplication.java @@ -5,17 +5,18 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.graphics.Color; +import android.content.SharedPreferences; +import android.os.Handler; +import android.os.Message; import android.support.multidex.MultiDex; import android.util.Log; -import android.widget.Toast; - import com.alibaba.baichuan.android.trade.AlibcTradeSDK; import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback; import com.baidu.mobads.AppActivity; import com.fun.xm.FSPlayer; -import com.iBookStar.views.YmConfig; +import com.funshion.playsdk.callback.FunshionPlayInitCallback; +import com.funshion.playsdk.register.IAuthCodeGetter; import com.lcjian.library.util.ManifestDataUtil; import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; import com.nostra13.universalimageloader.core.ImageLoader; @@ -30,14 +31,14 @@ import com.umeng.commonsdk.UMConfigure; import com.umeng.socialize.PlatformConfig; import com.umeng.socialize.UMShareAPI; -import com.weikou.beibeivideo.ui.video.FunshionPlayerFragment; import com.weikou.beibeivideo.util.BeibeiConstant; import com.weikou.beibeivideo.util.CrashHandler; import com.weikou.beibeivideo.util.FunshionConstant; -import com.weikou.beibeivideo.util.UserUtil; import com.weikou.beibeivideo.util.ad.TTAdManagerHolder; import com.weikou.beibeivideo.util.downutil.StringUtils; -import com.weikou.beibeivideo.util.novel.NovelJNZUtil; + +import org.apache.http.Header; +import org.json.JSONObject; public class BeibeiVideoApplication extends Application { @@ -57,6 +58,54 @@ return instance; } + private Handler handler = new Handler() { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + switch (msg.what) { + case 0: + if (authCodeCallBack != null) + BeibeiVideoAPI.getFuntvAuthCode(application, new BasicTextHttpResponseHandler() { + + @Override + public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { + if (jsonObject.optBoolean("IsPost")) { + String authCode = jsonObject.optString("Data"); + if (!StringUtils.isNullOrEmpty(authCode)) { + SharedPreferences.Editor editor = application.getSharedPreferences("funtv", Context.MODE_PRIVATE).edit(); + editor.putString("authCode", authCode); + editor.commit(); + } + authCodeCallBack.onSuccess(authCode); + } else { + SharedPreferences share = application.getSharedPreferences("funtv", Context.MODE_PRIVATE); + String authCode = share.getString("authCode", ""); + if (!StringUtils.isNullOrEmpty(authCode)) { + authCodeCallBack.onSuccess(authCode); + } + } + } + + @Override + public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { + super.onFailure(statusCode, headers, responseString, throwable); + SharedPreferences share = application.getSharedPreferences("funtv", Context.MODE_PRIVATE); + String authCode = share.getString("authCode", ""); + if (!StringUtils.isNullOrEmpty(authCode)) { + authCodeCallBack.onSuccess(authCode); + } + } + } + ); + + break; + + } + } + }; + + + private IAuthCodeGetter.AuthCodeCallBack authCodeCallBack; @Override public void onCreate() { @@ -88,20 +137,30 @@ initTaoKe(); try { //鍒濆鍖栨挱鏀炬彃浠� - FSPlayer.init(this, FunshionConstant.APICODE); + FSPlayer.init(this, FunshionConstant.APP_ID, new IAuthCodeGetter() { + @Override + public void getAuthCode(AuthCodeCallBack authCodeCallBack) { + BeibeiVideoApplication.this.authCodeCallBack = authCodeCallBack; + handler.sendEmptyMessage(0); + } + }, new FunshionPlayInitCallback() { + + @Override + public void onSuccess() { + Log.i(TAG, "椋庤鎾斁鍣ㄥ垵濮嬪寲鎴愬姛"); + } + + @Override + public void onFail(int i, String s) { + Log.i(TAG, "椋庤鎾斁鍣ㄥ垵濮嬪寲澶辫触锛�" + i + "-" + s); + } + }); } catch (Exception e) { } //鐧惧害鍐呭鑱旂洘 try { AppActivity.setActionBarColorTheme(AppActivity.ActionBarColorTheme.ACTION_BAR_BLACK_THEME); - } catch (Exception e) { - - } - try { - //鑱氳兘璧� - YmConfig.initNovel(this, "8845"); - NovelJNZUtil.setUid(this); } catch (Exception e) { } @@ -132,8 +191,11 @@ @Override public void onFailure(int code, String msg) { + Log.i(TAG,"鐧惧窛鍒濆鍖栧け璐ワ細"+code+"-"+msg); } }); + + } -- Gitblit v1.8.0