Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. import android.app.Activity;
  2. import android.content.Intent;
  3. import android.os.Bundle;
  4. import android.support.v4.view.MenuItemCompat;
  5. import android.support.v7.widget.ShareActionProvider;
  6. import android.view.Menu;
  7. import android.view.MenuItem;
  8. import android.view.View;
  9. import android.widget.Button;
  10. import android.widget.EditText;
  11. import android.widget.TextView;
  12.  
  13. /**
  14. * Created by Insha Siddiqui on 3/27/2017.
  15. */
  16.  
  17. public class CaesarCipherDecryp extends Activity {
  18. public static Button buttondenc;
  19. public static EditText encryptedtext;
  20. public static EditText plain;
  21. public static EditText key;
  22. public static String text="";
  23. public static Button sharingButton;
  24. public static Button buttonvc;
  25.  
  26. @Override
  27. protected void onCreate(Bundle savedInstanceState) {
  28. super.onCreate(savedInstanceState);
  29. setContentView(R.layout.caesarcipherdecryp);
  30. encryptedtext=(EditText)findViewById(R.id.editText1);
  31. key=(EditText)findViewById(R.id.editText2);
  32. plain=(EditText)findViewById(R.id.editText3);
  33. buttondenc = (Button)findViewById(R.id.button2);
  34. buttonvc = (Button)findViewById(R.id.button1);
  35. sharingButton = (Button)findViewById(R.id.button3);
  36. //ImageButton sharingButton = new ImageButton(this);
  37. // sharingButton.setLayoutParams(new ViewGroup.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT));
  38. //sharingButton.setImageResource(R.mipmap.ic_share);
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. buttondenc.setOnClickListener(new View.OnClickListener() {
  46. @Override
  47. public void onClick(View v) {
  48. // Display the file chooser dialog
  49. String text1="";
  50. text1=CeaserDecrypt();
  51. plain.setText(text1);
  52. }
  53. });
  54. buttonvc.setOnClickListener(new View.OnClickListener() {
  55. @Override
  56. public void onClick(View v) {
  57. // Display the file chooser dialog
  58. Intent i = new Intent(CaesarCipherDecryp.this, VigenereDecryp.class);
  59. startActivity(i);
  60. }
  61. });
  62.  
  63. sharingButton.setOnClickListener(new View.OnClickListener() {
  64. @Override
  65. public void onClick(View v) {
  66. // Display the file chooser dialog
  67. Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
  68. sendIntent.putExtra(Intent.EXTRA_TEXT,plain.getText().toString()
  69.  
  70. );
  71. sendIntent.setType("text/plain");
  72. startActivity(Intent.createChooser(sendIntent, "Share using"));
  73.  
  74. //startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
  75.  
  76. }
  77. });
  78.  
  79. }
  80.  
  81.  
  82. @Override
  83. public boolean onCreateOptionsMenu(Menu menu) {
  84. // Inflate the menu; this adds items to the action bar if it is present.
  85. // getMenuInflater().inflate(share, menu);
  86. getMenuInflater().inflate(R.menu.share, menu);
  87. MenuItem item = menu.findItem(R.id.menu_item_share);
  88. ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
  89. //ShareActionProvider mShareActionProvider;
  90. //mShareActionProvider.setShareHistoryFileName("share.xml");
  91. /*Intent sendIntent = new Intent();
  92. sendIntent.setAction(Intent.ACTION_SEND);
  93. sendIntent.putExtra(Intent.EXTRA_TEXT, String.valueOf(encryptedtext));
  94. sendIntent.setType("text/plain");
  95. startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));*/
  96.  
  97. return true;
  98.  
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement