openpgp-keychain/openpgp-keychain — pull request #305 by hav3n (2014-02-26 06:22:32+00:00)
Title: Partial fix for #304

Hello again,

I believe this is a partial implementation of issue #304(The actual testing would require me to import a bad key, and I wasn't able to do that ).

There are, as far as I know, only two places where you have used the AlertDialog.Builder directly within code
a) Inside ImportKeysActivity at line 397.
b) Inside SectionView at line 142.

The fix for a) is trivial and I have included the same in this pull request.

However, for b) there are several issues which I found:

1) SectionView is not an Activity, so its context would be dependent on the Activity using it.

2) To wrap the relevant code in a DialogFragment would require some kind of callback mechanism so that createKey() can be called in SectionView on successful key selection(an interface is what I think would be appropriate), but again, this callback mechanism requires an Activity to override the interface methods, and this activity is unknown to us in SectionView.

I'm still working on this fix, and if it actually works I will post an additional commit with the same, but I just wanted to ask you about this in advance.

P.S-I apologize for the import reordering, Android Studio auto-optimize seems to have done that.