Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.v4.view.MenuItemCompat;
- import android.support.v7.widget.ShareActionProvider;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- /**
- * Created by Insha Siddiqui on 3/27/2017.
- */
- public class CaesarCipherDecryp extends Activity {
- public static Button buttondenc;
- public static EditText encryptedtext;
- public static EditText plain;
- public static EditText key;
- public static String text="";
- public static Button sharingButton;
- public static Button buttonvc;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.caesarcipherdecryp);
- encryptedtext=(EditText)findViewById(R.id.editText1);
- key=(EditText)findViewById(R.id.editText2);
- plain=(EditText)findViewById(R.id.editText3);
- buttondenc = (Button)findViewById(R.id.button2);
- buttonvc = (Button)findViewById(R.id.button1);
- sharingButton = (Button)findViewById(R.id.button3);
- //ImageButton sharingButton = new ImageButton(this);
- // sharingButton.setLayoutParams(new ViewGroup.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT));
- //sharingButton.setImageResource(R.mipmap.ic_share);
- buttondenc.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- // Display the file chooser dialog
- String text1="";
- text1=CeaserDecrypt();
- plain.setText(text1);
- }
- });
- buttonvc.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- // Display the file chooser dialog
- Intent i = new Intent(CaesarCipherDecryp.this, VigenereDecryp.class);
- startActivity(i);
- }
- });
- sharingButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- // Display the file chooser dialog
- Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
- sendIntent.putExtra(Intent.EXTRA_TEXT,plain.getText().toString()
- );
- sendIntent.setType("text/plain");
- startActivity(Intent.createChooser(sendIntent, "Share using"));
- //startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));
- }
- });
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- // getMenuInflater().inflate(share, menu);
- getMenuInflater().inflate(R.menu.share, menu);
- MenuItem item = menu.findItem(R.id.menu_item_share);
- ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
- //ShareActionProvider mShareActionProvider;
- //mShareActionProvider.setShareHistoryFileName("share.xml");
- /*Intent sendIntent = new Intent();
- sendIntent.setAction(Intent.ACTION_SEND);
- sendIntent.putExtra(Intent.EXTRA_TEXT, String.valueOf(encryptedtext));
- sendIntent.setType("text/plain");
- startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));*/
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement