Simplify delete key dialog

This commit is contained in:
Dominik Schürmann
2015-02-27 01:30:32 +01:00
parent 8230fb1179
commit b90335f901
2 changed files with 9 additions and 4 deletions

View File

@@ -184,7 +184,6 @@ public class ViewKeyActivity extends BaseActivity implements
} }
}); });
// Prepare the loaders. Either re-connect with an existing ones, // Prepare the loaders. Either re-connect with an existing ones,
// or start new ones. // or start new ones.
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this); getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
@@ -447,7 +446,6 @@ public class ViewKeyActivity extends BaseActivity implements
startActivityForResult(safeSlingerIntent, 0); startActivityForResult(safeSlingerIntent, 0);
} }
/** /**
* Load QR Code asynchronously and with a fade in animation * Load QR Code asynchronously and with a fade in animation
* *

View File

@@ -33,6 +33,7 @@ import android.widget.TextView;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.KeyRing;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
@@ -100,14 +101,20 @@ public class DeleteKeyDialogFragment extends DialogFragment {
ProviderHelper.FIELD_TYPE_INTEGER ProviderHelper.FIELD_TYPE_INTEGER
} }
); );
String userId = (String) data.get(KeyRings.USER_ID); String name;
String[] mainUserId = KeyRing.splitUserId((String) data.get(KeyRings.USER_ID));
if (mainUserId[0] != null) {
name = mainUserId[0];
} else {
name = getString(R.string.user_id_no_name);
}
hasSecret = ((Long) data.get(KeyRings.HAS_ANY_SECRET)) == 1; hasSecret = ((Long) data.get(KeyRings.HAS_ANY_SECRET)) == 1;
// Set message depending on which key it is. // Set message depending on which key it is.
mMainMessage.setText(getString( mMainMessage.setText(getString(
hasSecret ? R.string.secret_key_deletion_confirmation hasSecret ? R.string.secret_key_deletion_confirmation
: R.string.public_key_deletetion_confirmation, : R.string.public_key_deletetion_confirmation,
userId name
)); ));
} catch (ProviderHelper.NotFoundException e) { } catch (ProviderHelper.NotFoundException e) {
dismiss(); dismiss();