// Path: app/src/main/java/com/evgenii/aescrypto/interfaces/ClipboardInterface.java
// public interface ClipboardInterface {
// 	public String get();
// 
// 	public void set(String text);
// }
// 
// Path: app/src/main/java/com/evgenii/aescrypto/interfaces/JsEncryptorInterface.java
// public interface JsEncryptorInterface {
// 	public void decrypt(String text, String password, JsCallback callback);
// 
// 	public void encrypt(String text, String password, JsCallback callback);
// 
// 	public boolean isEncrypted(String text);
// }
// 
// Path: app/src/main/java/com/evgenii/aescrypto/interfaces/MainActivityInterface.java
// public interface MainActivityInterface {
// 	public boolean hasMessage();
// 
// 	public boolean hasPassword();
// 
// 	public boolean isBusy();
// 
// 	public void setMessage(String message);
// 
// 	public String trimmedMessage();
// 
// 	public String trimmedPassword();
// 
// 	public void updateBusy(boolean isBusy);
// 
// 	public void updateEncryptButtonTitle();
// }


import com.evgenii.aescrypto.interfaces.ClipboardInterface;
import com.evgenii.aescrypto.interfaces.JsEncryptorInterface;
import com.evgenii.aescrypto.interfaces.MainActivityInterface;
import com.evgenii.jsevaluator.interfaces.JsCallback;
package com.evgenii.aescrypto;


public class Encrypt {
	private final MainActivityInterface mActivity;
	private final JsEncryptorInterface mJsEncryptor;
	private final ClipboardInterface mClipboard;
	private boolean mJustCopied;

	public Encrypt(MainActivityInterface activity, JsEncryptorInterface jsEncryptor,
			ClipboardInterface clipboard) {
		mActivity = activity;
		mJsEncryptor = jsEncryptor;
		mClipboard = clipboard;
	}

	public void encryptAndUpdate() {
		if (!isEncryptable())
			return;

		mActivity.updateBusy(true);
		mJsEncryptor.encrypt(mActivity.trimmedMessage(), mActivity.trimmedPassword(),
				new JsCallback() {
					@Override
					public void onResult(final String encryptedMessage) {
						storeMessageInClipboard(encryptedMessage);
						mActivity.setMessage(encryptedMessage);
						mActivity.updateEncryptButtonTitle();
						mActivity.updateBusy(false);
					}

// Path: app/src/main/java/com/evgenii/aescrypto/interfaces/ClipboardInterface.java
// public interface ClipboardInterface {
// 	public String get();
// 
// 	public void set(String text);
// }
// 
// Path: app/src/main/java/com/evgenii/aescrypto/interfaces/JsEncryptorInterface.java
// public interface JsEncryptorInterface {
// 	public void decrypt(String text, String password, JsCallback callback);
// 
// 	public void encrypt(String text, String password, JsCallback callback);
// 
// 	public boolean isEncrypted(String text);
// }
// 
// Path: app/src/main/java/com/evgenii/aescrypto/interfaces/MainActivityInterface.java
// public interface MainActivityInterface {
// 	public boolean hasMessage();
// 
// 	public boolean hasPassword();
// 
// 	public boolean isBusy();
// 
// 	public void setMessage(String message);
// 
// 	public String trimmedMessage();
// 
// 	public String trimmedPassword();
// 
// 	public void updateBusy(boolean isBusy);
// 
// 	public void updateEncryptButtonTitle();
// }


// Path: app/src/main/java/com/evgenii/aescrypto/Encrypt.java
import com.evgenii.aescrypto.interfaces.ClipboardInterface;
import com.evgenii.aescrypto.interfaces.JsEncryptorInterface;
import com.evgenii.aescrypto.interfaces.MainActivityInterface;
import com.evgenii.jsevaluator.interfaces.JsCallback;

package com.evgenii.aescrypto;


public class Encrypt {
	private final MainActivityInterface mActivity;
	private final JsEncryptorInterface mJsEncryptor;
	private final ClipboardInterface mClipboard;
	private boolean mJustCopied;

	public Encrypt(MainActivityInterface activity, JsEncryptorInterface jsEncryptor,
			ClipboardInterface clipboard) {
		mActivity = activity;
		mJsEncryptor = jsEncryptor;
		mClipboard = clipboard;
	}

	public void encryptAndUpdate() {
		if (!isEncryptable())
			return;

		mActivity.updateBusy(true);
		mJsEncryptor.encrypt(mActivity.trimmedMessage(), mActivity.trimmedPassword(),
				new JsCallback() {
					@Override
					public void onResult(final String encryptedMessage) {
						storeMessageInClipboard(encryptedMessage);
						mActivity.setMessage(encryptedMessage);
						mActivity.updateEncryptButtonTitle();
						mActivity.updateBusy(false);
					}

					@Override