コード例 #1
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   // if a result has been returned, display a notify
   if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
     OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
     result.createNotify(this).show();
   } else {
     super.onActivityResult(requestCode, resultCode, data);
   }
 }
コード例 #2
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mPubMasterKeyIds =
        getActivity().getIntent().getLongArrayExtra(CertifyKeyActivity.EXTRA_KEY_IDS);
    if (mPubMasterKeyIds == null) {
      Log.e(Constants.TAG, "List of key ids to certify missing!");
      getActivity().finish();
      return;
    }

    ArrayList<Boolean> checkedStates;
    if (savedInstanceState != null) {
      checkedStates = (ArrayList<Boolean>) savedInstanceState.getSerializable(ARG_CHECK_STATES);
      // key spinner and the checkbox keep their own state
    } else {
      checkedStates = null;

      // preselect certify key id if given
      long certifyKeyId =
          getActivity()
              .getIntent()
              .getLongExtra(CertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, Constants.key.none);
      if (certifyKeyId != Constants.key.none) {
        try {
          CachedPublicKeyRing key =
              (new ProviderHelper(getActivity())).getCachedPublicKeyRing(certifyKeyId);
          if (key.canCertify()) {
            mCertifyKeySpinner.setPreSelectedKeyId(certifyKeyId);
          }
        } catch (PgpKeyNotFoundException e) {
          Log.e(Constants.TAG, "certify certify check failed", e);
        }
      }
    }

    mUserIdsAdapter = new MultiUserIdsAdapter(getActivity(), null, 0, checkedStates);
    mUserIds.setAdapter(mUserIdsAdapter);
    mUserIds.setDividerHeight(0);

    getLoaderManager().initLoader(0, null, this);

    OperationResult result =
        getActivity().getIntent().getParcelableExtra(CertifyKeyActivity.EXTRA_RESULT);
    if (result != null) {
      // display result from import
      result.createNotify(getActivity()).show();
    }
  }