1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Remove reference to NonConfigurationInstance when no longer needed

This commit is contained in:
cketti 2011-10-14 04:15:45 +02:00
parent 5b81dbc2ed
commit fd16ff8fe6

View File

@ -923,7 +923,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
@Override @Override
public void restore(Activity activity) { public void restore(Activity activity) {
show(activity); show((Accounts) activity);
} }
@Override @Override
@ -936,7 +936,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
return false; return false;
} }
public void show(final Activity activity) { public void show(final Accounts activity) {
final String message = activity.getString(mMessageRes, mArguments); final String message = activity.getString(mMessageRes, mArguments);
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
@ -947,16 +947,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
destroy(); activity.setNonConfigurationInstance(null);
} }
}); });
mDialog = builder.show(); mDialog = builder.show();
} }
private void destroy() {
mDialog = null;
mArguments = null;
}
} }
private void showImportSelectionDialog(ImportContents importContents, Uri uri, private void showImportSelectionDialog(ImportContents importContents, Uri uri,
@ -1071,7 +1066,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
boolean overwrite = false; boolean overwrite = false;
dialog.dismiss(); dialog.dismiss();
destroy(); activity.setNonConfigurationInstance(null);
ImportAsyncTask importAsyncTask = new ImportAsyncTask(activity, ImportAsyncTask importAsyncTask = new ImportAsyncTask(activity,
includeGlobals, accountUuids, overwrite, mEncryptionKey, mUri); includeGlobals, accountUuids, overwrite, mEncryptionKey, mUri);
@ -1084,20 +1079,11 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
destroy(); activity.setNonConfigurationInstance(null);
} }
}); });
mDialog = builder.show(); mDialog = builder.show();
} }
private void destroy() {
mDialog = null;
mImportContents = null;
mUri = null;
mEncryptionKey = null;
mSelection = null;
mImportSelectionView = null;
}
} }
private void setNonConfigurationInstance(NonConfigurationInstance inst) { private void setNonConfigurationInstance(NonConfigurationInstance inst) {
@ -1435,6 +1421,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.w(K9.LOG_TAG, "Couldn't open import file", e); Log.w(K9.LOG_TAG, "Couldn't open import file", e);
return false; return false;
} catch (Exception e) {
Log.w(K9.LOG_TAG, "Unknown error", e);
return false;
} }
return true; return true;
} }