This commit is contained in:
Dominik Schürmann 2014-03-11 00:28:28 +01:00
parent 05126a7d15
commit 50ed5db001
2 changed files with 35 additions and 41 deletions

View File

@ -367,7 +367,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
// Execute this when searching
mSearchView.setOnQueryTextListener(this);
//Erase search result without focus
// Erase search result without focus
MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {

View File

@ -71,50 +71,44 @@ public class SelectSecretKeyLayoutFragment extends Fragment {
mKeyUserIdRest.setVisibility(View.GONE);
} else {
String uid = getResources().getString(R.string.user_id_no_name);
String uidExtra = "";
String masterkeyIdHex = "";
PGPSecretKeyRing keyRing = ProviderHelper.getPGPSecretKeyRingByMasterKeyId(
getActivity(), secretKeyId);
if (keyRing != null) {
PGPSecretKey key = PgpKeyHelper.getMasterKey(keyRing);
masterkeyIdHex = PgpKeyHelper.convertKeyIdToHex(secretKeyId);
String masterkeyIdHex = PgpKeyHelper.convertKeyIdToHex(secretKeyId);
if (key != null) {
String userId = PgpKeyHelper.getMainUserIdSafe(getActivity(), key);
/*String chunks[] = mUserId.split(" <", 2);
uid = chunks[0];
if (chunks.length > 1) {
uidExtra = "<" + chunks[1];
}*/
String[] userIdSplit = PgpKeyHelper.splitUserId(userId);
String userName, userEmail;
String userName, userEmail;
if (userIdSplit[0] != null) { userName = userIdSplit[0]; }
else { userName = getActivity().getResources().getString(R.string.user_id_no_name); }
if (userIdSplit[0] != null) {
userName = userIdSplit[0];
} else {
userName = getActivity().getResources().getString(R.string.user_id_no_name);
}
if (userIdSplit[1] != null) { userEmail = userIdSplit[1]; }
else { userEmail = getActivity().getResources().getString(R.string.error_user_id_no_email); }
if (userIdSplit[1] != null) {
userEmail = userIdSplit[1];
} else {
userEmail = getActivity().getResources().getString(R.string.error_user_id_no_email);
}
mKeyMasterKeyIdHex.setText(masterkeyIdHex);
mKeyUserId.setText(userName);
mKeyUserIdRest.setText(userEmail);
mKeyUserId.setVisibility(View.VISIBLE);
mKeyUserIdRest.setVisibility(View.VISIBLE);
}
else{
} else {
mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_key));
mKeyUserId.setVisibility(View.GONE);
mKeyUserIdRest.setVisibility(View.GONE);
}
}
else{
mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_keys_added_or_updated)+" for master id: "+secretKeyId);
mKeyUserId.setVisibility(View.GONE);
mKeyUserIdRest.setVisibility(View.GONE);
} else {
mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_keys_added_or_updated) + " for master id: " + secretKeyId);
mKeyUserId.setVisibility(View.GONE);
mKeyUserIdRest.setVisibility(View.GONE);
}
}
@ -154,31 +148,31 @@ public class SelectSecretKeyLayoutFragment extends Fragment {
startActivityForResult(intent, REQUEST_CODE_SELECT_KEY);
}
//Select Secret Key Activity delivers the intent which was sent by it using interface to Select
// Select Secret Key Activity delivers the intent which was sent by it using interface to Select
// Secret Key Fragment.Intent contains Master Key Id, User Email, User Name, Master Key Id Hex.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode & 0xFFFF) {
case REQUEST_CODE_SELECT_KEY: {
long secretKeyId;
if (resultCode == Activity.RESULT_OK) {
Bundle bundle = data.getExtras();
secretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID);
selectKey(secretKeyId);
case REQUEST_CODE_SELECT_KEY: {
long secretKeyId;
if (resultCode == Activity.RESULT_OK) {
Bundle bundle = data.getExtras();
secretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID);
selectKey(secretKeyId);
// remove displayed errors
mKeyUserId.setError(null);
// remove displayed errors
mKeyUserId.setError(null);
// give value back to callback
mCallback.onKeySelected(secretKeyId);
// give value back to callback
mCallback.onKeySelected(secretKeyId);
}
break;
}
break;
}
default:
super.onActivityResult(requestCode, resultCode, data);
default:
super.onActivityResult(requestCode, resultCode, data);
break;
break;
}
}
}