Example #1
0
 private void initSections() {
   if (!NetWorkManager.getInstance(getBaseContext()).isNetAvailable()) {
     return;
   }
   ThreadUtils.execute(
       new Runnable() {
         @Override
         public void run() {
           Section.updateRootSection(AiYouApplication.getInstance());
         }
       });
 }
Example #2
0
 private void checkNewMessage() {
   // 检查是否是访客身份
   if (BBSManager.GUEST.equals(BBSManager.getInstance(getBaseContext()).getUserId())) {
     return;
   }
   // 是否有网络连接
   if (!NetWorkManager.getInstance(getBaseContext()).isNetAvailable()) {
     return;
   }
   ThreadUtils.execute(new ReplyRunnable());
   ThreadUtils.execute(new AtRunnable());
   ThreadUtils.execute(new MailRunnable());
 }
Example #3
0
 private void initFavorite() {
   if (Favorite.mFavorite != null) {
     return;
   }
   if (!NetWorkManager.getInstance(getBaseContext()).isNetAvailable()) {
     return;
   }
   ThreadUtils.execute(
       new Runnable() {
         @Override
         public void run() {
           String strJson = Favorite.getFavorite(AiYouApplication.getInstance(), 0);
           if (!TextUtils.isEmpty(strJson) && JsonHelper.checkError(strJson) == null) {
             Favorite.mFavorite = new Favorite(strJson);
           }
         }
       });
 }
Example #4
0
  @Override
  public void onCreate() {
    super.onCreate();
    mInstance = this;
    /** 初始化 */
    AiYouManager.getInstance(this);
    NetWorkManager.getInstance(this);
    SwitchManager.getInstance(this);

    if (FileManager.checkSDCard()) {
      removeExpiredCache();
    } else {
      Toast.makeText(getBaseContext(), "SD卡未安装或空间不足", Toast.LENGTH_SHORT).show();
    }

    try {
      // 百度地图初始化
      SDKInitializer.initialize(this);
      initEngineManager(this);
    } catch (Exception e) {
      Logcat.e(TAG, "百度地图初始化错误");
    }

    /** 友盟推送 */
    mPushAgent = PushAgent.getInstance(this);
    mPushAgent.setDebugMode(false);
    /** 友盟用户反馈 */
    FeedbackPush.getInstance(this).init(false);
    /** 友盟自动更新 */
    // 非wifi环境更新开启,要放在updata()之前调用
    UmengUpdateAgent.setUpdateOnlyWifi(SwitchManager.getInstance(this).getUpdateOnlyWifi());
    UmengUpdateAgent.update(this);
    /** 友盟在线参数—— 获取帖子尾巴 */
    MobclickAgent.updateOnlineConfig(this);
    BBSManager.getInstance(this).setAppTail(MobclickAgent.getConfigParams(this, "app_tail"));
    // 获取iptv频道列表
    IptvManager.getChanelList();

    MapHelper.initMapDatas(this);

    initSections();
    initFavorite();
  }