Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. case R.id.send:
  2. showAlertMessage("Would you like to send?", 1);
  3.  
  4. public void showAlertMessage(String message, final int type) {
  5. final AlertDialog d1 = new AlertDialog.Builder(this).create();
  6. d1.setMessage(message);
  7. d1.setButton("Yes", new DialogInterface.OnClickListener() {
  8. @Override
  9. public void onClick(final DialogInterface dialog, final int which) {
  10. if(type == 2){
  11. hideKeyboard(composeMsgEditText);
  12. hideKeyboard(completionView);
  13. finish();
  14. }
  15. else if(type == 1){
  16. hideKeyboard(composeMsgEditText);
  17. hideKeyboard(completionView);
  18. addToRecipients();
  19. if(isAskForFeedback){
  20. if(isGroupSelected){
  21. sendAskFeedback();
  22. }
  23. else{
  24. saveEmailGroup();
  25. }
  26. }
  27. else{
  28. sendFeedback();
  29. }
  30. }
  31. else if(type == 3){
  32. clearFields();
  33. }
  34. dialog.dismiss();
  35. }
  36. });
  37. d1.setButton2("No", new DialogInterface.OnClickListener() {
  38. @Override
  39. public void onClick(DialogInterface dialog, int which) {
  40. dialog.dismiss();
  41. }
  42. });
  43. d1.setCancelable(true);
  44. d1.show();
  45. }
  46.  
  47. rivate void sendFeedback(){
  48.  
  49. thread.setUserId(userId);
  50. thread.setToAddresses(createToAddress().toString());
  51. thread.setType(MessageThread.OUT_MESSAGE);
  52. thread.setRandomcode(StringUtility.generateRandomDigits(6));
  53. thread.setOwned(true);
  54. thread.setRequestor(userId);
  55. thread.setThreadTopic(composeMsgEditText.getText().toString());
  56. thread.setThreadId("54e5cb1a1c19016a0ddcc27e");
  57. thread.setSolicitationId("54e5cb1a1c19016a0ddcc27e");
  58. thread.setHashcode(HashUtility.encryptString(thread.getRandomcode() + thread.getUserId()));
  59. thread.setStrippedHashCode(StringUtility.reduceToBytes(thread.getHashcode(), 16));
  60. try {
  61. thread.setThreadTopicEnc(EncryptionUtility.encrypt(thread.getThreadTopic(), thread.getStrippedHashCode()));
  62. } catch (NoSuchAlgorithmException e) {
  63. e.printStackTrace();
  64. } catch (NoSuchPaddingException e) {
  65. e.printStackTrace();
  66. } catch (InvalidKeyException e) {
  67. e.printStackTrace();
  68. } catch (IllegalBlockSizeException e) {
  69. e.printStackTrace();
  70. } catch (BadPaddingException e) {
  71. e.printStackTrace();
  72. } catch (UnsupportedEncodingException e) {
  73. e.printStackTrace();
  74. } catch (InvalidKeySpecException e) {
  75. e.printStackTrace();
  76. } catch (InvalidAlgorithmParameterException e) {
  77. e.printStackTrace();
  78. }
  79. thread.setRandomcode(StringUtility.generateRandomDigits(6));
  80. threadDBAction.save(thread);
  81. CreateThreadAsyncTask asyncTask = new CreateThreadAsyncTask(this, this, true, thread, userId, false);
  82. asyncTask.execute();
  83. SelectFeedBckorAskFeedbackActivity.selectFeedBckorAskFeedbackActivity.finish();
  84. SelectFeedbackTypeActivity.selectFeedbackTypeActivity.finish();
  85. finish();
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement