Fixing rotate crashes in create key

This commit is contained in:
Dominik Schürmann 2015-05-10 13:16:03 +02:00
parent e4b7920edc
commit a35594201a
2 changed files with 5 additions and 9 deletions

View File

@ -48,7 +48,7 @@ import java.util.regex.Pattern;
public class CreateKeyEmailFragment extends Fragment {
private CreateKeyActivity mCreateKeyActivity;
private EmailEditText mEmailEdit;
private ArrayList<EmailAdapter.ViewModel> mAdditionalEmailModels;
private ArrayList<EmailAdapter.ViewModel> mAdditionalEmailModels = new ArrayList<>();
private EmailAdapter mEmailAdapter;
// NOTE: Do not use more complicated pattern like defined in android.util.Patterns.EMAIL_ADDRESS
@ -119,10 +119,6 @@ public class CreateKeyEmailFragment extends Fragment {
emailsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
emailsRecyclerView.setItemAnimator(new DefaultItemAnimator());
// initial values
if (mAdditionalEmailModels == null) {
mAdditionalEmailModels = new ArrayList<>();
}
if (mEmailAdapter == null) {
mEmailAdapter = new EmailAdapter(mAdditionalEmailModels, new View.OnClickListener() {
@Override

View File

@ -94,12 +94,12 @@ public class ProgressDialogFragment extends DialogFragment {
/** Updates progress of dialog */
public void setProgress(String message, int progress, int max) {
if (mIsCancelled) {
ProgressDialog dialog = (ProgressDialog) getDialog();
if (mIsCancelled || dialog == null) {
return;
}
ProgressDialog dialog = (ProgressDialog) getDialog();
dialog.setMessage(message);
dialog.setProgress(progress);
dialog.setMax(max);