@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (requestCode == NameConstant.REQUEST_CODE_BACK_FROM_SIGN_IN) { if (resultCode == RESULT_OK) { user = User.getInstance(this); name.setText(user.name); address.setText(user.address); number.setText(user.phoneNumber); } } } catch (Exception ex) { } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (AppConfiguration.getInstance(this) .iconTheme .equalsIgnoreCase(NameConstant.ICON_THEME_LIGHT)) { setTheme(R.style.AppTheme); } else { setTheme(R.style.AppThemeLight); } setContentView(R.layout.activity_drawer); context = this; toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getPackageName().equalsIgnoreCase("com.applop")) { if (User.getInstance(this).loginType.equalsIgnoreCase("")) { Intent intent = new Intent(context, SignInActivity.class); startActivityForResult(intent, NameConstant.REQUEST_CODE_BACK_FROM_SIGN_IN); } } Helper.setToolbarColor(this); storyAdapter = new StoryAdapter(stories, this); loadResources(); setSideDrawer(); try { String categoryName = "Application"; String label = "Opened"; String action = "Opened"; AnalyticsHelper.trackEvent(categoryName, action, label, this); } catch (Exception e) { e.printStackTrace(); } try { String pageviews = "Home Page"; AnalyticsHelper.trackPageView(pageviews, this); } catch (Exception e) { e.printStackTrace(); } setads(); // show alert if exist String alertMessage = getIntent().getStringExtra("alert_message"); if (alertMessage != null) if (!alertMessage.equalsIgnoreCase("")) Helper.showAlertFeedNotification(this, alertMessage); return; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (AppConfiguration.getInstance(this) .iconTheme .equalsIgnoreCase(NameConstant.ICON_THEME_LIGHT)) { setTheme(R.style.AppTheme); } else { setTheme(R.style.AppThemeLight); } context = this; setContentView(R.layout.activity_enquiry_mail); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Helper.setToolbarColor(this); user = User.getInstance(this); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setTitle("Enquiry"); loadResources(); }
public void sendMail(View v) { try { String categoryName = "Product"; String action = "/Product (" + item.postId + ")" + ": " + item.title; String label = "Enquired"; AnalyticsHelper.trackEvent(categoryName, action, label, this); } catch (Exception e) { e.printStackTrace(); } if (name.getText().toString().equalsIgnoreCase("")) { Toast.makeText(this, "Please enter your name", Toast.LENGTH_LONG).show(); return; } if (number.getText().toString().equalsIgnoreCase("")) { Toast.makeText(this, "Please enter your phone number", Toast.LENGTH_LONG).show(); return; } if (number.getText().toString().length() != 10) { Toast.makeText(this, "Please enter 10 digit phone number", Toast.LENGTH_LONG).show(); return; } if (message.getText().toString().equalsIgnoreCase("")) { Toast.makeText(this, "Please enter your message", Toast.LENGTH_LONG).show(); return; } if (item == null) { Toast.makeText(this, "Error Please Try Again", Toast.LENGTH_LONG).show(); return; } Intent Email = new Intent(Intent.ACTION_SEND); Email.setType("text/email"); Email.putExtra(Intent.EXTRA_EMAIL, new String[] {AppConfiguration.getInstance(this).email}); Email.putExtra(Intent.EXTRA_SUBJECT, "Enquiry For : " + item.title); Email.putExtra( Intent.EXTRA_TEXT, "Name : " + name.getText().toString() + "\n\nAddress : " + address.getText().toString() + "\n\nPhone no. : " + number.getText().toString() + "\n\nMessage : " + message.getText().toString()); // startActivity(Intent.createChooser(Email, "Send enquiry_icon:")); final HashMap<String, String> params = new HashMap<String, String>(); if (user.loginType.equalsIgnoreCase("")) { Intent intent = new Intent(this, SignInActivity.class); startActivityForResult(intent, NameConstant.REQUEST_CODE_BACK_FROM_SIGN_IN); return; } params.put("email", user.email); params.put("name", user.name); params.put("address", address.getText().toString()); params.put("phoneNumber", number.getText().toString()); params.put("packageName", getPackageName()); params.put("photoLink", user.imageUrl); User.setUser( this, user.email, user.name, user.loginType, user.bitmap, user.imageUrl, address.getText().toString(), number.getText().toString(), "", ""); final ProgressDialog progressDialog = new ProgressDialog(context); new VolleyData(this) { @Override protected void VPreExecute() { progressDialog.setTitle("Sending"); progressDialog.show(); } @Override protected void VResponse(JSONObject response, String tag) { final HashMap<String, String> paramsBooking = new HashMap<String, String>(); paramsBooking.put("userEmail", user.email); paramsBooking.put("packageName", getPackageName()); paramsBooking.put("storyId", item.postId); paramsBooking.put("msg", message.getText().toString()); new VolleyData(context) { @Override protected void VPreExecute() {} @Override protected void VResponse(JSONObject response, String tag) { progressDialog.hide(); try { if (response.getBoolean("status")) { Toast.makeText(EnquiryMailActivity.this, "Enquired Successfully", Toast.LENGTH_LONG) .show(); onBackPressed(); } else { Toast.makeText( EnquiryMailActivity.this, "Error : Please try again", Toast.LENGTH_LONG) .show(); } } catch (Exception ex) { Toast.makeText( EnquiryMailActivity.this, "Error : Please try again", Toast.LENGTH_LONG) .show(); } } @Override protected void VError(VolleyError error, String tag) { progressDialog.hide(); Toast.makeText(EnquiryMailActivity.this, "Error : Please try again", Toast.LENGTH_LONG) .show(); } }.getPOSTJsonObject( "http://applop.biz/merchant/api/submitEnquiry.php", "post_user", paramsBooking); } @Override protected void VError(VolleyError error, String tag) { progressDialog.hide(); } }.getPOSTJsonObject("http://applop.biz/merchant/api/submitUserTable.php", "post_user", params); }