Pass full email through when replying
This commit is contained in:
@ -15,14 +15,14 @@ public class NewEmailActivity extends ActionBarActivity implements
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
String sender = null;
|
||||
String recipient = null;
|
||||
String quoteMsgFolder = null;
|
||||
String quoteMsgId = null;
|
||||
Bundle args = getIntent().getExtras();
|
||||
if (args != null) {
|
||||
sender = args.getString(NewEmailFragment.SENDER);
|
||||
recipient = args.getString(NewEmailFragment.RECIPIENT);
|
||||
quoteMsgFolder = args.getString(NewEmailFragment.QUOTE_MSG_FOLDER);
|
||||
quoteMsgId = args.getString(NewEmailFragment.QUOTE_MSG_ID);
|
||||
}
|
||||
NewEmailFragment f = NewEmailFragment.newInstance(sender, recipient);
|
||||
NewEmailFragment f = NewEmailFragment.newInstance(quoteMsgFolder, quoteMsgId);
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(android.R.id.content, f).commit();
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ public class NewEmailFragment extends Fragment {
|
||||
mCallbacks = sDummyCallbacks;
|
||||
}
|
||||
|
||||
public static final String SENDER = "sender";
|
||||
public static final String RECIPIENT = "recipient";
|
||||
public static final String QUOTE_MSG_FOLDER = "sender";
|
||||
public static final String QUOTE_MSG_ID = "recipient";
|
||||
|
||||
private String mSenderKey;
|
||||
|
||||
@ -79,11 +79,11 @@ public class NewEmailFragment extends Fragment {
|
||||
EditText mSubject;
|
||||
EditText mContent;
|
||||
|
||||
public static NewEmailFragment newInstance(String sender, String recipient) {
|
||||
public static NewEmailFragment newInstance(String quoteMsgFolder, String quoteMsgId) {
|
||||
NewEmailFragment f = new NewEmailFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(SENDER, sender);
|
||||
args.putString(RECIPIENT, recipient);
|
||||
args.putString(QUOTE_MSG_FOLDER, quoteMsgFolder);
|
||||
args.putString(QUOTE_MSG_ID, quoteMsgId);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
@ -104,10 +104,31 @@ public class NewEmailFragment extends Fragment {
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
String senderAddr = getArguments().getString(SENDER);
|
||||
String recipientAddr = getArguments().getString(RECIPIENT);
|
||||
if (senderAddr != null)
|
||||
mSenderKey = BoteHelper.extractEmailDestination(senderAddr);
|
||||
String quoteMsgFolder = getArguments().getString(QUOTE_MSG_FOLDER);
|
||||
String quoteMsgId = getArguments().getString(QUOTE_MSG_ID);
|
||||
Email origEmail = null;
|
||||
String recipientAddr = null;
|
||||
try {
|
||||
origEmail = BoteHelper.getEmail(quoteMsgFolder, quoteMsgId);
|
||||
if (origEmail != null) {
|
||||
mSenderKey = BoteHelper.extractEmailDestination(
|
||||
BoteHelper.getOneLocalRecipient(origEmail).toString());
|
||||
recipientAddr = BoteHelper.getNameAndDestination(
|
||||
origEmail.getReplyAddress(I2PBote.getInstance().getIdentities()));
|
||||
}
|
||||
} catch (PasswordException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (GeneralSecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (MessagingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mSpinner = (Spinner) view.findViewById(R.id.sender_spinner);
|
||||
IdentityAdapter identities = new IdentityAdapter(getActivity());
|
||||
|
@ -7,7 +7,6 @@ import java.text.DateFormat;
|
||||
import javax.mail.Address;
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
import i2p.bote.I2PBote;
|
||||
import i2p.bote.android.util.BoteHelper;
|
||||
import i2p.bote.email.Email;
|
||||
import i2p.bote.fileencryption.PasswordException;
|
||||
@ -31,8 +30,6 @@ public class ViewEmailFragment extends Fragment {
|
||||
private String mMessageId;
|
||||
|
||||
private boolean mIsAnonymous;
|
||||
private String mOneLocalRecipient;
|
||||
private String mReplyToAddress;
|
||||
|
||||
public static ViewEmailFragment newInstance(
|
||||
String folderName, String messageId) {
|
||||
@ -116,11 +113,6 @@ public class ViewEmailFragment extends Fragment {
|
||||
|
||||
// Prepare fields for replying
|
||||
mIsAnonymous = email.isAnonymous();
|
||||
if (!mIsAnonymous) {
|
||||
mOneLocalRecipient = BoteHelper.getOneLocalRecipient(email).toString();
|
||||
mReplyToAddress = BoteHelper.getNameAndDestination(
|
||||
email.getReplyAddress(I2PBote.getInstance().getIdentities()));
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// TODO Handle
|
||||
e.printStackTrace();
|
||||
@ -154,8 +146,8 @@ public class ViewEmailFragment extends Fragment {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_reply:
|
||||
Intent nei = new Intent(getActivity(), NewEmailActivity.class);
|
||||
nei.putExtra(NewEmailFragment.SENDER, mOneLocalRecipient);
|
||||
nei.putExtra(NewEmailFragment.RECIPIENT, mReplyToAddress);
|
||||
nei.putExtra(NewEmailFragment.QUOTE_MSG_FOLDER, mFolderName);
|
||||
nei.putExtra(NewEmailFragment.QUOTE_MSG_ID, mMessageId);
|
||||
startActivity(nei);
|
||||
return true;
|
||||
|
||||
|
Reference in New Issue
Block a user