| | |
| | | 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; |
| | |
| | | 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 { |
| | | |
| | |
| | | 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() { |
| | |
| | | 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) { |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onFailure(int code, String msg) { |
| | | Log.i(TAG,"百川初始化失败:"+code+"-"+msg); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |