diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java index 079263e64..ccb525c05 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java @@ -51,13 +51,14 @@ import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.service.SaveKeyringParcel; import org.sufficientlysecure.keychain.ui.adapter.SubkeysAdapter; import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter; -import org.sufficientlysecure.keychain.ui.adapter.UserIdsNewAdapter; -import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment; +import org.sufficientlysecure.keychain.ui.adapter.UserIdsAddedAdapter; import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.PassphraseDialogFragment; import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment; import org.sufficientlysecure.keychain.util.Log; +import java.util.ArrayList; + public class EditKeyFragment extends LoaderFragment implements LoaderManager.LoaderCallbacks<Cursor> { @@ -76,7 +77,8 @@ public class EditKeyFragment extends LoaderFragment implements private UserIdsAdapter mUserIdsAdapter; private SubkeysAdapter mKeysAdapter; - private UserIdsNewAdapter mUserIdsAddedAdapter; + private UserIdsAddedAdapter mUserIdsAddedAdapter; + private ArrayList<UserIdsAddedAdapter.UserIdModel> mUserIdsAddedData; private Uri mDataUri; @@ -189,9 +191,10 @@ public class EditKeyFragment extends LoaderFragment implements } }); - mUserIdsAddedAdapter = new UserIdsNewAdapter(getActivity()); + // TODO: from savedInstance?! + mUserIdsAddedData = new ArrayList<UserIdsAddedAdapter.UserIdModel>(); + mUserIdsAddedAdapter = new UserIdsAddedAdapter(getActivity(), mUserIdsAddedData); mUserIdsAddedList.setAdapter(mUserIdsAddedAdapter); - mUserIdsAddedAdapter.setData(mSaveKeyringParcel.addUserIds); mKeysAdapter = new SubkeysAdapter(getActivity(), null, 0); mKeysList.setAdapter(mKeysAdapter); @@ -321,40 +324,12 @@ public class EditKeyFragment extends LoaderFragment implements } private void addUserId() { -// mSaveKeyringParcel.addUserIds.add(userId); -// mUserIdsAddedAdapter.setData(mSaveKeyringParcel.addUserIds); - - -// Handler returnHandler = new Handler() { -// @Override -// public void handleMessage(Message message) { -// switch (message.what) { -// case AddUserIdDialogFragment.MESSAGE_OKAY: -// Bundle data = message.getData(); -// String userId = data.getString(AddUserIdDialogFragment.MESSAGE_DATA_USER_ID); -// -// if (userId != null) { - -// } -// } -// getLoaderManager().getLoader(LOADER_ID_USER_IDS).forceLoad(); -// } -// }; -// -// // Create a new Messenger for the communication back -// final Messenger messenger = new Messenger(returnHandler); -// -// DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() { -// public void run() { -// AddUserIdDialogFragment dialogFragment = -// AddUserIdDialogFragment.newInstance(messenger); -// -// dialogFragment.show(getActivity().getSupportFragmentManager(), "addUserIdDialog"); -// } -// }); + mUserIdsAddedAdapter.add(new UserIdsAddedAdapter.UserIdModel()); } private void save() { + Log.d(Constants.TAG, "data: " + mUserIdsAddedAdapter.getDataAsStringList()); + String passphrase = PassphraseCacheService.getCachedPassphrase(getActivity(), mSaveKeyringParcel.mMasterKeyId); if (passphrase == null) { |