コード例 #1
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mLocationClient != null) {
     mLocationClient.stop();
     mLocationClient = null;
   }
 }
コード例 #2
0
  @Override
  protected void onStop() {
    ((App) getApplication()).onLocListeners.remove(this);
    if (mLocationClient != null) {
      mLocationClient.stop();
    }

    super.onStop();
  }
コード例 #3
0
 @Override
 public void requestDataRefresh() {
   if (cityId != -1) {
     super.requestDataRefresh();
   } else {
     page = 1;
     presenter.getData(_cityName, _Lat + "", _Lng + "", page, count);
   }
 }
コード例 #4
0
 @Override
 public void loadMore() {
   if (cityId != -1) {
     super.loadMore();
   }
   if (adapter.getStatus() == BaseAdapter.STATUS_HASMORE) {
     page++;
     presenter.getData(_cityName, _Lat + "", _Lng + "", page, count);
     adapter.loading();
   }
 }
コード例 #5
0
  /** @param savedInstanceState */
  @Override
  protected void initThings(Bundle savedInstanceState) {
    super.initThings(savedInstanceState);

    mLocationClient = new LocationClient(getApplicationContext()); // 声明LocationClient类
    mLocationClient.registerLocationListener(myListener); // 注册监听函数

    tvTitle.setText("定位中...");
    showDialog("提示", "正在定位...");
    initLocation();
    mLocationClient.start();

    tvTitle.setText(_cityName);
    presenter.getData(_cityName, _Lat + "", _Lng + "", page, count);
  }
コード例 #6
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == C.RESULT_ONE && requestCode == C.REQUEST_SELECT_CATE) {
      if (data != null) {
        Bundle bun = data.getBundleExtra("data");
        if (bun != null) {
          name = bun.getString("name");
          id = bun.getInt("id");
          tvTitle.setText(name);
          page = 1;
          cityId = id;
          presenter.getData(page, count);
        }
      }

    } else if (resultCode == C.RESULT_TWO) {
      tvTitle.setText(_cityName);
      cityId = -1;
      presenter.getData(_cityName, _Lat + "", _Lng + "", page, count);
    }
  }
コード例 #7
0
 @Override
 protected void onStart() {
   super.onStart();
   ((App) getApplication()).onLocListeners.add(this);
 }