/** 设置头像弹出框 void */
  private void showHeadImageDialog() {
    mHeadImageDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_ListView);
    mHeadImageDialog.setTitle(R.string.putao_personal_data_icon);
    String[] imageList =
        new String[] {
          getString(R.string.putao_personal_data_get_icon_from_gallery),
          getString(R.string.putao_personal_data_get_icon_from_camera)
        };
    mHeadImageDialog.setListViewDatas(imageList);
    mHeadImageDialog.setListViewItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mHeadImageDialog.dismiss();
            // 很据position的不同,选中相册还是相机
            if (position == 0) {
              // 相册
              chooseImageFromGallery();
            } else {
              // 相机
              takePictureByCamera();
            }
          }
        });
    mHeadImageDialog.show();
  }
  /** 退出登录:弹框,退出登录清空ptuser的信息即可 void */
  private void showLogOutDialog() {
    mLogOutDialog =
        CommonDialogFactory.getDialog(
            YellowpagePersonalInfoActivity.this, R.style.Theme_Ptui_Dialog_OkCancel);
    mLogOutDialog.setTitle(R.string.putao_common_prompt);
    mLogOutDialog.setMessage(R.string.putao_msg_logout_dialog);
    mLogOutDialog.setPositiveButton(
        R.string.putao_confirm,
        new OnClickListener() {

          @Override
          public void onClick(View view) {
            mLogOutDialog.dismiss();
            // 登出加载框
            showLoadingDialog(false);
            // 如果个人信息有改动,需要保存个人信息
            if (mChangeFlag) {
              saveUserBasicInfo();
              mChangeFlag = false;
            }
            AccountManager.getInstance().logout(YellowpagePersonalInfoActivity.this);
            dismissLoadingDialog();
            // 直接返回menufragment
            setResult(RESULT_OK);
            finish();
          }
        });
    mLogOutDialog.setNegativeButton(
        R.string.putao_cancel,
        new OnClickListener() {

          @Override
          public void onClick(View view) {
            mLogOutDialog.dismiss();
          }
        });
    mLogOutDialog.show();
  }
 /** 显示性别弹出框 void */
 private void showGenderDialog() {
   if (mGenderDialog == null) {
     mGenderDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_ListView);
     mGenderDialog.setTitle(getString(R.string.putao_personal_data_gender));
     ArrayList<String> genderList = new ArrayList<String>();
     genderList.add(male);
     genderList.add(female);
     mGenderDialog.setSingleChoiceListViewDatas(genderList);
     mGenderDialog.setListViewItemClickListener(
         new OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
             mGenderDialog.dismiss();
             mChangeFlag = true;
             // 0是男,1是女
             if (position == 0) {
               mGenderSTR = male;
               mGenderTextView.setText(male);
             } else if (position == 1) {
               mGenderSTR = female;
               mGenderTextView.setText(female);
             }
           }
         });
   }
   // 默认选择的是男吧
   if (!TextUtils.isEmpty(mGenderSTR)) {
     if (mGenderSTR.equals(male)) {
       mGenderDialog.getListView().setItemChecked(0, true);
     } else if (mGenderSTR.equals(female)) {
       mGenderDialog.getListView().setItemChecked(1, true);
     }
   } else {
     mGenderDialog.getListView().setItemChecked(0, true);
   }
   mGenderDialog.show();
 }
 /** 弹出生日选择框 void */
 private void showBirthdayDialog() {
   if (mBirthdayDialog == null) {
     mBirthdayDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_Wheel);
     mBirthdayDialog.setTitle(getString(R.string.putao_personal_data_birthday));
     mBirthdayDialog.setNegativeButton(
         R.string.putao_cancel,
         new OnClickListener() {
           @Override
           public void onClick(View view) {
             mBirthdayDialog.dismiss();
           }
         });
     mBirthdayDialog.setPositiveButton(
         R.string.putao_confirm,
         new OnClickListener() {
           @Override
           public void onClick(View view) {
             mBirthdayDialog.dismiss();
             mChangeFlag = true;
             int year = mYearWheelView.getCurrentItem() + mCurrentYear - 100;
             int month = mMonthWheelView.getCurrentItem() + 1;
             int day = mDayWheelView.getCurrentItem() + 1;
             StringBuilder sb = new StringBuilder();
             sb.append(year).append("-").append(month).append("-").append(day);
             mBirthdaySTR = sb.toString();
             mBirthdayTextView.setText(mBirthdaySTR);
           }
         });
     LinearLayout wheelContainer = (LinearLayout) mBirthdayDialog.getContainerLayout();
     // 年,年月的滚动控件不用设置滚动事件监听
     Calendar calendar = Calendar.getInstance();
     mCurrentYear = calendar.get(Calendar.YEAR);
     mYearWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_left);
     mYearWheelView.setVisibleItems(3);
     mYearAdapter =
         new WheelNumericAdapter(
             this, mCurrentYear - 100, mCurrentYear, getString(R.string.putao_personal_data_year));
     mYearWheelView.setViewAdapter(mYearAdapter);
     // 月
     mMonthWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_center);
     mMonthWheelView.setVisibleItems(3);
     mMonthAdapter =
         new WheelNumericAdapter(this, 1, 12, getString(R.string.putao_personal_data_month));
     mMonthWheelView.setViewAdapter(mMonthAdapter);
     // 日
     mDayWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_right);
     mDayWheelView.setVisibleItems(3);
     OnWheelChangedListener listener =
         new OnWheelChangedListener() {
           @Override
           public void onChanged(WheelView wheel, int oldValue, int newValue) {
             // 只要是年月发生变化,就要去检查日是否也联动发生变化
             updateDays(mYearWheelView, mMonthWheelView, mDayWheelView);
           }
         };
     mYearWheelView.addChangingListener(listener);
     mMonthWheelView.addChangingListener(listener);
     updateDays(mYearWheelView, mMonthWheelView, mDayWheelView);
   }
   // mBirthdaySTR是否为空
   if (!TextUtils.isEmpty(mBirthdaySTR)) {
     try {
       String[] date = mBirthdaySTR.split("-");
       String year = "";
       String month = "";
       String day = "";
       if (date.length > 0) {
         year = date[0];
       }
       // 将year转为为year index
       if (!TextUtils.isEmpty(year)) {
         int yearIndex = Integer.parseInt(year) - (mCurrentYear - 100);
         mYearWheelView.setCurrentItem(yearIndex);
       }
       if (date.length > 1) {
         month = date[1];
       }
       // 将month转化为month index
       if (!TextUtils.isEmpty(month)) {
         int monthIndex = Integer.parseInt(month) - 1;
         mMonthWheelView.setCurrentItem(monthIndex);
       }
       if (date.length > 2) {
         day = date[2];
       }
       // 将day转化为day index
       if (!TextUtils.isEmpty(day)) {
         int dayIndex = Integer.parseInt(day) - 1;
         mDayWheelView.setCurrentItem(dayIndex);
       }
     } catch (Exception e) {
       LogUtil.w("YellowpagePersonalInfoActivity", "catch Exception throw by choosePicture", e);
     }
   } else {
     mYearWheelView.setCurrentItem(73);
   }
   mBirthdayDialog.show();
 }
  private void showWheelCityDialog() {
    dismissLoadingDialog();
    if (mCityDialog == null) {
      mCityDialog = CommonDialogFactory.getDialog(this, R.style.Theme_Ptui_Dialog_Wheel);
      mCityDialog.setTitle(getString(R.string.putao_personal_data_area));
      mCityDialog.setNegativeButton(
          getString(R.string.putao_cancel),
          new OnClickListener() {
            @Override
            public void onClick(View view) {
              mCityDialog.dismiss();
            }
          });
      mCityDialog.setPositiveButton(
          getString(R.string.putao_confirm),
          new OnClickListener() {

            @Override
            public void onClick(View view) {
              mCityDialog.dismiss();
              mChangeFlag = true;
              // 提取滑轮中的省份和城市
              ProvinceItem provinceItem = mProvinceItems.get(0);
              String city = "";
              int provinceIndex = mProvinceWheelView.getCurrentItem();
              if (provinceIndex >= 0 && provinceIndex < mProvinceItems.size()) {
                provinceItem = mProvinceItems.get(provinceIndex);
                mCitiesList.clear();
                mCitiesList.addAll(provinceItem.cityList);
                int cityIndex = mCityWheelView.getCurrentItem();
                if (cityIndex >= 0 && cityIndex < mCitiesList.size()) {
                  city = mCitiesList.get(cityIndex);
                  if ("---".equals(city)) {
                    city = "";
                  }
                }
                StringBuilder sb = new StringBuilder();
                sb.append(provinceItem.provinceName).append("  ").append(city);
                mCitySTR = sb.toString();
                mCityTextView.setText(mCitySTR);
              }
            }
          });

      LinearLayout wheelContainer = (LinearLayout) mCityDialog.getContainerLayout();
      // 只有省市两级联动,把中间的wheelview去掉
      wheelContainer.findViewById(R.id.wheel_center).setVisibility(View.GONE);
      mProvinceWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_left);
      mProvinceWheelView.setVisibleItems(3);
      mProvinceAdapter = new WheelTextAdapter(this, mProvincesList);
      mProvinceWheelView.setViewAdapter(mProvinceAdapter);
      mProvinceWheelView.addChangingListener(this);

      mCityWheelView = (WheelView) wheelContainer.findViewById(R.id.wheel_right);
      mCityWheelView.setVisibleItems(3);
      mCityAdapter = new WheelTextAdapter(this, mCitiesList);
      mCityWheelView.setViewAdapter(mCityAdapter);
      mCityWheelView.addChangingListener(this);
    }

    // 显示已设定的城市,或显示默认第一个
    if (!TextUtils.isEmpty(mCitySTR)) {
      // 省份和城市之间是以两个空格来分开的
      String[] area = mCitySTR.split("  ");
      String province = "";
      String city = "";
      if (area.length > 0) {
        province = area[0];
      }
      if (area.length > 1) {
        city = area[1];
      }
      // 遍历省份列表
      if (!mProvinceItems.isEmpty() && !TextUtils.isEmpty(province)) {
        for (int i = 0; i < mProvinceItems.size(); i++) {
          if (mProvinceItems.get(i).provinceName.equals(province)) {
            mProvinceWheelView.setCurrentItem(i);
            mCitiesList.clear();
            mCitiesList.addAll(mProvinceItems.get(i).cityList);
            break;
          }
        }
      }
      // 遍历城市列表
      if (!mCitiesList.isEmpty() && !TextUtils.isEmpty(city)) {
        for (int j = 0; j < mCitiesList.size(); j++) {
          if (mCitiesList.get(j).equals(city)) {
            mCityWheelView.setCurrentItem(j);
            break;
          }
        }
      }
    } else {
      mProvinceWheelView.setCurrentItem(0);
      mProvinceAdapter.setData(mProvincesList);
      mCityWheelView.setCurrentItem(0);
      mCityAdapter.setData(mCitiesList);
    }

    mCityDialog.show();
  }