Include source origin in string key name.

This should help eliminate string duplicates, as well as provide
visibility into where strings in a resource file are being used.
This commit is contained in:
Moxie Marlinspike
2012-09-19 19:56:04 -07:00
parent faad1e57ea
commit bb0ec65744
63 changed files with 579 additions and 547 deletions

View File

@@ -39,16 +39,16 @@ public class ApplicationExportManager extends Handler implements Runnable {
public void importDatabase() {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setTitle(R.string.import_database_and_settings_title);
alertBuilder.setMessage(R.string.import_database_and_settings_message);
alertBuilder.setTitle(R.string.ApplicationExportManager_import_database_and_settings_title);
alertBuilder.setMessage(R.string.ApplicationExportManager_import_database_and_settings_message);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("Import", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
task = TASK_IMPORT;
progressDialog = new ProgressDialog(context);
progressDialog.setTitle(context.getString(R.string.importing_database_and_keys));
progressDialog.setTitle(context.getString(R.string.ApplicationExportManager_importing_database_and_keys));
progressDialog.setMessage(context
.getString(R.string.importing_your_sms_database_keys_and_settings));
.getString(R.string.ApplicationExportManager_importing_your_sms_database_keys_and_settings));
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
@@ -69,17 +69,17 @@ public class ApplicationExportManager extends Handler implements Runnable {
public void exportDatabase() {
Log.w("ApplicationExportManager", "Context: " + context);
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setTitle(R.string.export_database_question);
alertBuilder.setMessage(R.string.export_textsecure_database_keys_and_settings_prompt);
alertBuilder.setTitle(R.string.ApplicationExportManager_export_database_question);
alertBuilder.setMessage(R.string.ApplicationExportManager_export_textsecure_database_keys_and_settings_prompt);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("Export", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
task = TASK_EXPORT;
progressDialog = new ProgressDialog(context);
progressDialog.setTitle(context.getString(R.string.exporting_database_and_keys));
progressDialog.setTitle(context.getString(R.string.ApplicationExportManager_exporting_database_and_keys));
progressDialog.setMessage(context
.getString(R.string.exporting_your_sms_database_keys_and_settings));
.getString(R.string.ApplicationExportManager_exporting_your_sms_database_keys_and_settings));
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
@@ -117,18 +117,22 @@ public class ApplicationExportManager extends Handler implements Runnable {
public void handleMessage(Message message) {
switch (message.what) {
case ERROR_NO_SD:
Toast.makeText(context, R.string.no_sd_card_found_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.ApplicationExportManager_no_sd_card_found_exclamation,
Toast.LENGTH_LONG).show();
break;
case ERROR_IO:
Toast.makeText(context, R.string.error_exporting_to_sd_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.ApplicationExportManager_error_exporting_to_sd_exclamation,
Toast.LENGTH_LONG).show();
break;
case COMPLETE:
switch (task) {
case TASK_IMPORT:
Toast.makeText(context, R.string.import_successful_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.ApplicationExportManager_import_successful_exclamation,
Toast.LENGTH_LONG).show();
break;
case TASK_EXPORT:
Toast.makeText(context, R.string.export_successful_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(context, R.string.ApplicationExportManager_export_successful_exclamation,
Toast.LENGTH_LONG).show();
break;
}
break;

View File

@@ -35,8 +35,8 @@ public class ApplicationMigrationManager extends Handler {
private void displayMigrationProgress() {
progressDialog = new ProgressDialog(context);
progressDialog.setTitle(context.getString(R.string.migrating_database));
progressDialog.setMessage(context.getString(R.string.migrating_text_message_database));
progressDialog.setTitle(context.getString(R.string.ApplicationMigrationManager_migrating_database));
progressDialog.setMessage(context.getString(R.string.ApplicationMigrationManager_migrating_text_message_database));
progressDialog.setMax(10000);
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(false);
@@ -51,11 +51,12 @@ public class ApplicationMigrationManager extends Handler {
private void displayMigrationPrompt() {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setTitle(R.string.copy_system_text_message_database_question);
alertBuilder.setMessage(R.string.copy_system_text_message_database_explanation);
alertBuilder.setTitle(R.string.ApplicationMigrationManager_copy_system_text_message_database_question);
alertBuilder.setMessage(R.string.ApplicationMigrationManager_copy_system_text_message_database_explanation);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton(R.string.copy, new DialogInterface.OnClickListener() {
alertBuilder.setPositiveButton(R.string.ApplicationMigrationManager_copy,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
displayMigrationProgress();
Intent intent = new Intent(context, ApplicationMigrationService.class);
@@ -65,7 +66,8 @@ public class ApplicationMigrationManager extends Handler {
}
});
alertBuilder.setNegativeButton(R.string.dont_copy, new DialogInterface.OnClickListener() {
alertBuilder.setNegativeButton(R.string.ApplicationMigrationManager_dont_copy,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
context.getSharedPreferences("SecureSMS", Context.MODE_PRIVATE)
.edit()

View File

@@ -139,8 +139,8 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
if (identityKey == null) {
Dialogs.displayAlert(this,
getString(R.string.not_found_exclamation),
getString(R.string.no_valid_identity_key_was_found_in_the_specified_contact),
getString(R.string.ApplicationPreferenceActivity_not_found_exclamation),
getString(R.string.ApplicationPreferenceActivity_no_valid_identity_key_was_found_in_the_specified_contact),
android.R.drawable.ic_dialog_alert);
return;
}
@@ -177,14 +177,14 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
if (!IdentityKeyUtil.hasIdentityKey(ApplicationPreferencesActivity.this)) {
Toast.makeText(ApplicationPreferencesActivity.this,
R.string.you_don_t_have_an_identity_key_exclamation,
R.string.ApplicationPreferenceActivity_you_don_t_have_an_identity_key_exclamation,
Toast.LENGTH_LONG).show();
return true;
}
if (contactUri == null) {
Toast.makeText(ApplicationPreferencesActivity.this,
R.string.you_have_not_yet_defined_a_contact_for_yourself,
R.string.ApplicationPreferenceActivity_you_have_not_yet_defined_a_contact_for_yourself,
Toast.LENGTH_LONG).show();
return true;
}
@@ -193,7 +193,7 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
IdentityKeyUtil.getIdentityKey(ApplicationPreferencesActivity.this));
Toast.makeText(ApplicationPreferencesActivity.this,
R.string.exported_to_contacts_database,
R.string.ApplicationPreferenceActivity_exported_to_contacts_database,
Toast.LENGTH_LONG).show();
return true;
@@ -209,7 +209,7 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
startActivityForResult(importIntent, IMPORT_IDENTITY_ID);
} else {
Toast.makeText(ApplicationPreferencesActivity.this,
R.string.you_need_to_have_entered_your_passphrase_before_importing_keys,
R.string.ApplicationPreferenceActivity_you_need_to_have_entered_your_passphrase_before_importing_keys,
Toast.LENGTH_LONG).show();
}
@@ -227,7 +227,7 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
startActivity(manageIntent);
} else {
Toast.makeText(ApplicationPreferencesActivity.this,
R.string.you_need_to_have_entered_your_passphrase_before_managing_keys,
R.string.ApplicationPreferenceActivity_you_need_to_have_entered_your_passphrase_before_managing_keys,
Toast.LENGTH_LONG).show();
}
@@ -243,7 +243,7 @@ public class ApplicationPreferencesActivity extends SherlockPreferenceActivity {
startActivity(new Intent(ApplicationPreferencesActivity.this, PassphraseChangeActivity.class));
} else {
Toast.makeText(ApplicationPreferencesActivity.this,
R.string.you_havent_set_a_passphrase_yet,
R.string.ApplicationPreferenceActivity_you_havent_set_a_passphrase_yet,
Toast.LENGTH_LONG).show();
}

View File

@@ -260,10 +260,11 @@ public class ConversationActivity extends SherlockFragmentActivity
final Recipient recipient = getRecipients().getPrimaryRecipient();
String recipientName = (recipient.getName() == null ? recipient.getNumber() : recipient.getName());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.initiate_secure_session_question);
builder.setTitle(R.string.ConversationActivity_initiate_secure_session_question);
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setCancelable(true);
builder.setMessage(String.format(getString(R.string.initiate_secure_session_with_s_question), recipientName));
builder.setMessage(String.format(getString(R.string.ConversationActivity_initiate_secure_session_with_s_question),
recipientName));
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -278,10 +279,10 @@ public class ConversationActivity extends SherlockFragmentActivity
private void handleAbortSecureSession() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.abort_secure_session_confirmation);
builder.setTitle(R.string.ConversationActivity_abort_secure_session_confirmation);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setCancelable(true);
builder.setMessage(R.string.are_you_sure_that_you_want_to_abort_this_secure_session_question);
builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_abort_this_secure_session_question);
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -306,10 +307,10 @@ public class ConversationActivity extends SherlockFragmentActivity
private void handleDeleteThread() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.delete_thread_confirmation);
builder.setTitle(R.string.ConversationActivity_delete_thread_confirmation);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setCancelable(true);
builder.setMessage(R.string.are_you_sure_that_you_want_to_permanently_delete_this_conversation_question);
builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_permanently_delete_this_conversation_question);
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -327,7 +328,7 @@ public class ConversationActivity extends SherlockFragmentActivity
private void handleAddAttachment() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(R.drawable.ic_dialog_attach);
builder.setTitle(R.string.add_attachment);
builder.setTitle(R.string.ConversationActivity_add_attachment);
builder.setAdapter(attachmentAdapter, new AttachmentTypeListener());
builder.show();
}
@@ -356,7 +357,7 @@ public class ConversationActivity extends SherlockFragmentActivity
subtitle = getRecipients().getPrimaryRecipient().getNumber();
}
} else {
title = getString(R.string.compose_message);
title = getString(R.string.ConversationActivity_compose_message);
subtitle = "";
}
@@ -473,7 +474,7 @@ public class ConversationActivity extends SherlockFragmentActivity
attachmentManager.setImage(imageUri);
} catch (IOException e) {
attachmentManager.clear();
Toast.makeText(this, R.string.sorry_there_was_an_error_setting_your_attachment,
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
Toast.LENGTH_LONG).show();
Log.w("ComposeMessageActivity", e);
}
@@ -484,12 +485,12 @@ public class ConversationActivity extends SherlockFragmentActivity
attachmentManager.setVideo(videoUri);
} catch (IOException e) {
attachmentManager.clear();
Toast.makeText(this, R.string.sorry_there_was_an_error_setting_your_attachment,
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
Toast.LENGTH_LONG).show();
Log.w("ComposeMessageActivity", e);
} catch (MediaTooLargeException e) {
attachmentManager.clear();
Toast.makeText(this, R.string.sorry_the_selected_video_exceeds_message_size_restrictions,
Toast.makeText(this, R.string.ConversationActivity_sorry_the_selected_video_exceeds_message_size_restrictions,
Toast.LENGTH_LONG).show();
Log.w("ComposeMessageActivity", e);
}
@@ -500,12 +501,12 @@ public class ConversationActivity extends SherlockFragmentActivity
attachmentManager.setAudio(audioUri);
} catch (IOException e) {
attachmentManager.clear();
Toast.makeText(this, R.string.sorry_there_was_an_error_setting_your_attachment,
Toast.makeText(this, R.string.ConversationActivity_sorry_there_was_an_error_setting_your_attachment,
Toast.LENGTH_LONG).show();
Log.w("ComposeMessageActivity", e);
} catch (MediaTooLargeException e) {
attachmentManager.clear();
Toast.makeText(this, R.string.sorry_the_selected_audio_exceeds_message_size_restrictions,
Toast.makeText(this, R.string.ConversationActivity_sorry_the_selected_audio_exceeds_message_size_restrictions,
Toast.LENGTH_LONG).show();
Log.w("ComposeMessageActivity", e);
}
@@ -545,7 +546,7 @@ public class ConversationActivity extends SherlockFragmentActivity
String rawText = composeText.getText().toString();
if (rawText.length() < 1 && !attachmentManager.isAttachmentPresent())
throw new InvalidMessageException(getString(R.string.message_is_empty_exclamation));
throw new InvalidMessageException(getString(R.string.ConversationActivity_message_is_empty_exclamation));
if (!sendEncrypted && Tag.isTaggable(this, rawText))
rawText = Tag.getTaggedMessage(rawText);
@@ -600,11 +601,11 @@ public class ConversationActivity extends SherlockFragmentActivity
MessageNotifier.updateNotification(ConversationActivity.this, false);
} catch (RecipientFormattingException ex) {
Toast.makeText(ConversationActivity.this,
R.string.recipient_is_not_a_valid_sms_or_email_address_exclamation,
R.string.ConversationActivity_recipient_is_not_a_valid_sms_or_email_address_exclamation,
Toast.LENGTH_LONG).show();
Log.w("compose", ex);
} catch (InvalidMessageException ex) {
Toast.makeText(ConversationActivity.this, R.string.message_is_empty_exclamation,
Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
Toast.LENGTH_SHORT).show();
Log.w("compose", ex);
} catch (MmsException e) {

View File

@@ -130,10 +130,11 @@ public class ConversationFragment extends SherlockListFragment
SimpleDateFormat dateFormatter = new SimpleDateFormat("EEE MMM d, yyyy 'at' hh:mm:ss a zzz");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.message_details);
builder.setTitle(R.string.ConversationFragment_message_details);
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setCancelable(false);
builder.setMessage(String.format(getSherlockActivity().getString(R.string.sender_s_transport_s_sent_received_s),
builder.setMessage(String.format(getSherlockActivity()
.getString(R.string.ConversationFragment_sender_s_transport_s_sent_received_s),
sender, transport.toUpperCase(),
dateFormatter.format(new Date(date))));
builder.setPositiveButton(android.R.string.ok, null);

View File

@@ -152,9 +152,11 @@ public class ConversationItem extends LinearLayout {
}
private void setMmsNotificationAttributes(MmsMessageRecord messageRecord) {
String messageSize = String.format(getContext().getString(R.string.message_size_d_kb),
String messageSize = String.format(getContext()
.getString(R.string.ConversationItem_message_size_d_kb),
messageRecord.getMessageSize());
String expires = String.format(getContext().getString(R.string.expires_s),
String expires = String.format(getContext()
.getString(R.string.ConversationItem_expires_s),
DateUtils.getRelativeTimeSpanString(getContext(),
messageRecord.getExpiration(),
false));
@@ -214,10 +216,10 @@ public class ConversationItem extends LinearLayout {
private void setBodyText(MessageRecord messageRecord) {
String body = messageRecord.getBody();
if (messageRecord.isKeyExchange() && messageRecord.isOutgoing()) body = "\n" + getContext().getString(R.string.key_exchange_message2);
else if (messageRecord.isProcessedKeyExchange() && !messageRecord.isOutgoing()) body = "\n" + getContext().getString(R.string.received_and_processed_key_exchange_message);
else if (messageRecord.isStaleKeyExchange()) body = "\n" + getContext().getString(R.string.error_received_stale_key_exchange_message);
else if (messageRecord.isKeyExchange() && !messageRecord.isOutgoing()) body = "\n" + getContext().getString(R.string.received_key_exchange_message_click_to_process);
if (messageRecord.isKeyExchange() && messageRecord.isOutgoing()) body = "\n" + getContext().getString(R.string.ConversationItem_key_exchange_message);
else if (messageRecord.isProcessedKeyExchange() && !messageRecord.isOutgoing()) body = "\n" + getContext().getString(R.string.ConversationItem_received_and_processed_key_exchange_message);
else if (messageRecord.isStaleKeyExchange()) body = "\n" + getContext().getString(R.string.ConversationItem_error_received_stale_key_exchange_message);
else if (messageRecord.isKeyExchange() && !messageRecord.isOutgoing()) body = "\n" + getContext().getString(R.string.ConversationItem_received_key_exchange_message_click_to_process);
else if (messageRecord.isOutgoing() && Tag.isTagged(body)) body = Tag.stripTag(body);
bodyText.setText(body, TextView.BufferType.SPANNABLE);
@@ -296,8 +298,8 @@ public class ConversationItem extends LinearLayout {
mmsDownloadButton.setVisibility(View.GONE);
mmsDownloadingLabel.setVisibility(View.GONE);
if (messageRecord.isFailed()) dateText.setText(R.string.error_sending_message);
else if (messageRecord.isPending()) dateText.setText(R.string.sending);
if (messageRecord.isFailed()) dateText.setText(R.string.ConversationItem_error_sending_message);
else if (messageRecord.isPending()) dateText.setText(R.string.ConversationItem_sending);
else dateText.setText(DateUtils.getRelativeTimeSpanString(getContext(),
messageRecord.getDate(),
false));
@@ -380,8 +382,8 @@ public class ConversationItem extends LinearLayout {
private void saveToSdCard() {
progressDialog = new ProgressDialog(context);
progressDialog.setTitle(context.getString(R.string.saving_attachment));
progressDialog.setMessage(context.getString(R.string.saving_attachment_to_sd_card));
progressDialog.setTitle(context.getString(R.string.ConversationItem_saving_attachment));
progressDialog.setMessage(context.getString(R.string.ConversationItem_saving_attachment_to_sd_card));
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
@@ -391,10 +393,10 @@ public class ConversationItem extends LinearLayout {
public boolean onLongClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.save_to_sd_card);
builder.setTitle(R.string.ConversationItem_save_to_sd_card);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setCancelable(true);
builder.setMessage(R.string.this_media_has_been_stored_in_an_encrypted_database_warning);
builder.setMessage(R.string.ConversationItem_this_media_has_been_stored_in_an_encrypted_database_warning);
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
saveToSdCard();
@@ -410,15 +412,15 @@ public class ConversationItem extends LinearLayout {
public void handleMessage(Message message) {
switch (message.what) {
case FAILURE:
Toast.makeText(context, R.string.error_while_saving_attachment_to_sd_card,
Toast.makeText(context, R.string.ConversationItem_error_while_saving_attachment_to_sd_card,
Toast.LENGTH_LONG).show();
break;
case SUCCESS:
Toast.makeText(context, R.string.success_exclamation,
Toast.makeText(context, R.string.ConversationItem_success_exclamation,
Toast.LENGTH_LONG).show();
break;
case WRITE_ACCESS_FAILURE:
Toast.makeText(context, R.string.unable_to_write_to_sd_card_exclamation,
Toast.makeText(context, R.string.ConversationItem_unable_to_write_to_sd_card_exclamation,
Toast.LENGTH_LONG).show();
break;
}
@@ -453,10 +455,10 @@ public class ConversationItem extends LinearLayout {
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.view_secure_media_question);
builder.setTitle(R.string.ConversationItem_view_secure_media_question);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setCancelable(true);
builder.setMessage(R.string.this_media_has_been_stored_in_an_encrypted_database_external_viewer_warning);
builder.setMessage(R.string.ConversationItem_this_media_has_been_stored_in_an_encrypted_database_external_viewer_warning);
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
fireIntent();

View File

@@ -78,10 +78,10 @@ public class ConversationListAdapter extends CursorAdapter {
if (body == null) body = "(No subject)";
if (body.startsWith(Prefix.SYMMETRIC_ENCRYPT) || body.startsWith(Prefix.ASYMMETRIC_ENCRYPT) || body.startsWith(Prefix.ASYMMETRIC_LOCAL_ENCRYPT)) {
message.setBody(context.getString(R.string.encrypted_message_enter_passphrase));
message.setBody(context.getString(R.string.ConversationListAdapter_encrypted_message_enter_passphrase));
message.setEmphasis(true);
} else if (body.startsWith(Prefix.KEY_EXCHANGE)) {
message.setBody(context.getString(R.string.key_exchange_message));
message.setBody(context.getString(R.string.ConversationListAdapter_key_exchange_message));
message.setEmphasis(true);
} else {
message.setBody(body);

View File

@@ -148,11 +148,11 @@ private void initializeSearch(android.widget.SearchView searchView) {
private void handleDeleteAllSelected() {
AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
alert.setIcon(android.R.drawable.ic_dialog_alert);
alert.setTitle(R.string.delete_threads_question);
alert.setMessage(R.string.are_you_sure_you_wish_to_delete_all_selected_conversation_threads);
alert.setTitle(R.string.ConversationListFragment_delete_threads_question);
alert.setMessage(R.string.ConversationListFragment_are_you_sure_you_wish_to_delete_all_selected_conversation_threads);
alert.setCancelable(true);
alert.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
alert.setPositiveButton(R.string.ConversationListFragment_delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Set<Long> selectedConversations = ((ConversationListAdapter)getListAdapter())
.getBatchSelections();
@@ -164,7 +164,7 @@ private void initializeSearch(android.widget.SearchView searchView) {
}
});
alert.setNegativeButton(R.string.cancel, null);
alert.setNegativeButton(R.string.ConversationListFragment_cancel, null);
alert.show();
}

View File

@@ -90,7 +90,8 @@ public class ConversationListItem extends RelativeLayout {
this.fromView.setText(formatFrom(recipients, message.getCount(), message.getRead()));
if (message.isKeyExchange())
this.subjectView.setText(R.string.key_exchange_message, TextView.BufferType.SPANNABLE);
this.subjectView.setText(R.string.ConversationListItem_key_exchange_message,
TextView.BufferType.SPANNABLE);
else
this.subjectView.setText(message.getBody(), TextView.BufferType.SPANNABLE);

View File

@@ -78,7 +78,8 @@ public abstract class KeyScanningActivity extends SherlockActivity {
Dialogs.displayAlert(this, getNotVerifiedTitle(), getNotVerifiedMessage(), android.R.drawable.ic_dialog_alert);
}
} else {
Toast.makeText(this, R.string.no_scanned_key_found_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
Toast.LENGTH_LONG).show();
}
}

View File

@@ -75,7 +75,7 @@ public class PassphraseChangeActivity extends PassphraseActivity {
try {
if (!passphrase.equals(passphraseRepeat)) {
Toast.makeText(getApplicationContext(),
R.string.passphrases_dont_match_exclamation,
R.string.PassphraseChangeActivity_passphrases_dont_match_exclamation,
Toast.LENGTH_SHORT).show();
this.newPassphrase.setText("");
this.repeatPassphrase.setText("");
@@ -88,7 +88,8 @@ public class PassphraseChangeActivity extends PassphraseActivity {
setMasterSecret(masterSecret);
}
} catch (InvalidPassphraseException e) {
Toast.makeText(this, R.string.incorrect_old_passphrase_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.PassphraseChangeActivity_incorrect_old_passphrase_exclamation,
Toast.LENGTH_LONG).show();
this.originalPassphrase.setText("");
}
}

View File

@@ -69,7 +69,8 @@ public class PassphraseCreateActivity extends PassphraseActivity {
String passphraseRepeat = this.passphraseRepeatEdit.getText().toString();
if (!passphrase.equals(passphraseRepeat)) {
Toast.makeText(getApplicationContext(), R.string.passphrases_dont_match_exclamation,
Toast.makeText(getApplicationContext(),
R.string.PassphraseCreateActivity_passphrases_dont_match_exclamation,
Toast.LENGTH_SHORT).show();
this.passphraseEdit.setText("");
this.passphraseRepeatEdit.setText("");
@@ -97,8 +98,8 @@ public class PassphraseCreateActivity extends PassphraseActivity {
public void generate() {
progressDialog = new ProgressDialog(PassphraseCreateActivity.this);
progressDialog.setTitle(R.string.generating_keypair);
progressDialog.setMessage(getString(R.string.generating_a_local_encryption_keypair));
progressDialog.setTitle(R.string.PassphraseCreateActivity_generating_keypair);
progressDialog.setMessage(getString(R.string.PassphraseCreateActivity_generating_a_local_encryption_keypair));
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

View File

@@ -68,7 +68,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
setMasterSecret(masterSecret);
} catch (InvalidPassphraseException ipe) {
Toast.makeText(getApplicationContext(),
R.string.invalid_passphrase_exclamation,
R.string.PassphrasePromptActivity_invalid_passphrase_exclamation,
Toast.LENGTH_SHORT).show();
}
}

View File

@@ -91,18 +91,18 @@ public class ReceiveKeyActivity extends Activity {
}
private void initializeCorruptedKeyText() {
descriptionText.setText(R.string.error_you_have_received_a_corrupted_public_key);
descriptionText.setText(R.string.ReceiveKeyActivity_error_you_have_received_a_corrupted_public_key);
confirmButton.setVisibility(View.GONE);
}
private void initializeBadVersionText() {
descriptionText.setText(R.string.error_you_have_received_a_public_key_from_an_unsupported_version_of_the_protocol);
descriptionText.setText(R.string.ReceiveKeyActivity_error_you_have_received_a_public_key_from_an_unsupported_version_of_the_protocol);
confirmButton.setVisibility(View.GONE);
}
private void initializeSignatureText() {
if (!keyExchangeMessage.hasIdentityKey()) {
signatureText.setText(R.string.this_key_exchange_message_does_not_include_an_identity_signature);
signatureText.setText(R.string.ReceiveKeyActivity_this_key_exchange_message_does_not_include_an_identity_signature);
return;
}
@@ -110,25 +110,25 @@ public class ReceiveKeyActivity extends Activity {
String identityName = DatabaseFactory.getIdentityDatabase(this).getNameForIdentity(masterSecret, identityKey);
if (identityName == null) {
signatureText.setText(R.string.this_key_exchange_message_includes_an_identity_signature_but_you_do_not_yet_trust_it);
signatureText.setText(R.string.ReceiveKeyActivity_this_key_exchange_message_includes_an_identity_signature_but_you_do_not_yet_trust_it);
} else {
signatureText.setText(String.format(getString(R.string.this_key_exchange_message_includes_an_identity_signature_which_you_trust_for_s), identityName));
signatureText.setText(String.format(getString(R.string.ReceiveKeyActivity_this_key_exchange_message_includes_an_identity_signature_which_you_trust_for_s), identityName));
}
}
private void initializeTextForExistingSession() {
if (keyExchangeProcessor.isRemoteKeyExchangeForExistingSession(keyExchangeMessage)) {
descriptionText.setText(String.format(getString(R.string.this_is_the_key_that_you_sent_to_start_your_current_encrypted_session_with_s), recipient.toShortString()));
descriptionText.setText(String.format(getString(R.string.ReceiveKeyActivity_this_is_the_key_that_you_sent_to_start_your_current_encrypted_session_with_s), recipient.toShortString()));
this.confirmButton.setVisibility(View.GONE);
this.verifySessionButton.setVisibility(View.VISIBLE);
this.verifyIdentityButton.setVisibility(View.VISIBLE);
} else if (keyExchangeProcessor.isLocalKeyExchangeForExistingSession(keyExchangeMessage)) {
descriptionText.setText(String.format(getString(R.string.this_is_the_key_that_you_received_to_start_your_current_encrypted_session_with_s), recipient.toShortString()));
descriptionText.setText(String.format(getString(R.string.ReceiveKeyActivity_this_is_the_key_that_you_received_to_start_your_current_encrypted_session_with_s), recipient.toShortString()));
this.confirmButton.setVisibility(View.GONE);
this.verifySessionButton.setVisibility(View.VISIBLE);
this.verifyIdentityButton.setVisibility(View.VISIBLE);
} else {
descriptionText.setText(String.format(getString(R.string.you_have_received_a_key_exchange_message_from_s_warning_you_already_have_an_encrypted_session), recipient.toShortString()));
descriptionText.setText(String.format(getString(R.string.ReceiveKeyActivity_you_have_received_a_key_exchange_message_from_s_warning_you_already_have_an_encrypted_session), recipient.toShortString()));
this.confirmButton.setVisibility(View.VISIBLE);
this.verifyIdentityButton.setVisibility(View.GONE);
this.verifySessionButton.setVisibility(View.GONE);
@@ -137,11 +137,11 @@ public class ReceiveKeyActivity extends Activity {
private void initializeTextForNewSession() {
if (keyExchangeProcessor.hasInitiatedSession() && !this.sent)
descriptionText.setText(String.format(getString(R.string.you_have_received_a_key_exchange_message_from_s_you_have_previously_initiated), recipient.toShortString()));
descriptionText.setText(String.format(getString(R.string.ReceiveKeyActivity_you_have_received_a_key_exchange_message_from_s_you_have_previously_initiated), recipient.toShortString()));
else if (keyExchangeProcessor.hasInitiatedSession() && this.sent)
descriptionText.setText(String.format(getString(R.string.you_have_initiated_a_key_exchange_message_with_s_but_have_not_yet_received_a_reply), recipient.toShortString()));
descriptionText.setText(String.format(getString(R.string.ReceiveKeyActivity_you_have_initiated_a_key_exchange_message_with_s_but_have_not_yet_received_a_reply), recipient.toShortString()));
else if (!keyExchangeProcessor.hasInitiatedSession() && !this.sent)
descriptionText.setText(String.format(getString(R.string.you_have_received_a_key_exchange_message_from_s_you_have_no_existing_session), recipient.toShortString()));
descriptionText.setText(String.format(getString(R.string.ReceiveKeyActivity_you_have_received_a_key_exchange_message_from_s_you_have_no_existing_session), recipient.toShortString()));
}
private void initializeKey() throws InvalidKeyException, InvalidVersionException {

View File

@@ -127,10 +127,12 @@ public class ReviewIdentitiesActivity extends SherlockListActivity {
startActivity(viewIntent);
} catch (InvalidKeyException ike) {
Log.w("ReviewIdentitiesActivity", ike);
Toast.makeText(this, R.string.unable_to_view_corrupted_identity_key_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.ReviewIdentitiesActivity_unable_to_view_corrupted_identity_key_exclamation,
Toast.LENGTH_LONG).show();
} catch (IOException e) {
Log.w("ReviewIdentitiesActivity", e);
Toast.makeText(this, R.string.unable_to_view_corrupted_identity_key_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.ReviewIdentitiesActivity_unable_to_view_corrupted_identity_key_exclamation,
Toast.LENGTH_LONG).show();
}
}

View File

@@ -86,7 +86,7 @@ public class SaveIdentityActivity extends SherlockActivity {
public void onClick(View v) {
if (identityName.getText() == null || identityName.getText().toString().trim().length() == 0) {
Toast.makeText(SaveIdentityActivity.this,
R.string.you_must_specify_a_name_for_this_identity_exclamation,
R.string.SaveIdentityActivity_you_must_specify_a_name_for_this_identity_exclamation,
Toast.LENGTH_LONG).show();
return;
}
@@ -95,16 +95,17 @@ public class SaveIdentityActivity extends SherlockActivity {
DatabaseFactory.getIdentityDatabase(SaveIdentityActivity.this).saveIdentity(masterSecret, identityKey, identityName.getText().toString());
} catch (InvalidKeyException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(SaveIdentityActivity.this);
builder.setTitle(R.string.identity_name_exists_exclamation);
builder.setMessage(R.string.an_identity_key_with_the_specified_name_already_exists);
builder.setPositiveButton(R.string.manage_identities, new DialogInterface.OnClickListener() {
builder.setTitle(R.string.SaveIdentityActivity_identity_name_exists_exclamation);
builder.setMessage(R.string.SaveIdentityActivity_an_identity_key_with_the_specified_name_already_exists);
builder.setPositiveButton(R.string.SaveIdentityActivity_manage_identities,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(SaveIdentityActivity.this, ReviewIdentitiesActivity.class);
intent.putExtra("master_secret", masterSecret);
startActivity(intent);
}
});
builder.setNegativeButton(R.string.cancel, null);
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
return;
}

View File

@@ -62,10 +62,11 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
protected void handleVerified() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setTitle(R.string.mark_identity_verified_question);
builder.setMessage(R.string.are_you_sure_you_have_validated_the_recipients_identity_fingerprint_and_would_like_to_mark_it_as_verified);
builder.setTitle(R.string.VerifyIdentityActivity_mark_identity_verified_question);
builder.setMessage(R.string.VerifyIdentityActivity_are_you_sure_you_have_validated_the_recipients_identity_fingerprint_and_would_like_to_mark_it_as_verified);
builder.setPositiveButton(R.string.mark_verified, new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.VerifyIdentityActivity_mark_verified,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SessionRecord sessionRecord = new SessionRecord(VerifyIdentityActivity.this,
@@ -91,7 +92,7 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
private void initializeLocalIdentityKey() {
if (!IdentityKeyUtil.hasIdentityKey(this)) {
localIdentityFingerprint.setText(R.string.you_do_not_have_an_identity_key);
localIdentityFingerprint.setText(R.string.VerifyIdentityActivity_you_do_not_have_an_identity_key);
return;
}
@@ -103,7 +104,7 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
IdentityKey identityKey = sessionRecord.getIdentityKey();
if (identityKey == null) {
remoteIdentityFingerprint.setText(R.string.recipient_has_no_identity_key);
remoteIdentityFingerprint.setText(R.string.VerifyIdentityActivity_recipient_has_no_identity_key);
} else {
remoteIdentityFingerprint.setText(identityKey.getFingerprint());
}
@@ -124,7 +125,9 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
@Override
protected void initiateDisplay() {
if (!IdentityKeyUtil.hasIdentityKey(this)) {
Toast.makeText(this, R.string.you_don_t_have_an_identity_key_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(this,
R.string.VerifyIdentityActivity_you_don_t_have_an_identity_key_exclamation,
Toast.LENGTH_LONG).show();
return;
}
@@ -137,7 +140,8 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
IdentityKey identityKey = sessionRecord.getIdentityKey();
if (identityKey == null) {
Toast.makeText(this, R.string.recipient_has_no_identity_key_exclamation, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.VerifyIdentityActivity_recipient_has_no_identity_key_exclamation,
Toast.LENGTH_LONG).show();
} else {
super.initiateScan();
}
@@ -145,12 +149,12 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
@Override
protected String getScanString() {
return getString(R.string.scan_their_key_to_compare);
return getString(R.string.VerifyIdentityActivity_scan_their_key_to_compare);
}
@Override
protected String getDisplayString() {
return getString(R.string.get_my_key_scanned);
return getString(R.string.VerifyIdentityActivity_get_my_key_scanned);
}
@Override
@@ -166,21 +170,21 @@ public class VerifyIdentityActivity extends KeyVerifyingActivity {
@Override
protected String getNotVerifiedMessage() {
return getString(R.string.warning_the_scanned_key_does_not_match_please_check_the_fingerprint_text_carefully);
return getString(R.string.VerifyIdentityActivity_warning_the_scanned_key_does_not_match_please_check_the_fingerprint_text_carefully);
}
@Override
protected String getNotVerifiedTitle() {
return getString(R.string.not_verified_exclamation);
return getString(R.string.VerifyIdentityActivity_not_verified_exclamation);
}
@Override
protected String getVerifiedMessage() {
return getString(R.string.their_key_is_correct_it_is_also_necessary_to_verify_your_key_with_them_as_well);
return getString(R.string.VerifyIdentityActivity_their_key_is_correct_it_is_also_necessary_to_verify_your_key_with_them_as_well);
}
@Override
protected String getVerifiedTitle() {
return getString(R.string.verified_exclamation);
return getString(R.string.VerifyIdentityActivity_verified_exclamation);
}
}

View File

@@ -107,15 +107,15 @@ public class VerifyImportedIdentityActivity extends KeyScanningActivity {
public void onClick(View v) {
if (identityName.getText() == null || identityName.getText().length() == 0) {
Toast.makeText(VerifyImportedIdentityActivity.this,
R.string.you_must_specify_a_name_for_this_contact_exclamation,
R.string.VerifyImportedIdentityActivity_you_must_specify_a_name_for_this_contact_exclamation,
Toast.LENGTH_LONG);
return;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(VerifyImportedIdentityActivity.this);
dialogBuilder.setTitle(R.string.save_identity_key_question);
dialogBuilder.setTitle(R.string.VerifyImportedIdentityActivity_save_identity_key_question);
dialogBuilder.setIcon(android.R.drawable.ic_dialog_info);
dialogBuilder.setMessage(String.format(getString(R.string.are_you_sure_that_you_would_like_to_mark_this_as_a_valid_identity_key_for_all_future_correspondence_with_s), identityName.getText()));
dialogBuilder.setMessage(String.format(getString(R.string.VerifyImportedIdentityActivity_are_you_sure_that_you_would_like_to_mark_this_as_a_valid_identity_key_for_all_future_correspondence_with_s), identityName.getText()));
dialogBuilder.setCancelable(true);
dialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
@@ -124,8 +124,8 @@ public class VerifyImportedIdentityActivity extends KeyScanningActivity {
} catch (InvalidKeyException ike) {
Log.w("VerifiedButtonListener", ike);
Dialogs.displayAlert(VerifyImportedIdentityActivity.this,
getString(R.string.error_saving_identity_key_exclamation),
getString(R.string.this_identity_key_or_an_identity_key_with_the_same_name_already_exists_please_edit_your_key_database),
getString(R.string.VerifyImportedIdentityActivity_error_saving_identity_key_exclamation),
getString(R.string.VerifyImportedIdentityActivity_this_identity_key_or_an_identity_key_with_the_same_name_already_exists_please_edit_your_key_database),
android.R.drawable.ic_dialog_alert);
return;
}
@@ -140,12 +140,12 @@ public class VerifyImportedIdentityActivity extends KeyScanningActivity {
@Override
protected String getScanString() {
return getString(R.string.scan_to_compare);
return getString(R.string.VerifyImportedIdentityActivity_scan_to_compare);
}
@Override
protected String getDisplayString() {
return getString(R.string.get_scanned_to_compare);
return getString(R.string.VerifyImportedIdentityActivity_get_scanned_to_compare);
}
@Override
@@ -160,21 +160,21 @@ public class VerifyImportedIdentityActivity extends KeyScanningActivity {
@Override
protected String getNotVerifiedMessage() {
return getString(R.string.warning_the_scanned_key_does_not_match_exclamation);
return getString(R.string.VerifyImportedIdentityActivity_warning_the_scanned_key_does_not_match_exclamation);
}
@Override
protected String getNotVerifiedTitle() {
return getString(R.string.not_verified_exclamation2);
return getString(R.string.VerifyImportedIdentityActivity_not_verified_exclamation);
}
@Override
protected String getVerifiedMessage() {
return getString(R.string.the_scanned_key_matches_exclamation);
return getString(R.string.VerifyImportedIdentityActivity_the_scanned_key_matches_exclamation);
}
@Override
protected String getVerifiedTitle() {
return getString(R.string.verified_exclamation2);
return getString(R.string.VerifyImportedIdentityActivity_verified_exclamation);
}
}

View File

@@ -64,9 +64,10 @@ public class VerifyKeysActivity extends KeyVerifyingActivity {
protected void handleVerified() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setTitle(R.string.mark_session_verified_question);
builder.setMessage(R.string.are_you_sure_that_you_have_validated_these_fingerprints_and_would_like_to_mark_this_session_as_verified);
builder.setPositiveButton(R.string.mark_verified2, new DialogInterface.OnClickListener() {
builder.setTitle(R.string.VerifyKeysActivity_mark_session_verified_question);
builder.setMessage(R.string.VerifyKeysActivity_are_you_sure_that_you_have_validated_these_fingerprints_and_would_like_to_mark_this_session_as_verified);
builder.setPositiveButton(R.string.VerifyKeysActivity_mark_verified,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SessionRecord sessionRecord = new SessionRecord(VerifyKeysActivity.this, masterSecret,
@@ -77,7 +78,7 @@ public class VerifyKeysActivity extends KeyVerifyingActivity {
}
});
builder.setNegativeButton(R.string.cancel, null);
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
}
@@ -99,12 +100,12 @@ public class VerifyKeysActivity extends KeyVerifyingActivity {
@Override
protected String getDisplayString() {
return getString(R.string.get_my_fingerprint_scanned);
return getString(R.string.VerifyKeysActivity_get_my_fingerprint_scanned);
}
@Override
protected String getScanString() {
return getString(R.string.scan_their_fingerprint);
return getString(R.string.VerifyKeysActivity_scan_their_fingerprint);
}
@Override
@@ -119,22 +120,22 @@ public class VerifyKeysActivity extends KeyVerifyingActivity {
@Override
protected String getNotVerifiedMessage() {
return getString(R.string.warning_the_scanned_key_does_not_match_please_check_the_fingerprint_text_carefully2);
return getString(R.string.VerifyKeysActivity_warning_the_scanned_key_does_not_match_please_check_the_fingerprint_text_carefully2);
}
@Override
protected String getNotVerifiedTitle() {
return getString(R.string.not_verified_exclamation3);
return getString(R.string.VerifyKeysActivity_not_verified_exclamation);
}
@Override
protected String getVerifiedMessage() {
return getString(R.string.their_key_is_correct_it_is_also_necessary_to_get_your_fingerprint_scanned_as_well);
return getString(R.string.VerifyKeysActivity_their_key_is_correct_it_is_also_necessary_to_get_your_fingerprint_scanned_as_well);
}
@Override
protected String getVerifiedTitle() {
return getString(R.string.verified_exclamation3);
return getString(R.string.VerifyKeysActivity_verified_exclamation);
}
private class FingerprintKey implements SerializableKey {

View File

@@ -47,7 +47,7 @@ public class ViewIdentityActivity extends KeyScanningActivity {
private void initializeFingerprint() {
if (identityKey == null) {
identityFingerprint.setText(R.string.you_do_not_have_an_identity_key2);
identityFingerprint.setText(R.string.ViewIdentityActivity_you_do_not_have_an_identity_key);
} else {
identityFingerprint.setText(identityKey.getFingerprint());
}
@@ -79,12 +79,12 @@ public class ViewIdentityActivity extends KeyScanningActivity {
@Override
protected String getScanString() {
return getString(R.string.scan_to_compare2);
return getString(R.string.ViewIdentityActivity_scan_to_compare);
}
@Override
protected String getDisplayString() {
return getString(R.string.get_scanned_to_compare2);
return getString(R.string.ViewIdentityActivity_get_scanned_to_compare);
}
@Override
@@ -99,21 +99,21 @@ public class ViewIdentityActivity extends KeyScanningActivity {
@Override
protected String getNotVerifiedMessage() {
return getString(R.string.warning_the_scanned_key_does_not_match_exclamation2);
return getString(R.string.ViewIdentityActivity_warning_the_scanned_key_does_not_match_exclamation);
}
@Override
protected String getNotVerifiedTitle() {
return getString(R.string.not_verified_exclamation4);
return getString(R.string.ViewIdentityActivity_not_verified_exclamation);
}
@Override
protected String getVerifiedMessage() {
return getString(R.string.the_scanned_key_matches_exclamation2);
return getString(R.string.ViewIdentityActivity_the_scanned_key_matches_exclamation);
}
@Override
protected String getVerifiedTitle() {
return getString(R.string.verified_exclamation4);
return getString(R.string.ViewIdentityActivity_verified_exclamation);
}
}

View File

@@ -1,6 +1,6 @@
/**
/**
* Copyright (C) 2011 Whisper Systems
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -10,13 +10,16 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.crypto;
import java.util.LinkedList;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.database.LocalKeyRecord;
@@ -24,45 +27,42 @@ import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.sms.MessageSender;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import java.util.LinkedList;
public class KeyExchangeInitiator {
public static void initiate(final Context context, final MasterSecret masterSecret, final Recipient recipient, boolean promptOnExisting) {
if (promptOnExisting && hasInitiatedSession(context, masterSecret, recipient)) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(R.string.initiate_despite_existing_request_question);
dialog.setMessage(R.string.youve_already_sent_a_session_initiation_request_to_this_recipient_are_you_sure);
dialog.setTitle(R.string.KeyExchangeInitiator_initiate_despite_existing_request_question);
dialog.setMessage(R.string.KeyExchangeInitiator_youve_already_sent_a_session_initiation_request_to_this_recipient_are_you_sure);
dialog.setIcon(android.R.drawable.ic_dialog_alert);
dialog.setCancelable(true);
dialog.setPositiveButton(R.string.send, new DialogInterface.OnClickListener() {
dialog.setPositiveButton(R.string.KeyExchangeInitiator_send, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
initiateKeyExchange(context, masterSecret, recipient);
}
});
dialog.setNegativeButton(R.string.cancel, null);
dialog.setNegativeButton(android.R.string.cancel, null);
dialog.show();
} else {
initiateKeyExchange(context, masterSecret, recipient);
}
}
private static void initiateKeyExchange(Context context, MasterSecret masterSecret, Recipient recipient) {
LocalKeyRecord record = KeyUtil.initializeRecordFor(recipient, context, masterSecret);
KeyExchangeMessage message = new KeyExchangeMessage(context, masterSecret, 1, record, 0);
Log.w("SendKeyActivity", "Sending public key: " + record.getCurrentKeyPair().getPublicKey().getFingerprint());
LinkedList<Recipient> list = new LinkedList<Recipient>();
list.add(recipient);
MessageSender.send(context, masterSecret, new Recipients(list), -1, message.serialize(), false);
}
private static boolean hasInitiatedSession(Context context, MasterSecret masterSecret, Recipient recipient) {
return
return
LocalKeyRecord.hasRecord(context, recipient) &&
new LocalKeyRecord(context, masterSecret, recipient).getCurrentKeyPair() != null;
}

View File

@@ -92,13 +92,13 @@ public class MessageDisplayHelper {
}
if (isUnreadableAsymmetricMessage(message.getType())) {
message.setBody(context.getString(R.string.bad_encrypted_message));
message.setBody(context.getString(R.string.MessageDisplayHelper_bad_encrypted_message));
message.setEmphasis(true);
} else if (isInProcessAsymmetricMessage(body, message.getType())) {
message.setBody(context.getString(R.string.decrypting_please_wait));
message.setBody(context.getString(R.string.MessageDisplayHelper_decrypting_please_wait));
message.setEmphasis(true);
} else if (isRogueAsymmetricMessage(message.getType())) {
message.setBody(context.getString(R.string.message_encrypted_for_non_existing_session));
message.setBody(context.getString(R.string.MessageDisplayHelper_message_encrypted_for_non_existing_session));
message.setEmphasis(true);
} else if (isKeyExchange(body)) {
message.setKeyExchange(true);
@@ -117,7 +117,7 @@ public class MessageDisplayHelper {
message.setEmphasis(false);
}
} catch (InvalidMessageException ime) {
message.setBody(context.getString(R.string.decryption_error_local_message_corrupted_mac_doesn_t_match_potential_tampering_question));
message.setBody(context.getString(R.string.MessageDisplayHelper_decryption_error_local_message_corrupted_mac_doesn_t_match_potential_tampering_question));
message.setEmphasis(true);
}
}

View File

@@ -150,7 +150,7 @@ public class MmsDatabase extends Database {
if (encodedFrom != null)
return new String(encodedFrom.getTextString(), CharacterSets.MIMENAME_ISO_8859_1);
else
return context.getString(R.string.anonymous);
return context.getString(R.string.MmsDatabase_anonymous);
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e);
}
@@ -563,12 +563,12 @@ public class MmsDatabase extends Database {
Log.w("MmsDatabase", "Getting label for status: " + status);
switch (status) {
case DOWNLOAD_CONNECTING: return context.getString(R.string.connecting_to_mms_server);
case DOWNLOAD_INITIALIZED: return context.getString(R.string.downloading_mms);
case DOWNLOAD_HARD_FAILURE: return context.getString(R.string.mms_download_failed);
case DOWNLOAD_CONNECTING: return context.getString(R.string.MmsDatabase_connecting_to_mms_server);
case DOWNLOAD_INITIALIZED: return context.getString(R.string.MmsDatabase_downloading_mms);
case DOWNLOAD_HARD_FAILURE: return context.getString(R.string.MmsDatabase_mms_download_failed);
}
return context.getString(R.string.downloading);
return context.getString(R.string.MmsDatabase_downloading);
}
public static boolean isHardError(int status) {

View File

@@ -126,16 +126,16 @@ public class MmsMessageRecord extends MessageRecord {
private void setBodyIfTextAvailable(Context context) {
switch ((int)mailbox) {
case MmsDatabase.Types.MESSAGE_BOX_DECRYPTING_INBOX:
setBody(context.getString(R.string.decrypting_mms_please_wait));
setBody(context.getString(R.string.MmsMessageRecord_decrypting_mms_please_wait));
setEmphasis(true);
return;
case MmsDatabase.Types.MESSAGE_BOX_DECRYPT_FAILED_INBOX:
setBody(context.getString(R.string.bad_encrypted_mms_message));
setBody(context.getString(R.string.MmsMessageRecord_bad_encrypted_mms_message));
setEmphasis(true);
return;
case MmsDatabase.Types.MESSAGE_BOX_NO_SESSION_INBOX:
setBody(context
.getString(R.string.mms_message_encrypted_for_non_existing_session));
.getString(R.string.MmsMessageRecord_mms_message_encrypted_for_non_existing_session));
setEmphasis(true);
return;
}

View File

@@ -80,7 +80,8 @@ public class ApplicationMigrationService extends Service
private Notification initializeBackgroundNotification() {
Intent intent = new Intent(this, ConversationListActivity.class);
Notification notification = new Notification(R.drawable.icon, getString(R.string.migrating),
Notification notification = new Notification(R.drawable.icon,
getString(R.string.ApplicationMigrationService_migrating),
System.currentTimeMillis());
notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
@@ -89,7 +90,8 @@ public class ApplicationMigrationService extends Service
notification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
notification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon);
notification.contentView.setTextViewText(R.id.status_text, getString(R.string.migrating_system_text_messages));
notification.contentView.setTextViewText(R.id.status_text,
getString(R.string.ApplicationMigrationService_migrating_system_text_messages));
notification.contentView.setProgressBar(R.id.status_progress, 10000, 0, false);
stopForeground(true);

View File

@@ -160,12 +160,14 @@ public class KeyCachingService extends Service {
private void foregroundServiceLegacy() {
Notification notification = new Notification(R.drawable.icon_cached,
getString(R.string.textsecure_passphrase_cached),
getString(R.string.KeyCachingService_textsecure_passphrase_cached),
System.currentTimeMillis());
Intent intent = new Intent(this, ConversationListActivity.class);
PendingIntent launchIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
notification.setLatestEventInfo(getApplicationContext(), getString(R.string.passphrase_cached),
getString(R.string.textsecure_passphrase_cached), launchIntent);
notification.setLatestEventInfo(getApplicationContext(),
getString(R.string.KeyCachingService_passphrase_cached),
getString(R.string.KeyCachingService_textsecure_passphrase_cached),
launchIntent);
stopForeground(true);
startForeground(SERVICE_RUNNING_ID, notification);

View File

@@ -70,22 +70,22 @@ public class MessageNotifier {
Recipient recipient = recipients.getPrimaryRecipient();
if (recipient == null) {
return String.format(context.getString(R.string._d_new_messages), count);
return String.format(context.getString(R.string.MessageNotifier_d_new_messages), count);
} else {
return String.format(context.getString(R.string._d_new_messages_most_recent_from_s), count,
return String.format(context.getString(R.string.MessageNotifier_d_new_messages_most_recent_from_s), count,
recipient.getName() == null ? recipient.getNumber() : recipient.getName());
}
}
private static String buildTitleMessage(Context context, int count) {
return String.format(context.getString(R.string._d_new_messages), count);
return String.format(context.getString(R.string.MessageNotifier_d_new_messages), count);
}
private static String buildSubtitleMessage(Context context, Recipients recipients) {
Recipient recipient = recipients.getPrimaryRecipient();
if (recipient != null) {
return String.format(context.getString(R.string.most_recent_from_s),
return String.format(context.getString(R.string.MessageNotifier_most_recent_from_s),
(recipient.getName() == null ? recipient.getNumber() : recipient.getName()));
}