Пример #1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
   super.onCreate(savedInstanceState);
   mContext = this;
   mSocketInit = SocketInit.getInstance();
   mApplication = CustomApplcation.getInstance();
   mLoadingDialog = new FlippingLoadingDialog(this, "请求提交中");
   agent = new FeedbackAgent(mContext);
 }
Пример #2
0
  /**
   * @Title: updateDeviceNewestMessage @Description: 更新当前设备最新数据
   *
   * @param
   * @return void 4A
   * @throws
   */
  public void updateDeviceNewestMessage() {
    if (CustomApplcation.getInstance().getCurrentCamelDevice() == null) {
      return;
    }
    SocketInit.getInstance()
        .queryCurrentNewestMessage(
            new FindNewMessageListener() {
              @Override
              public void onSuccess() {}

              @Override
              public void onFailure(int paramInt, String paramString) {
                Log.e("updateFamilyMember", paramString);
              }
            });
  }
Пример #3
0
  /**
   * @Title: updateMessageData @Description: 获取历史数据
   *
   * @param
   * @return void 3E
   * @throws
   */
  @SuppressLint("SimpleDateFormat")
  public void updateMessageData() {
    if (CustomApplcation.getInstance().getCurrentCamelDevice() == null) {
      return;
    }
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date curDate = new Date(System.currentTimeMillis()); // 获取当前时间
    String time = formatter.format(curDate);
    SocketInit.getInstance()
        .queryCurrentDeviceState(
            Config.HISTORY_PAGE,
            time,
            new FindStateListener() {

              @Override
              public void onSuccess() {
                try {
                  runOnUiThread(
                      new Runnable() {
                        public void run() {
                          new Handler()
                              .postDelayed(
                                  new Runnable() {
                                    public void run() {
                                      Config.HISTORY_PAGE++;
                                      updateMessageData();
                                    }
                                  },
                                  2000);
                        }
                      });
                } catch (Exception e) {
                  e.printStackTrace();
                }
              }

              @Override
              public void onFailure(int paramInt, String paramString) {}
            });
  }
Пример #4
0
  /**
   * @Title: updateDeviceData @Description: 更新当前设备数据
   *
   * @param:
   * @return: void 3A
   * @throws:
   */
  public void updateDeviceData() {
    // 更新经纬度
    updateUserLocation();

    SocketInit.getInstance()
        .queryCurrentContactList(
            new FindListener() {
              @Override
              public void onSuccess(final List<CamelDevice> mCamelDevice) {
                // 延迟两秒,防止还没进入主界面初始化未完成就更新组界面
                try {
                  runOnUiThread(
                      new Runnable() {
                        public void run() {
                          new Handler()
                              .postDelayed(
                                  new Runnable() {
                                    public void run() {
                                      CustomApplcation.getInstance().setContactList(mCamelDevice);
                                      Intent intent = new Intent();
                                      intent.setAction("action.main.refresh.3a");
                                      mContext.sendBroadcast(intent);
                                    }
                                  },
                                  2000);
                        }
                      });
                } catch (Exception e) {
                  e.printStackTrace();
                }
              }

              @Override
              public void onFailure(int paramInt, String paramString) {}
            });
  }