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 // Execute this when searching
mSearchView.setOnQueryTextListener(this); mSearchView.setOnQueryTextListener(this);
//Erase search result without focus // Erase search result without focus
MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() { MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
@Override @Override
public boolean onMenuItemActionExpand(MenuItem item) { public boolean onMenuItemActionExpand(MenuItem item) {

View File

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