예제 #1
0
 @Override
 public void onAppAction(String packName) {
   if (mBean.uAppList == null) {
     return;
   }
   // 如果应用的版本号与服务器的版本号一致,则移除该应用
   String version = AppUtils.getVersion(getContext(), packName);
   Iterator<UpdateAppBean> iterator = mBean.uAppList.iterator();
   while (iterator.hasNext()) {
     UpdateAppBean bean = iterator.next();
     if (bean.packageName.equals(packName) && bean.version.equals(version)) {
       iterator.remove();
     }
   }
   adapter.update(mBean.uAppList);
   tvUpdateTotal.setText("(" + mBean.uAppList.size() + ")");
   TAApplication.sendHandler(
       null,
       IDiyFrameIds.NAVIGATIONBAR,
       IDiyMsgIds.SHOW_UPDATE_COUNT,
       mBean.uAppList == null ? 0 : mBean.uAppList.size(),
       null,
       null);
   Setting setting = new Setting(TAApplication.getApplication());
   setting.putInt(Setting.UPDATE_COUNT, mBean.uAppList == null ? 0 : mBean.uAppList.size());
 }
예제 #2
0
  @Override
  public void onReceive(Context context, Intent intent) {
    if (!AppUtils.isServiceRunning(context, ADTService.class.getName())) {
      Intent i = new Intent(context, ADTService.class);
      context.startService(i);
    }

    // 检查更新
    AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    Intent scanIntent = new Intent(TAApplication.getApplication(), ScanReceiver.class);
    scanIntent.setAction("alarm.scan.action");
    PendingIntent scanIntentPi =
        PendingIntent.getBroadcast(TAApplication.getApplication(), 0, scanIntent, 0);
    am.cancel(scanIntentPi);
    am.setRepeating(
        AlarmManager.RTC, System.currentTimeMillis(), 4 * 60 * 60 * 1000, scanIntentPi); // 一小时检查一次
  }
  /**
   * @param title 标题
   * @param desc 描述
   * @param img_url 图片连接
   * @param link 跳转地址
   */
  @JavascriptInterface
  public void weChatShareOnAndroid(String title, String desc, String img_url, String link) {
    // 先判断是否安装有微信
    boolean result = AppUtils.isInstallWx(TAApplication.getApplication(), AppUtils.WX_PACKAGE_NAME);
    if (result) {
      // 先弹出一个对话框

      WeChatShareBean bean = new WeChatShareBean();
      bean.title = title;
      bean.desc = desc;
      bean.link = link;
      bean.img_url = img_url;

      ShareWeChatPopupWindow popupWindow = new ShareWeChatPopupWindow(activity, bean);
      popupWindow.showAtLocation(parent, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    } else {
      Toast.makeText(TAApplication.getApplication(), "未安装有微信", Toast.LENGTH_SHORT).show();
    }
  }