@SuppressWarnings("unchecked")
 @Override
 public void handleMessage(Message message) {
   DBManager dbManager = new DBManager(MyDashboardActivity.this);
   if (message.what != -1) {
     List<Building> buildings = (ArrayList<Building>) message.obj;
     if (buildings.size() > 0) {
       dbManager.SyncLocalBuildings(CurrentUser.getId(), buildings);
       for (Building building : buildings) {
         if (building.getHome() == 1) {
           myHomeImageView.setVisibility(View.VISIBLE);
           BaseActivity.imageLoader.displayImage(building.getFaceUrl(), myHomeImageView, o);
         } else if (building.getWork() == 1) {
           myWorkImageView.setVisibility(View.VISIBLE);
           BaseActivity.imageLoader.displayImage(building.getFaceUrl(), myWorkImageView, o);
         }
       }
     }
   }
   dbManager.closeDB();
 }
 private void InitaializeData() {
   BaseActivity.imageLoader.displayImage(CurrentUser.getProfileImage(), myAvatorImageView, o);
   DBManager dbManager = new DBManager(this);
   List<Building> localBuildings = dbManager.GetLocalBuildings(CurrentUser.getId());
   if (localBuildings != null) {
     for (Building building : localBuildings) {
       if (building.getHome() == 1) {
         myHome.setTag(building);
         myHomeImageView.setVisibility(View.VISIBLE);
         BaseActivity.imageLoader.displayImage(building.getFaceUrl(), myHomeImageView);
       } else if (building.getWork() == 1) {
         myWork.setTag(building);
         myWorkImageView.setVisibility(View.VISIBLE);
         BaseActivity.imageLoader.displayImage(building.getFaceUrl(), myWorkImageView);
       }
     }
   }
   dbManager.closeDB();
   nickNameView.setText(CurrentUser.getName() != null ? CurrentUser.getName() : "还没有昵称");
   accountNameView.setText(CurrentUser.getEmail());
 }
 @SuppressWarnings("unchecked")
 @Override
 public void handleMessage(Message message) {
   DBManager dbManager = new DBManager(UserSettingsActivity.this);
   if (message.what != -1) {
     List<Building> buildings = (ArrayList<Building>) message.obj;
     if (buildings.size() > 0) {
       dbManager.SyncLocalBuildings(CurrentUser.getId(), buildings);
       for (Building building : buildings) {
         if (building.getHome() == 1) {
           homeImageView.setVisibility(View.VISIBLE);
           hometTextView.setText(R.string.more_fun_one);
           BaseActivity.imageLoader.displayImage(building.getFaceUrl(), homeImageView);
         } else if (building.getWork() == 1) {
           workImageView.setVisibility(View.VISIBLE);
           workTextView.setText(R.string.more_fun_two);
           BaseActivity.imageLoader.displayImage(building.getFaceUrl(), workImageView);
         }
       }
     }
   }
   dbManager.closeDB();
 }
  private void LocadLocalData() {
    DBManager dbManager = new DBManager(this);
    BaseActivity.imageLoader.displayImage(
        BaseActivity.CurrentUser.getProfileImage(), avatorImageView, o);
    if (BaseActivity.CurrentUser.getName() != BaseActivity.CurrentUser.getEmail()) {
      nickTextView.setText(BaseActivity.CurrentUser.getName());
    } else {

    }
    gendarTextView.setText(BaseActivity.CurrentUser.getGendar());

    String locationString = "";
    if (BaseActivity.CurrentUser.getCity() != null) {
      locationString += BaseActivity.CurrentUser.getCity();
    }
    if (BaseActivity.CurrentUser.getDistrict() != null) {
      locationString += " " + BaseActivity.CurrentUser.getDistrict();
    }
    locationTextView.setText(locationString);
    birthdayTextView.setText(CurrentUser.getBirthday());
    List<Building> localBuildings = dbManager.GetLocalBuildings(CurrentUser.getId());
    if (localBuildings != null) {
      for (Building building : localBuildings) {
        if (building.getHome() == 1) {
          homeImageView.setVisibility(View.VISIBLE);
          hometTextView.setText(R.string.more_fun_one);
          BaseActivity.imageLoader.displayImage(building.getFaceUrl(), homeImageView);
        } else if (building.getWork() == 1) {
          workImageView.setVisibility(View.VISIBLE);
          workTextView.setText(R.string.more_fun_two);
          BaseActivity.imageLoader.displayImage(building.getFaceUrl(), workImageView);
        }
      }
    }
    dbManager.closeDB();
  }
  @Override
  public void onClick(View view) {
    switch (view.getId()) {
      case R.id.my_topics_rl:
        String user_id = String.valueOf(CurrentUser.getId());
        Intent intent = new Intent(this, UserTopicsActivity.class);
        intent.putExtra("user_id", Integer.parseInt(user_id));
        intent.putExtra("uname", "");
        startActivity(intent);
        break;
      case R.id.my_favorite_rl:
        break;
      case R.id.my_related_rl:
        Intent intentAt = new Intent(this, UserTopicsActivity.class);
        intentAt.putExtra(Constant.RELATED_TOPIC_TYPE, UserRelatedTopicType.at.getCode());
        startActivity(intentAt);
        break;
      case R.id.my_comment_rl:
        Intent intentComment = new Intent(this, UserTopicsActivity.class);
        intentComment.putExtra(Constant.RELATED_TOPIC_TYPE, UserRelatedTopicType.comment.getCode());
        startActivity(intentComment);
        break;
      case R.id.my_follow_points:
        Intent intentPoints = new Intent(MyDashboardActivity.this, SearchPointsActivity.class);
        intentPoints.putExtra("user_follow", true);
        Bundle bundlePoints = new Bundle();
        bundlePoints.putSerializable("desUser", CurrentUser);
        intentPoints.putExtras(bundlePoints);
        intentPoints.putExtra("search_type", PointSearchType.User_Follow.getCode());
        startActivity(intentPoints);
        break;
      case R.id.my_home_rl:
        if (myHome.getTag() != null) {
          Building building = (Building) myHome.getTag();
          // Intent intentHome = new Intent(MyDashboardActivity.this,BuildingHomeActivity.class);
          Intent intentHome = new Intent(MyDashboardActivity.this, BuildingCardActivity.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("building", building);
          Log.v(TAG, "Home:" + building.getHome());
          intentHome.putExtras(bundle);
          startActivity(intentHome);
        }
        break;

      case R.id.my_work_rl:
        if (myWork.getTag() != null) {
          Building building = (Building) myWork.getTag();
          // Intent intentWork = new Intent(MyDashboardActivity.this,BuildingHomeActivity.class);
          Intent intentWork = new Intent(MyDashboardActivity.this, BuildingCardActivity.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("building", building);
          intentWork.putExtras(bundle);
          startActivity(intentWork);
        }
        break;
      case R.id.my_personal_rl:
        Intent intentSetting = new Intent(this, UserSettingsActivity.class);
        startActivity(intentSetting);
        break;
      case R.id.my_setting_rl:
        Intent appSetting = new Intent(this, AppSettingActivity.class);
        startActivity(appSetting);
        break;
      case R.id.my_quit_rl:
        DBManager dbManager = new DBManager(this);
        dbManager.Logout(BaseActivity.CurrentUser.getId());
        dbManager.closeDB();
        // dbManager.deleteAllAccounts();
        // finish();
        System.exit(0);
        break;
      default:
        break;
    }
  }