Request password in onActivityCreated(), not onResume()
This prevents the dialog being re-displayed when returning to EmailListFragment from another Activity.
This commit is contained in:
@@ -157,6 +157,10 @@ public class EmailListFragment extends ListFragment implements
|
||||
} else {
|
||||
getActivity().setTitle(
|
||||
BoteHelper.getFolderDisplayName(getActivity(), mFolder));
|
||||
if (I2PBote.getInstance().isPasswordRequired()) {
|
||||
// Request a password from the user.
|
||||
BoteHelper.requestPassword(getActivity(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,17 +172,6 @@ public class EmailListFragment extends ListFragment implements
|
||||
if (I2PBote.getInstance().isPasswordRequired()) {
|
||||
// Ensure any existing data is destroyed.
|
||||
destroyList();
|
||||
// Request a password from the user.
|
||||
BoteHelper.requestPassword(getActivity(), new BoteHelper.RequestPasswordListener() {
|
||||
@Override
|
||||
public void onPasswordVerified() {
|
||||
initializeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPasswordCanceled() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Password is cached, or not set.
|
||||
initializeList();
|
||||
|
||||
@@ -302,7 +302,8 @@ public class BoteHelper extends GeneralHelper {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
listener.onPasswordCanceled();
|
||||
if (listener != null)
|
||||
listener.onPasswordCanceled();
|
||||
}
|
||||
});
|
||||
AlertDialog passwordDialog = builder.create();
|
||||
@@ -356,7 +357,8 @@ public class BoteHelper extends GeneralHelper {
|
||||
protected void onPostExecute(String result) {
|
||||
// Password is valid
|
||||
mDialog.dismiss();
|
||||
mListener.onPasswordVerified();
|
||||
if (mListener != null)
|
||||
mListener.onPasswordVerified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user