Give result down to list

This commit is contained in:
Dominik Schürmann 2014-10-05 02:24:43 +02:00
parent fa2b3054b0
commit 03fb3159b8
2 changed files with 62 additions and 54 deletions

View File

@ -81,7 +81,9 @@ public class AddKeysActivity extends ActionBarActivity implements
byte[] mImportBytes; byte[] mImportBytes;
private static final int REQUEST_CODE_SAFE_SLINGER = 1; private static final int REQUEST_CODE_RESULT = 0;
private static final int REQUEST_CODE_RESULT_TO_LIST = 1;
private static final int REQUEST_CODE_SAFE_SLINGER = 2;
private static final int LOADER_ID_BYTES = 0; private static final int LOADER_ID_BYTES = 0;
@ -130,7 +132,7 @@ public class AddKeysActivity extends ActionBarActivity implements
// show nfc help // show nfc help
Intent intent = new Intent(AddKeysActivity.this, HelpActivity.class); Intent intent = new Intent(AddKeysActivity.this, HelpActivity.class);
intent.putExtra(HelpActivity.EXTRA_SELECTED_TAB, HelpActivity.TAB_NFC); intent.putExtra(HelpActivity.EXTRA_SELECTED_TAB, HelpActivity.TAB_NFC);
startActivityForResult(intent, 0); startActivityForResult(intent, REQUEST_CODE_RESULT);
} }
}); });
@ -177,12 +179,20 @@ public class AddKeysActivity extends ActionBarActivity implements
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// if a result has been returned, display a notify switch (requestCode) {
case REQUEST_CODE_RESULT: {
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) { if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT); OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
result.createNotify(this).show(); result.createNotify(this).show();
} else { }
switch (requestCode) { break;
}
case REQUEST_CODE_RESULT_TO_LIST: {
// give it down...
setResult(0, data);
finish();
break;
}
case REQUEST_CODE_SAFE_SLINGER: { case REQUEST_CODE_SAFE_SLINGER: {
switch (resultCode) { switch (resultCode) {
case ExchangeActivity.RESULT_EXCHANGE_OK: case ExchangeActivity.RESULT_EXCHANGE_OK:
@ -226,7 +236,6 @@ public class AddKeysActivity extends ActionBarActivity implements
} }
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }
}
private String getFingerprintFromUri(Uri dataUri) { private String getFingerprintFromUri(Uri dataUri) {
String fingerprint = dataUri.toString().split(":")[1].toLowerCase(Locale.ENGLISH); String fingerprint = dataUri.toString().split(":")[1].toLowerCase(Locale.ENGLISH);
@ -383,12 +392,11 @@ public class AddKeysActivity extends ActionBarActivity implements
return; return;
} }
finish();
Intent certifyIntent = new Intent(AddKeysActivity.this, MultiCertifyKeyActivity.class); Intent certifyIntent = new Intent(AddKeysActivity.this, MultiCertifyKeyActivity.class);
certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_RESULT, result); certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_RESULT, result);
certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_KEY_IDS, result.getImportedMasterKeyIds()); certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_KEY_IDS, result.getImportedMasterKeyIds());
certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, mExchangeMasterKeyId); certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, mExchangeMasterKeyId);
startActivity(certifyIntent); startActivityForResult(certifyIntent, REQUEST_CODE_RESULT_TO_LIST);
} }
} }
}; };

View File

@ -28,16 +28,16 @@ import android.view.MenuItem;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.ExportHelper;
import org.sufficientlysecure.keychain.util.Preferences;
import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.results.OperationResult;
import org.sufficientlysecure.keychain.service.results.ConsolidateResult; import org.sufficientlysecure.keychain.service.results.ConsolidateResult;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.service.results.OperationResult;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.util.ExportHelper;
import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.Preferences;
import java.io.IOException; import java.io.IOException;