mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
cleanup
This commit is contained in:
parent
05126a7d15
commit
50ed5db001
@ -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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user