private void init() { pmoProgressDialog = (RelativeLayout) findViewById(R.id.progress_bar_dim_layout); DeviceUtils.setAnimatingProgressDialog(ContactOwnerActivity.this, pmoProgressDialog); staticContentParser = new Gson() .fromJson( getApp().getUserPreference().getStaticContentString(), StaticContentParser.class); mScrollView = (ScrollView) findViewById(R.id.scroll_view); edtName = (EditText) findViewById(R.id.edt_name); edtFirstName = (EditText) findViewById(R.id.edt_first_name); edtEmail = (EditText) findViewById(R.id.edt_email); edtPhoneNumber = (EditText) findViewById(R.id.edt_login_phone); edtAddress = (EditText) findViewById(R.id.edt_address); edtPostalCode = (EditText) findViewById(R.id.edt_postal_code); txtNameAlert = (TextView) findViewById(R.id.txt_name_alert); txtFirstNameAlert = (TextView) findViewById(R.id.txt_first_name_alert); txtEmailAlert = (TextView) findViewById(R.id.txt_email_alert); txtAddressAlert = (TextView) findViewById(R.id.txt_address_alert); txtPhoneNumberAlert = (TextView) findViewById(R.id.txt_phone_number_alert); txtPostalCodeAlert = (TextView) findViewById(R.id.txt_postal_code_alert); checkTerms = (CheckBox) findViewById(R.id.chk_terms); checkBoxOffers = (CheckBox) findViewById(R.id.chk_offers); imgOwnerImage = (ImageView) findViewById(R.id.image); txtOnwerEmail = (TextView) findViewById(R.id.txt_owner_email); txtOwnerName = (TextView) findViewById(R.id.txt_owner_name); txtOwnerAddress = (TextView) findViewById(R.id.txt_owner_address); txtFax = (TextView) findViewById(R.id.txt_owner_fax); txtTel = (TextView) findViewById(R.id.txt_owner_tel); txtSite = (TextView) findViewById(R.id.txt_owner_site); radioMr = (TextView) findViewById(R.id.radio_mr); radioMiss = (TextView) findViewById(R.id.radio_miss); radioMrs = (TextView) findViewById(R.id.radio_mrs); layoutAddress = (LinearLayout) findViewById(R.id.layout_address); layoutTel = (LinearLayout) findViewById(R.id.layout_tel); layoutFax = (LinearLayout) findViewById(R.id.layout_fax); layoutSite = (LinearLayout) findViewById(R.id.layout_site); layoutEmail = (LinearLayout) findViewById(R.id.layout_email); txtSend = (TextView) findViewById(R.id.txt_send); titleBarLayout = (RelativeLayout) findViewById(R.id.title_layout); new Handler() .postDelayed( new Runnable() { @Override public void run() { titleBarHeight = titleBarLayout.getHeight(); } }, 200); progress = (ProgressBar) findViewById(R.id.progress_bar_home); progress.setVisibility(View.VISIBLE); }
private void sendEmail() { pmoProgressDialog.setVisibility(View.VISIBLE); RequestParams params = new RequestParams(); params.put("name", edtName.getText().toString().trim()); params.put("prenom", edtFirstName.getText().toString().trim()); params.put("email", edtEmail.getText().toString().trim()); params.put("codePostal", edtPostalCode.getText().toString().trim()); params.put("phone", edtPhoneNumber.getText().toString().trim()); params.put("offers", checkBoxOffers.isChecked() ? 1 : 0); int gender = 0; if (findViewById(R.id.radio_mr).isSelected()) gender = 1; else if (findViewById(R.id.radio_miss).isSelected()) gender = 2; else if (findViewById(R.id.radio_mrs).isSelected()) gender = 3; params.put("civility", gender); params.put("message", edtAddress.getText().toString().trim()); DeviceUtils.hideSoftKeyboard(ContactOwnerActivity.this); getHttpClient() .performRequest( String.format(Webservice.CONTACT_ANNONCE, announceDetails.annonceId), PmoHttpClient.HttpMethod.POST, params, new PmoRequestHandler() { @Override public void onSuccess(String content) { pmoProgressDialog.setVisibility(View.GONE); try { JSONObject obj = new JSONObject(content); String message = obj.optString("notifications"); AlertUtils.showToast(ContactOwnerActivity.this, message); setResult(RESULT_OK); forceFinish(); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onFailure(int statusCode, Throwable error, String message) { pmoProgressDialog.setVisibility(View.GONE); AlertUtils.showAlert(ContactOwnerActivity.this, message); } }); }