Exemplo n.º 1
0
  private void getViewData() {
    demandContentBean = new PublishDemandBean();

    demandContentBean.setPublish_demand_userid(Util.getUserInfo(this, "userId"));

    demandContentBean.setPublish_demand_address(publish_demand_address.getText().toString());
    demandContentBean.setPublish_demand_contactor(publish_demand_contactor.getText().toString());
    demandContentBean.setPublish_demand_describle(publish_demand_describle.getText().toString());
    demandContentBean.setPublish_demand_rental(publish_demand_rental.getText().toString());
    demandContentBean.setPublish_demand_tell(publish_demand_tell.getText().toString());
    demandContentBean.setPublish_demand_title(publish_demand_title.getText().toString());
    demandContentBean.setPublish_demand_type(publish_demand_type.getText().toString());
    demandContentBean.setPublish_demand_way(publish_demand_way.getText().toString());
  }
Exemplo n.º 2
0
  @Override
  public void onClick(View v) {
    Intent intent;
    String isRegist = Util.getUserInfo(getActivity(), "isRegist");
    int userType = Integer.valueOf(Util.getUserInfo(getActivity(), "userType"));
    switch (v.getId()) {
      case R.id.rent_btn_source:
        intent = new Intent(getActivity(), HouseSourceActivity.class);
        startActivity(intent);
        break;
      case R.id.rent_btn_demand:
        intent = new Intent(getActivity(), HouseDemandActivity.class);
        startActivity(intent);
        break;
      case R.id.rent_btn_publishdemand:
        if (userType == UserType.HouseOwner) {
          Toast.makeText(getActivity(), "您以房主身份登录,无法发布需求", Toast.LENGTH_SHORT).show();
          break;
        }
        if ("true".equals(isRegist)) {
          intent = new Intent(getActivity(), PublishDemanActivity.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("demandContent", null);
          intent.putExtras(bundle);
          startActivity(intent);
        } else {
          AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
          dialogBuilder.setMessage("没有完整注册过不能发布房源,现在完善?");
          dialogBuilder.setPositiveButton(
              "是的",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  Intent intent1 = new Intent(getActivity(), EditInfoActivity.class);
                  startActivity(intent1);
                }
              });
          dialogBuilder.setNegativeButton(
              "以后再说",
              new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {}
              });
          AlertDialog dialog = dialogBuilder.create();
          dialog.show();
        }
        break;
      case R.id.rent_btn_publishsource:
        if (userType == UserType.Transfer) {
          Toast.makeText(getActivity(), "您以流动人员身份登录,无法发布房源", Toast.LENGTH_SHORT).show();
          break;
        }
        if ("true".equals(isRegist)) {
          intent = new Intent(getActivity(), PublishHouseActivity.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("houseContent", null);
          intent.putExtras(bundle);
          startActivity(intent);
        } else {
          AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
          dialogBuilder.setMessage("没有完整注册过不能发布房源,现在完善?");
          dialogBuilder.setPositiveButton(
              "是的",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  Intent intent1 = new Intent(getActivity(), EditInfoActivity.class);
                  startActivity(intent1);
                }
              });
          dialogBuilder.setNegativeButton(
              "以后再说",
              new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {}
              });
          AlertDialog dialog = dialogBuilder.create();
          dialog.show();
        }
        break;
      case R.id.rent_btn_mydemand:
        if (userType == UserType.HouseOwner) {
          Toast.makeText(getActivity(), "您以房主身份登录,无法查看我的需求", Toast.LENGTH_SHORT).show();
          break;
        }
        if ("true".equals(isRegist)) {
          intent = new Intent(getActivity(), MyDemandActivity.class);
          startActivity(intent);
        } else {
          AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
          dialogBuilder.setMessage("没有完整注册过,您没有发布过房源,现在完善?");
          dialogBuilder.setPositiveButton(
              "是的",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  Intent intent1 = new Intent(getActivity(), EditInfoActivity.class);
                  startActivity(intent1);
                }
              });
          dialogBuilder.setNegativeButton(
              "以后再说",
              new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {}
              });
          AlertDialog dialog = dialogBuilder.create();
          dialog.show();
        }
        break;
      case R.id.rent_btn_myhouse:
        if (userType == UserType.Transfer) {
          Toast.makeText(getActivity(), "您以流动人员身份登录,无法查看我的房源", Toast.LENGTH_SHORT).show();
          break;
        }
        if ("true".equals(isRegist)) {
          intent = new Intent(getActivity(), MyHouseActivity.class);
          startActivity(intent);
        } else {
          AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
          dialogBuilder.setMessage("没有完整注册过,您没有发布过房源,现在完善?");
          dialogBuilder.setPositiveButton(
              "是的",
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  Intent intent1 = new Intent(getActivity(), EditInfoActivity.class);
                  startActivity(intent1);
                }
              });
          dialogBuilder.setNegativeButton(
              "以后再说",
              new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {}
              });
          AlertDialog dialog = dialogBuilder.create();
          dialog.show();
        }
        break;
      default:
        break;
    }
  }