a lot of renaming of IDs, following a strict naming scheme again, moved most strings into string.xml in preparation for internationalization, APG.java still has to be changed to allow that, as it isn't Context aware in most methods

This commit is contained in:
Thialfihar 2010-05-13 20:41:32 +00:00
parent 5f6a098914
commit b527ae8b6d
34 changed files with 493 additions and 408 deletions

View File

@ -25,7 +25,7 @@
android:layout_height="?android:attr/listPreferredItemHeight">
<TextView
android:id="@+id/account_name"
android:id="@+id/accountName"
android:text="someone@gmail.com"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="fill_parent"

View File

@ -39,13 +39,13 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/source_previous"
android:id="@+id/sourcePrevious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_previous"/>
<TextView
android:id="@+id/source_label"
android:id="@+id/sourceLabel"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
@ -55,7 +55,7 @@
android:textColor="#ffffffff"/>
<ImageView
android:id="@+id/source_next"
android:id="@+id/sourceNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_next"/>
@ -69,7 +69,7 @@
android:layout_weight="1">
<LinearLayout
android:id="@+id/source_message"
android:id="@+id/sourceMessage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
@ -84,7 +84,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/source_file"
android:id="@+id/sourceFile"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
@ -114,8 +114,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_delete_after_decryption"
android:text="@string/label_delete_after_decryption"
android:id="@+id/label_deleteAfterDecryption"
android:text="@string/label_deleteAfterDecryption"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_vertical"
android:paddingRight="10dip"
@ -124,7 +124,7 @@
android:layout_weight="1"/>
<CheckBox
android:id="@+id/delete_after_decryption"
android:id="@+id/deleteAfterDecryption"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"/>
@ -140,7 +140,7 @@
</ScrollView>
<LinearLayout
android:id="@+id/layout_signature"
android:id="@+id/signature"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
@ -170,7 +170,7 @@
android:paddingLeft="5dip">
<TextView
android:id="@+id/main_user_id"
android:id="@+id/mainUserId"
android:text="Main User Id"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
@ -178,7 +178,7 @@
android:layout_gravity="left"/>
<TextView
android:id="@+id/main_user_id_rest"
android:id="@+id/mainUserIdRest"
android:text="Main User Id Rest"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"

View File

@ -42,7 +42,7 @@
<TableRow>
<TextView
android:id="@+id/label_key_id"
android:id="@+id/label_keyId"
android:text="Key ID"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@ -50,7 +50,7 @@
android:paddingRight="10dip"/>
<TextView
android:id="@+id/key_id"
android:id="@+id/keyId"
android:text="00000000 00000000"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@ -132,7 +132,7 @@
</TableLayout>
<ImageButton
android:id="@+id/edit_delete"
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MinusButton"

View File

@ -28,7 +28,7 @@
android:background="?android:attr/listDivider"/>
<RadioButton
android:id="@+id/is_main_user_id"
android:id="@+id/isMainUserId"
android:text="Main User ID"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@ -48,7 +48,7 @@
<TableRow>
<TextView
android:id="@+id/name_label"
android:id="@+id/label_name"
android:text="Name"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
@ -66,7 +66,7 @@
<TableRow>
<TextView
android:id="@+id/email_label"
android:id="@+id/label_email"
android:text="Email"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
@ -84,7 +84,7 @@
<TableRow>
<TextView
android:id="@+id/comment_label"
android:id="@+id/label_comment"
android:text="Comment"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
@ -102,7 +102,7 @@
</TableLayout>
<ImageButton
android:id="@+id/edit_delete"
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MinusButton"

View File

@ -39,13 +39,13 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/source_previous"
android:id="@+id/sourcePrevious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_previous"/>
<TextView
android:id="@+id/source_label"
android:id="@+id/sourceLabel"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
@ -55,7 +55,7 @@
android:textColor="#ffffffff"/>
<ImageView
android:id="@+id/source_next"
android:id="@+id/sourceNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_next"/>
@ -69,7 +69,7 @@
android:layout_weight="1">
<LinearLayout
android:id="@+id/source_message"
android:id="@+id/sourceMessage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
@ -84,7 +84,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/source_file"
android:id="@+id/sourceFile"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
@ -114,8 +114,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_delete_after_encryption"
android:text="@string/label_delete_after_encryption"
android:id="@+id/label_deleteAfterEncryption"
android:text="@string/label_deleteAfterEncryption"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_vertical"
android:paddingRight="10dip"
@ -124,7 +124,7 @@
android:layout_weight="1"/>
<CheckBox
android:id="@+id/delete_after_encryption"
android:id="@+id/deleteAfterEncryption"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"/>
@ -137,8 +137,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_ascii_armour"
android:text="@string/label_ascii_armour"
android:id="@+id/label_asciiArmour"
android:text="@string/label_asciiArmour"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_vertical"
android:paddingRight="10dip"
@ -147,7 +147,7 @@
android:layout_weight="1"/>
<CheckBox
android:id="@+id/ascii_armour"
android:id="@+id/asciiArmour"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"/>
@ -170,13 +170,13 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/mode_previous"
android:id="@+id/modePrevious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_previous"/>
<TextView
android:id="@+id/mode_label"
android:id="@+id/modeLabel"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
@ -186,7 +186,7 @@
android:textColor="#ffffffff"/>
<ImageView
android:id="@+id/mode_next"
android:id="@+id/modeNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_next"/>
@ -199,7 +199,7 @@
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/mode_asymmetric"
android:id="@+id/modeAsymmetric"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -226,7 +226,7 @@
android:paddingRight="5dip">
<TextView
android:id="@+id/main_user_id"
android:id="@+id/mainUserId"
android:text="Main User Id"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
@ -234,7 +234,7 @@
android:layout_gravity="right"/>
<TextView
android:id="@+id/main_user_id_rest"
android:id="@+id/mainUserIdRest"
android:text="Main User Id Rest"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
@ -258,8 +258,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_select_public_keys"
android:text="@string/label_select_public_keys"
android:id="@+id/label_selectPublicKeys"
android:text="@string/label_selectPublicKeys"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="wrap_content"
android:layout_width="0dip"
@ -277,7 +277,7 @@
</LinearLayout>
<TableLayout
android:id="@+id/mode_symmetric"
android:id="@+id/modeSymmetric"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:stretchColumns="1">
@ -285,8 +285,8 @@
<TableRow>
<TextView
android:id="@+id/label_pass_phrase"
android:text="@string/label_pass_phrase"
android:id="@+id/label_passPhrase"
android:text="@string/label_passPhrase"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@ -294,7 +294,7 @@
android:paddingRight="10dip"/>
<EditText
android:id="@+id/pass_phrase"
android:id="@+id/passPhrase"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:inputType="textPassword"/>
@ -304,8 +304,8 @@
<TableRow>
<TextView
android:id="@+id/label_pass_phrase_again"
android:text="@string/label_pass_phrase_again"
android:id="@+id/label_passPhraseAgain"
android:text="@string/label_passPhraseAgain"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@ -313,7 +313,7 @@
android:paddingRight="10dip"/>
<EditText
android:id="@+id/pass_phrase_again"
android:id="@+id/passPhraseAgain"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:inputType="textPassword"/>
@ -341,8 +341,8 @@
style="@android:style/ButtonBar">
<Button
android:id="@+id/btn_encrypt_to_clipboard"
android:text="@string/btn_encrypt_to_clipboard"
android:id="@+id/btn_encryptToClipboard"
android:text="@string/btn_encryptToClipboard"
android:layout_weight="1"
android:layout_width="0dip"
android:layout_height="wrap_content"/>

View File

@ -29,7 +29,7 @@
android:paddingRight="3dip">
<ImageView
android:id="@+id/ic_master_key"
android:id="@+id/ic_masterKey"
android:src="@drawable/key_small"
android:paddingRight="6dip"
android:layout_width="wrap_content"
@ -37,7 +37,7 @@
android:layout_gravity="center_vertical"/>
<TextView
android:id="@+id/key_id"
android:id="@+id/keyId"
android:text="Key ID"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
@ -46,7 +46,7 @@
android:typeface="monospace"/>
<TextView
android:id="@+id/key_details"
android:id="@+id/keyDetails"
android:text="(RSA, 1024bit)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
@ -62,13 +62,13 @@
android:layout_gravity="center_vertical">
<ImageView
android:id="@+id/ic_encrypt_key"
android:id="@+id/ic_encryptKey"
android:src="@drawable/encrypted_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/ic_sign_key"
android:id="@+id/ic_signKey"
android:src="@drawable/signed_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

View File

@ -29,7 +29,7 @@
android:paddingRight="3dip">
<TextView
android:id="@+id/key_id"
android:id="@+id/keyId"
android:text="Key ID"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
@ -38,7 +38,7 @@
android:typeface="monospace"/>
<TextView
android:id="@+id/key_details"
android:id="@+id/keyDetails"
android:text="(RSA, 1024bit)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
@ -54,13 +54,13 @@
android:layout_gravity="center_vertical">
<ImageView
android:id="@+id/ic_encrypt_key"
android:id="@+id/ic_encryptKey"
android:src="@drawable/encrypted_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/ic_sign_key"
android:id="@+id/ic_signKey"
android:src="@drawable/signed_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

View File

@ -23,7 +23,7 @@
android:layout_height="?android:attr/listPreferredItemHeight">
<TextView
android:id="@+id/user_id"
android:id="@+id/userId"
android:text="User ID"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"

View File

@ -28,14 +28,14 @@
android:paddingLeft="36dip">
<TextView
android:id="@+id/main_user_id"
android:id="@+id/mainUserId"
android:text="Main User ID"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/main_user_id_rest"
android:id="@+id/mainUserIdRest"
android:text="&lt;user@somewhere.com&gt;"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"

View File

@ -46,7 +46,7 @@
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/email_address"
android:id="@+id/emailAddress"
android:text="user@somewhere.com"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"

View File

@ -30,7 +30,7 @@
android:fillViewport="true">
<ListView
android:id="@+id/account_list"
android:id="@+id/accounts"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>

View File

@ -8,13 +8,13 @@
android:paddingRight="5dip">
<EditText
android:id="@+id/pass_phrase"
android:id="@+id/passPhrase"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"/>
<EditText
android:id="@+id/pass_phrase_again"
android:id="@+id/passPhraseAgain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"/>

View File

@ -46,8 +46,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_encryption_algorithm"
android:text="@string/label_encryption_algorithm"
android:id="@+id/label_encryptionAlgorithm"
android:text="@string/label_encryptionAlgorithm"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="wrap_content"
android:layout_width="0dip"
@ -56,7 +56,7 @@
android:paddingRight="10dip"/>
<Spinner
android:id="@+id/encryption_algorithm"
android:id="@+id/encryptionAlgorithm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
@ -69,8 +69,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_hash_algorithm"
android:text="@string/label_hash_algorithm"
android:id="@+id/label_hashAlgorithm"
android:text="@string/label_hashAlgorithm"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="wrap_content"
android:layout_width="0dip"
@ -79,7 +79,7 @@
android:paddingRight="10dip"/>
<Spinner
android:id="@+id/hash_algorithm"
android:id="@+id/hashAlgorithm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
@ -92,8 +92,8 @@
android:orientation="horizontal">
<TextView
android:id="@+id/label_ascii_armour"
android:text="@string/label_ascii_armour"
android:id="@+id/label_asciiArmour"
android:text="@string/label_asciiArmour"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_vertical"
android:paddingRight="10dip"
@ -102,7 +102,7 @@
android:layout_weight="1"/>
<CheckBox
android:id="@+id/ascii_armour"
android:id="@+id/asciiArmour"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"/>

View File

@ -38,14 +38,14 @@
android:layout_weight="1">
<TextView
android:id="@+id/main_user_id"
android:id="@+id/mainUserId"
android:text="Main User ID"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/main_user_id_rest"
android:id="@+id/mainUserIdRest"
android:text="&lt;user@somewhere.com&gt;"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
@ -54,7 +54,6 @@
</LinearLayout>
<LinearLayout
android:id="@+id/right_column"
android:orientation="vertical"
android:minWidth="90dip"
android:paddingLeft="3dip"
@ -63,7 +62,7 @@
android:layout_height="wrap_content">
<TextView
android:id="@+id/key_id"
android:id="@+id/keyId"
android:text="BBBBBBBB"
android:textAppearance="?android:attr/textAppearanceSmall"
android:typeface="monospace"

View File

@ -31,14 +31,14 @@
android:layout_weight="1">
<TextView
android:id="@+id/main_user_id"
android:id="@+id/mainUserId"
android:text="Main User ID"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/main_user_id_rest"
android:id="@+id/mainUserIdRest"
android:text="&lt;user@somewhere.com&gt;"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
@ -55,7 +55,7 @@
android:layout_height="wrap_content">
<TextView
android:id="@+id/key_id"
android:id="@+id/keyId"
android:text="BBBBBBBB"
android:textAppearance="?android:attr/textAppearanceSmall"
android:typeface="monospace"

View File

@ -16,6 +16,8 @@
<resources>
<string name="app_name">APG</string>
<!-- title_lowerCase: capitalized words, no punctuation -->
<string name="title_mailInbox">Mail Inbox</string>
<string name="title_managePublicKeys">Manage Public Keys</string>
<string name="title_manageSecretKeys">Manage Secret Keys</string>
@ -27,11 +29,23 @@
<string name="title_createKey">Create Key</string>
<string name="title_editKey">Edit Key</string>
<string name="title_preferences">Preferences</string>
<string name="title_changePassPhrase">Change Pass Phrase</string>
<string name="title_setPassPhrase">Set Pass Phrase</string>
<string name="title_sendEmail">"Send Mail..."</string>
<string name="title_encryptToFile">Encrypt To File</string>
<string name="title_decryptToFile">Decrypt To File</string>
<string name="title_addAccount">Add Account</string>
<string name="title_importKeys">Import Keys</string>
<string name="title_exportKey">Export Key</string>
<string name="title_exportKeys">Export Keys</string>
<!-- section_lowerCase: capitalized words, no punctuation -->
<string name="section_userIds">User IDs</string>
<string name="section_keys">Keys</string>
<string name="section_defaults">Defaults</string>
<string name="btn_encrypt_to_clipboard">Encrypt To Clipboard</string>
<!-- btn_lowerCase: capitalized words, no punctuation -->
<string name="btn_encryptToClipboard">Encrypt To Clipboard</string>
<string name="btn_send">Encrypt And Email</string>
<string name="btn_encrypt">Encrypt</string>
<string name="btn_decrypt">Decrypt</string>
@ -44,55 +58,128 @@
<string name="btn_decryptFile">Decrypt File</string>
<string name="btn_save">Save</string>
<string name="btn_doNotSave">Cancel</string>
<string name="btn_delete">Delete</string>
<string name="btn_noDate">None</string>
<!-- menu_lowerCase: capitalized words, no punctuation -->
<string name="menu_about">About</string>
<string name="menu_addAccount">Add GMail Account</string>
<string name="menu_deleteAccount">Delete Account</string>
<string name="menu_managePublicKeys">Manage Public Keys</string>
<string name="menu_manageSecretKeys">Manage Secret Keys</string>
<string name="menu_preferences">Settings</string>
<string name="menu_changePassPhrase">Change Pass Phrase</string>
<string name="menu_setPassPhrase">Set Pass Phrase</string>
<string name="menu_importKeys">Import Keys</string>
<string name="menu_exportKeys">Export Keys</string>
<string name="menu_exportKey">Export Key</string>
<string name="menu_deleteKey">Delete Key</string>
<string name="menu_createKey">Create Key</string>
<string name="menu_editKey">Edit Key</string>
<string name="no_keys_selected">Select</string>
<string name="one_key_selected">1 Selected</string>
<string name="n_keys_selected">Selected</string>
<string name="unknown_user_id">&lt;unknown&gt;</string>
<string name="none">&lt;none&gt;</string>
<!-- label_lowerCase: capitalized words, no punctuation -->
<string name="label_sign">Sign</string>
<string name="label_message">Message</string>
<string name="label_file">File</string>
<string name="label_pass_phrase">Pass Phrase</string>
<string name="label_pass_phrase_again">Again</string>
<string name="label_passPhrase">Pass Phrase</string>
<string name="label_passPhraseAgain">Again</string>
<string name="label_algorithm">Algorithm</string>
<string name="label_ascii_armour">ASCII Armour</string>
<string name="label_select_public_keys">Public Key(s)</string>
<string name="label_delete_after_encryption">Delete After Encryption</string>
<string name="label_delete_after_decryption">Delete After Decryption</string>
<string name="label_encryption_algorithm">Encryption Algorithm</string>
<string name="label_hash_algorithm">Hash Algorithm</string>
<string name="label_asciiArmour">ASCII Armour</string>
<string name="label_selectPublicKeys">Public Key(s)</string>
<string name="label_deleteAfterEncryption">Delete After Encryption</string>
<string name="label_deleteAfterDecryption">Delete After Decryption</string>
<string name="label_encryptionAlgorithm">Encryption Algorithm</string>
<string name="label_hashAlgorithm">Hash Algorithm</string>
<string name="label_asymmetric">Public Key</string>
<string name="label_symmetric">Pass Phrase</string>
<string name="section_defaults">Defaults</string>
<string name="noKeysSelected">Select</string>
<string name="oneKeySelected">1 Selected</string>
<string name="nKeysSelected">Selected</string>
<string name="unknownUserId">&lt;unknown&gt;</string>
<string name="none">&lt;none&gt;</string>
<string name="noKey">&lt;no key&gt;</string>
<string name="noDate">-</string>
<string name="noExpiry">&lt;no expiry&gt;</string>
<string name="unknownStatus"></string>
<string name="canEncrypt">can encrypt</string>
<string name="canSign">can sign</string>
<string name="expired">expired</string>
<string name="notValid">not valid</string>
<string name="sign_only">Sign only</string>
<string name="encrypt_only">Encrypt only</string>
<string name="sign_and_encrypt">Sign and Encrypt</string>
<!-- choice_lowerCase: capitalized firwst word, no punctuation -->
<string name="choice_signOnly">Sign only</string>
<string name="choice_encryptOnly">Encrypt only</string>
<string name="choice_signAndEncrypt">Sign and Encrypt</string>
<string name="dsa">DSA</string>
<string name="elgamal">ElGamal</string>
<string name="rsa">RSA</string>
<string name="wrong_pass_phrase">Wrong pass phrase.</string>
<string name="using_clipboard_content">Using clipboard content.</string>
<string name="key_saved">Key saved.</string>
<string name="set_a_pass_phrase">Set a pass phrase via the option menu first.</string>
<string name="filemanager_titleOpen">Open...</string>
<string name="filemanager_titleSave">Save As...</string>
<string name="filemanager_titleEncrypt">Select File To Encrypt...</string>
<string name="filemanager_titleDecrypt">Select File To Decrypt...</string>
<string name="filemanager_btnOpen">Open</string>
<string name="filemanager_btnSave">Save</string>
<string name="no_filemanager_installed">OI File Manager not installed.</string>
<string name="filemanager_title_open">Open...</string>
<string name="filemanager_btn_open">Open</string>
<string name="filemanager_title_save">Save As...</string>
<string name="filemanager_btn_save">Save</string>
<string name="warning">Warning</string>
<string name="error">Error</string>
<string name="warningMessage">Warning: %s</string>
<string name="errorMessage">Error: %s</string>
<!-- sentences -->
<string name="wrongPassPhrase">Wrong pass phrase.</string>
<string name="usingClipboardContent">Using clipboard content.</string>
<string name="keySaved">Key saved.</string>
<string name="setAPassPhrase">Set a pass phrase via the option menu first.</string>
<string name="oiFilemanagerNotInstalled">OI File Manager not installed.</string>
<string name="passPhrasesDoNotMatch">The pass phrases didn't match.</string>
<string name="passPhraseMustNotBeEmpty">Empty pass phrases are not allowed.</string>
<string name="passPhraseForSymmetricEncryption">Pass phrase for symmetric encryption:</string>
<string name="passPhraseFor">Pass phrase for %s:</string>
<string name="fileDeleteConfirmation">Are you sure you want to delete\n%s?</string>
<string name="fileDeleteSuccessful">Successfully deleted.</string>
<string name="noFileSelected">Select a file first.</string>
<string name="decryptionSuccessful">Successfully decrypted.</string>
<string name="encryptionSuccessful">Successfully encrypted.</string>
<string name="encryptionToClipboardSuccessful">Successfully encrypted to clipboard.</string>
<string name="enterPassPhraseTwice">Enter the pass phrase twice.</string>
<string name="selectEncryptionKey">Select at least one encryption key.</string>
<string name="selectEncryptionOrSignatureKey">Select at least one encryption key or a signature key.</string>
<string name="specifyFileToEncryptTo">Please specify which file to encrypt to.\nWARNING! File will be overwritten if it exists.</string>
<string name="specifyFileToDecryptTo">Please specify which file to decrypt to.\nWARNING! File will be overwritten if it exists.</string>
<string name="specifyGoogleMailAccount">Specify the Google Mail account you want to add.</string>
<string name="specifyFileToImportFrom">Please specify which file to import from.</string>
<string name="specifyFileToExportTo">Please specify which file to export to.\nWARNING! File will be overwritten if it exists.</string>
<string name="specifyFileToExportSecretKeysTo">Please specify which file to export to.\nWARNING! You are about to export SECRET keys.\nWARNING! File will be overwritten if it exists.</string>
<string name="keyDeletionConfirmation">Do you really want to delete the key '%s'?\nYou can't undo this!</string>
<string name="secretKeyDeletionConfirmation">Do you really want to delete the SECRET key '%s'?\nYou can't undo this!</string>
<string name="keysAddedAndUpdated">Succssfully added %s keys and updated %s keys."</string>
<string name="keysAdded">Succssfully added %s keys.</string>
<string name="keysUpdated">Succssfully updated %s keys.</string>
<string name="noKeysAddedOrUpdated">No keys added or updated.</string>
<string name="keyExported">Succssfully exported 1 key.</string>
<string name="keysExported">Succssfully exported %s keys.</string>
<string name="noKeysExported">No keys exported.</string>
<string name="keyCreationElGamalInfo">Note: only subkeys support ElGamal, and for ElGamal the nearest keysize of 1536, 2048, 3072, 4096, or 8192 will be used.</string>
<!-- error_lowerCase: phrases, no punctuation, all lowercase,
they will be put after "errorMessage", e.g. "Error: file not found" -->
<string name="error_fileDeleteFailed">deleting '%s' failed</string>
<string name="error_fileNotFound">file not found</string>
<string name="error_noSecretKeyFound">no suitable secret key found</string>
<string name="error_noKnownEncryptionFound">no known kind of encryption found</string>
<string name="error_externalStorageNotReady">external storage not ready</string>
<string name="error_accountNotFound">account '%s' not found</string>
<string name="error_addingAccountFailed">adding account '%s' failed</string>
<string name="error_invalidEmail">invalid email '%s'</string>
<!-- progress_lowerCase: lowercase, phrases, usually ending in '...' -->
<string name="progress_initializing">initializing...</string>
<string name="progress_saving">saving...</string>
<string name="progress_importing">importing...</string>
<string name="progress_exporting">exporting...</string>
<string name="progress_generating">generating key, this can take a while...</string>
</resources>

View File

@ -977,7 +977,7 @@ public class Apg {
public static String getMainUserIdSafe(Context context, PGPPublicKey key) {
String userId = getMainUserId(key);
if (userId == null) {
userId = context.getResources().getString(R.string.unknown_user_id);
userId = context.getResources().getString(R.string.unknownUserId);
}
return userId;
}
@ -985,7 +985,7 @@ public class Apg {
public static String getMainUserIdSafe(Context context, PGPSecretKey key) {
String userId = getMainUserId(key);
if (userId == null) {
userId = context.getResources().getString(R.string.unknown_user_id);
userId = context.getResources().getString(R.string.unknownUserId);
}
return userId;
}

View File

@ -45,21 +45,21 @@ public class AskForSecretKeyPassPhrase {
if (secretKeyId == 0) {
secretKey = null;
alert.setMessage("Pass phrase for symmetric encryption");
alert.setMessage(context.getString(R.string.passPhraseForSymmetricEncryption));
} else {
secretKey = Apg.getMasterKey(Apg.findSecretKeyRing(secretKeyId));
if (secretKey == null) {
return null;
}
String userId = Apg.getMainUserIdSafe(context, secretKey);
alert.setMessage("Pass phrase for " + userId);
alert.setMessage(context.getString(R.string.passPhraseFor, userId));
}
LayoutInflater inflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.pass_phrase, null);
final EditText input = (EditText) view.findViewById(R.id.pass_phrase);
final EditText inputNotUsed = (EditText) view.findViewById(R.id.pass_phrase_again);
final EditText input = (EditText) view.findViewById(R.id.passPhrase);
final EditText inputNotUsed = (EditText) view.findViewById(R.id.passPhraseAgain);
inputNotUsed.setVisibility(View.GONE);
alert.setView(view);
@ -77,7 +77,7 @@ public class AskForSecretKeyPassPhrase {
new BouncyCastleProvider());
} catch (PGPException e) {
Toast.makeText(activity,
R.string.wrong_pass_phrase,
R.string.wrongPassPhrase,
Toast.LENGTH_SHORT).show();
return;
}

View File

@ -70,27 +70,27 @@ public class BaseActivity extends Activity
mProgressDialog.setCancelable(false);
switch (id) {
case Id.dialog.encrypting: {
mProgressDialog.setMessage("initializing...");
mProgressDialog.setMessage(this.getString(R.string.progress_initializing));
return mProgressDialog;
}
case Id.dialog.decrypting: {
mProgressDialog.setMessage("initializing...");
mProgressDialog.setMessage(this.getString(R.string.progress_initializing));
return mProgressDialog;
}
case Id.dialog.saving: {
mProgressDialog.setMessage("saving...");
mProgressDialog.setMessage(this.getString(R.string.progress_saving));
return mProgressDialog;
}
case Id.dialog.importing: {
mProgressDialog.setMessage("importing...");
mProgressDialog.setMessage(this.getString(R.string.progress_importing));
return mProgressDialog;
}
case Id.dialog.exporting: {
mProgressDialog.setMessage("exporting...");
mProgressDialog.setMessage(this.getString(R.string.progress_exporting));
return mProgressDialog;
}
@ -109,8 +109,8 @@ public class BaseActivity extends Activity
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setIcon(android.R.drawable.ic_dialog_alert);
alert.setTitle("Error");
alert.setMessage("The pass phrases didn't match.");
alert.setTitle(R.string.error);
alert.setMessage(R.string.passPhrasesDoNotMatch);
alert.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
@ -127,8 +127,8 @@ public class BaseActivity extends Activity
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setIcon(android.R.drawable.ic_dialog_alert);
alert.setTitle("Error");
alert.setMessage("Empty pass phrases are not supported.");
alert.setTitle(R.string.error);
alert.setMessage(R.string.passPhraseMustNotBeEmpty);
alert.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
@ -145,24 +145,28 @@ public class BaseActivity extends Activity
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setIcon(android.R.drawable.ic_dialog_alert);
alert.setTitle("Warning");
alert.setMessage("Are you sure you want to delete\n" + getDeleteFile() + "?");
alert.setTitle(R.string.warning);
alert.setMessage(this.getString(R.string.fileDeleteConfirmation, getDeleteFile()));
alert.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
removeDialog(Id.dialog.delete_file);
File file = new File(getDeleteFile());
String msg = "";
if (file.delete()) {
msg = "Successfully deleted.";
} else {
msg = "Error: deleting '" + file + "' failed";
}
Toast.makeText(BaseActivity.this,
msg, Toast.LENGTH_SHORT).show();
}
});
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
removeDialog(Id.dialog.delete_file);
File file = new File(getDeleteFile());
String msg = "";
if (file.delete()) {
msg = BaseActivity.this.getString(
R.string.fileDeleteSuccessful);
} else {
msg = BaseActivity.this.getString(
R.string.errorMessage,
BaseActivity.this.getString(
R.string.error_fileDeleteFailed, file));
}
Toast.makeText(BaseActivity.this,
msg, Toast.LENGTH_SHORT).show();
}
});
alert.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {

View File

@ -91,9 +91,9 @@ public class DecryptActivity extends BaseActivity {
setContentView(R.layout.decrypt);
mSource = (ViewFlipper) findViewById(R.id.source);
mSourceLabel = (TextView) findViewById(R.id.source_label);
mSourcePrevious = (ImageView) findViewById(R.id.source_previous);
mSourceNext = (ImageView) findViewById(R.id.source_next);
mSourceLabel = (TextView) findViewById(R.id.sourceLabel);
mSourcePrevious = (ImageView) findViewById(R.id.sourcePrevious);
mSourceNext = (ImageView) findViewById(R.id.sourceNext);
mSourcePrevious.setClickable(true);
mSourcePrevious.setOnClickListener(new OnClickListener() {
@ -128,14 +128,14 @@ public class DecryptActivity extends BaseActivity {
mMessage = (EditText) findViewById(R.id.message);
mDecryptButton = (Button) findViewById(R.id.btn_decrypt);
mReplyButton = (Button) findViewById(R.id.btn_reply);
mSignatureLayout = (LinearLayout) findViewById(R.id.layout_signature);
mSignatureLayout = (LinearLayout) findViewById(R.id.signature);
mSignatureStatusImage = (ImageView) findViewById(R.id.ic_signature_status);
mUserId = (TextView) findViewById(R.id.main_user_id);
mUserIdRest = (TextView) findViewById(R.id.main_user_id_rest);
mUserId = (TextView) findViewById(R.id.mainUserId);
mUserIdRest = (TextView) findViewById(R.id.mainUserIdRest);
// measure the height of the source_file view and set the message view's min height to that,
// so it fills mSource fully... bit of a hack.
View tmp = findViewById(R.id.source_file);
View tmp = findViewById(R.id.sourceFile);
tmp.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int height = tmp.getMeasuredHeight();
mMessage.setMinimumHeight(height);
@ -149,12 +149,12 @@ public class DecryptActivity extends BaseActivity {
}
});
mDeleteAfter = (CheckBox) findViewById(R.id.delete_after_decryption);
mDeleteAfter = (CheckBox) findViewById(R.id.deleteAfterDecryption);
// default: message source
mSource.setInAnimation(null);
mSource.setOutAnimation(null);
while (mSource.getCurrentView().getId() != R.id.source_message) {
while (mSource.getCurrentView().getId() != R.id.sourceMessage) {
mSource.showNext();
}
@ -206,12 +206,12 @@ public class DecryptActivity extends BaseActivity {
} else if (intent.getAction() != null && intent.getAction().equals(Apg.Intent.DECRYPT_FILE)) {
mSource.setInAnimation(null);
mSource.setOutAnimation(null);
while (mSource.getCurrentView().getId() != R.id.source_file) {
while (mSource.getCurrentView().getId() != R.id.sourceFile) {
mSource.showNext();
}
}
if (mSource.getCurrentView().getId() == R.id.source_message &&
if (mSource.getCurrentView().getId() == R.id.sourceMessage &&
mMessage.getText().length() == 0) {
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
String data = "";
@ -222,7 +222,7 @@ public class DecryptActivity extends BaseActivity {
if (matcher.matches()) {
data = matcher.group(1);
mMessage.setText(data);
Toast.makeText(this, R.string.using_clipboard_content, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.usingClipboardContent, Toast.LENGTH_SHORT).show();
}
}
@ -243,7 +243,7 @@ public class DecryptActivity extends BaseActivity {
});
mReplyButton.setVisibility(View.INVISIBLE);
if (mSource.getCurrentView().getId() == R.id.source_message &&
if (mSource.getCurrentView().getId() == R.id.sourceMessage &&
mMessage.getText().length() > 0) {
mDecryptButton.performClick();
}
@ -258,14 +258,14 @@ public class DecryptActivity extends BaseActivity {
intent.setData(Uri.parse("file://" + filename));
intent.putExtra(FileManager.EXTRA_TITLE, "Select file to decrypt...");
intent.putExtra(FileManager.EXTRA_BUTTON_TEXT, "Open");
intent.putExtra(FileManager.EXTRA_TITLE, getString(R.string.filemanager_titleDecrypt));
intent.putExtra(FileManager.EXTRA_BUTTON_TEXT, R.string.filemanager_btnOpen);
try {
startActivityForResult(intent, Id.request.filename);
} catch (ActivityNotFoundException e) {
// No compatible file manager was found.
Toast.makeText(this, R.string.no_filemanager_installed, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.oiFilemanagerNotInstalled, Toast.LENGTH_SHORT).show();
}
}
@ -281,13 +281,13 @@ public class DecryptActivity extends BaseActivity {
private void updateSource() {
switch (mSource.getCurrentView().getId()) {
case R.id.source_file: {
case R.id.sourceFile: {
mSourceLabel.setText(R.string.label_file);
mDecryptButton.setText(R.string.btn_decrypt);
break;
}
case R.id.source_message: {
case R.id.sourceMessage: {
mSourceLabel.setText(R.string.label_message);
mDecryptButton.setText(R.string.btn_decrypt);
break;
@ -300,7 +300,7 @@ public class DecryptActivity extends BaseActivity {
}
private void decryptClicked() {
if (mSource.getCurrentView().getId() == R.id.source_file) {
if (mSource.getCurrentView().getId() == R.id.sourceFile) {
mDecryptTarget = Id.target.file;
} else {
mDecryptTarget = Id.target.message;
@ -316,13 +316,15 @@ public class DecryptActivity extends BaseActivity {
}
if (mInputFilename.equals("")) {
Toast.makeText(this, "Select a file first.", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.noFileSelected, Toast.LENGTH_SHORT).show();
return;
}
File file = new File(mInputFilename);
if (!file.exists() || !file.isFile()) {
Toast.makeText(this, "Error: file not found", Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.errorMessage,
getString(R.string.error_fileNotFound)),
Toast.LENGTH_SHORT).show();
return;
}
}
@ -350,7 +352,7 @@ public class DecryptActivity extends BaseActivity {
try {
setSecretKeyId(Apg.getDecryptionKeyId(in));
if (getSecretKeyId() == 0) {
throw new Apg.GeneralException("no suitable secret key found");
throw new Apg.GeneralException(getString(R.string.error_noSecretKeyFound));
}
mAssumeSymmetricEncryption = false;
} catch (Apg.NoAsymmetricEncryptionException e) {
@ -363,21 +365,22 @@ public class DecryptActivity extends BaseActivity {
in = new ByteArrayInputStream(mMessage.getText().toString().getBytes());
}
if (!Apg.hasSymmetricEncryption(in)) {
throw new Apg.GeneralException("no known kind of encryption found");
throw new Apg.GeneralException(getString(R.string.error_noKnownEncryptionFound));
}
mAssumeSymmetricEncryption = true;
}
showDialog(Id.dialog.pass_phrase);
} catch (FileNotFoundException e) {
error = "file not found: " + e.getLocalizedMessage();
error = getString(R.string.error_fileNotFound);
} catch (IOException e) {
error = e.getLocalizedMessage();
} catch (Apg.GeneralException e) {
error = e.getLocalizedMessage();
}
if (error != null) {
Toast.makeText(this, "Error: " + error, Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.errorMessage, error),
Toast.LENGTH_SHORT).show();
}
}
@ -481,12 +484,13 @@ public class DecryptActivity extends BaseActivity {
String error = data.getString("error");
if (error != null) {
Toast.makeText(DecryptActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage,
data.getString("error")),
Toast.LENGTH_SHORT).show();
return;
}
Toast.makeText(this, "Successfully decrypted.", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.decryptionSuccessful, Toast.LENGTH_SHORT).show();
switch (mDecryptTarget) {
case Id.target.message: {
String decryptedMessage = data.getString("decryptedMessage");
@ -514,7 +518,7 @@ public class DecryptActivity extends BaseActivity {
mSignatureKeyId = data.getLong("signatureKeyId");
mUserIdRest.setText("id: " + Long.toHexString(mSignatureKeyId & 0xffffffffL));
if (userId == null) {
userId = getResources().getString(R.string.unknown_user_id);
userId = getResources().getString(R.string.unknownUserId);
}
String chunks[] = userId.split(" <", 2);
userId = chunks[0];
@ -583,9 +587,8 @@ public class DecryptActivity extends BaseActivity {
protected Dialog onCreateDialog(int id) {
switch (id) {
case Id.dialog.output_filename: {
return FileDialog.build(this, "Decrypt to file",
"Please specify which file to decrypt to.\n" +
"WARNING! File will be overwritten if it exists.",
return FileDialog.build(this, getString(R.string.title_decryptToFile),
getString(R.string.specifyFileToDecryptTo),
mOutputFilename,
new FileDialog.OnClickListener() {
@ -601,8 +604,8 @@ public class DecryptActivity extends BaseActivity {
removeDialog(Id.dialog.output_filename);
}
},
getString(R.string.filemanager_title_save),
getString(R.string.filemanager_btn_save),
getString(R.string.filemanager_titleSave),
getString(R.string.filemanager_btnSave),
Id.request.output_filename);
}

View File

@ -103,11 +103,11 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
LinearLayout container = (LinearLayout) findViewById(R.id.container);
mUserIds = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
mUserIds.setType(SectionView.TYPE_USER_ID);
mUserIds.setType(Id.type.user_id);
mUserIds.setUserIds(userIds);
container.addView(mUserIds);
mKeys = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false);
mKeys.setType(SectionView.TYPE_KEY);
mKeys.setType(Id.type.key);
mKeys.setKeys(keys);
container.addView(mKeys);
@ -122,7 +122,7 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Id.menu.option.new_pass_phrase, 0,
(havePassPhrase() ? "Change Pass Phrase" : "Set Pass Phrase"))
(havePassPhrase() ? R.string.menu_changePassPhrase : R.string.menu_setPassPhrase))
.setIcon(android.R.drawable.ic_menu_add);
return true;
}
@ -149,17 +149,17 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
if (havePassPhrase()) {
alert.setTitle("Change Pass Phrase");
alert.setTitle(R.string.title_changePassPhrase);
} else {
alert.setTitle("Set Pass Phrase");
alert.setTitle(R.string.title_setPassPhrase);
}
alert.setMessage("Enter the pass phrase twice.");
alert.setMessage(R.string.enterPassPhraseTwice);
LayoutInflater inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.pass_phrase, null);
final EditText input1 = (EditText) view.findViewById(R.id.pass_phrase);
final EditText input2 = (EditText) view.findViewById(R.id.pass_phrase_again);
final EditText input1 = (EditText) view.findViewById(R.id.passPhrase);
final EditText input2 = (EditText) view.findViewById(R.id.passPhraseAgain);
alert.setView(view);
@ -213,7 +213,7 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
private void saveClicked() {
if (!havePassPhrase()) {
Toast.makeText(this, R.string.set_a_pass_phrase, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.setAPassPhrase, Toast.LENGTH_SHORT).show();
return;
}
showDialog(Id.dialog.saving);
@ -265,10 +265,10 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener {
String error = data.getString("error");
if (error != null) {
Toast.makeText(EditKeyActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage, data.getString("error")),
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(EditKeyActivity.this, R.string.key_saved, Toast.LENGTH_SHORT).show();
Toast.makeText(EditKeyActivity.this, R.string.keySaved, Toast.LENGTH_SHORT).show();
setResult(RESULT_OK);
finish();
}

View File

@ -101,9 +101,9 @@ public class EncryptActivity extends BaseActivity {
setContentView(R.layout.encrypt);
mSource = (ViewFlipper) findViewById(R.id.source);
mSourceLabel = (TextView) findViewById(R.id.source_label);
mSourcePrevious = (ImageView) findViewById(R.id.source_previous);
mSourceNext = (ImageView) findViewById(R.id.source_next);
mSourceLabel = (TextView) findViewById(R.id.sourceLabel);
mSourcePrevious = (ImageView) findViewById(R.id.sourcePrevious);
mSourceNext = (ImageView) findViewById(R.id.sourceNext);
mSourcePrevious.setClickable(true);
mSourcePrevious.setOnClickListener(new OnClickListener() {
@ -136,9 +136,9 @@ public class EncryptActivity extends BaseActivity {
mSourceLabel.setOnClickListener(nextSourceClickListener);
mMode = (ViewFlipper) findViewById(R.id.mode);
mModeLabel = (TextView) findViewById(R.id.mode_label);
mModePrevious = (ImageView) findViewById(R.id.mode_previous);
mModeNext = (ImageView) findViewById(R.id.mode_next);
mModeLabel = (TextView) findViewById(R.id.modeLabel);
mModePrevious = (ImageView) findViewById(R.id.modePrevious);
mModeNext = (ImageView) findViewById(R.id.modeNext);
mModePrevious.setClickable(true);
mModePrevious.setOnClickListener(new OnClickListener() {
@ -172,17 +172,17 @@ public class EncryptActivity extends BaseActivity {
mMessage = (EditText) findViewById(R.id.message);
mSelectKeysButton = (Button) findViewById(R.id.btn_selectEncryptKeys);
mEncryptButton = (Button) findViewById(R.id.btn_encrypt);
mEncryptToClipboardButton = (Button) findViewById(R.id.btn_encrypt_to_clipboard);
mEncryptToClipboardButton = (Button) findViewById(R.id.btn_encryptToClipboard);
mSign = (CheckBox) findViewById(R.id.sign);
mMainUserId = (TextView) findViewById(R.id.main_user_id);
mMainUserIdRest = (TextView) findViewById(R.id.main_user_id_rest);
mMainUserId = (TextView) findViewById(R.id.mainUserId);
mMainUserIdRest = (TextView) findViewById(R.id.mainUserIdRest);
mPassPhrase = (EditText) findViewById(R.id.pass_phrase);
mPassPhraseAgain = (EditText) findViewById(R.id.pass_phrase_again);
mPassPhrase = (EditText) findViewById(R.id.passPhrase);
mPassPhraseAgain = (EditText) findViewById(R.id.passPhraseAgain);
// measure the height of the source_file view and set the message view's min height to that,
// so it fills mSource fully... bit of a hack.
View tmp = findViewById(R.id.source_file);
View tmp = findViewById(R.id.sourceFile);
tmp.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int height = tmp.getMeasuredHeight();
mMessage.setMinimumHeight(height);
@ -196,12 +196,11 @@ public class EncryptActivity extends BaseActivity {
}
});
mDeleteAfter = (CheckBox) findViewById(R.id.delete_after_encryption);
mDeleteAfter = (CheckBox) findViewById(R.id.deleteAfterEncryption);
mAsciiArmour = (CheckBox) findViewById(R.id.ascii_armour);
mAsciiArmour = (CheckBox) findViewById(R.id.asciiArmour);
mAsciiArmour.setChecked(getDefaultAsciiArmour());
mAsciiArmour.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
guessOutputFilename();
@ -302,13 +301,13 @@ public class EncryptActivity extends BaseActivity {
}
mSource.setInAnimation(null);
mSource.setOutAnimation(null);
while (mSource.getCurrentView().getId() != R.id.source_message) {
while (mSource.getCurrentView().getId() != R.id.sourceMessage) {
mSource.showNext();
}
} else if (intent.getAction().equals(Apg.Intent.ENCRYPT_FILE)) {
mSource.setInAnimation(null);
mSource.setOutAnimation(null);
while (mSource.getCurrentView().getId() != R.id.source_file) {
while (mSource.getCurrentView().getId() != R.id.sourceFile) {
mSource.showNext();
}
}
@ -326,14 +325,14 @@ public class EncryptActivity extends BaseActivity {
intent.setData(Uri.parse("file://" + filename));
intent.putExtra(FileManager.EXTRA_TITLE, "Select file to encrypt...");
intent.putExtra(FileManager.EXTRA_BUTTON_TEXT, "Open");
intent.putExtra(FileManager.EXTRA_TITLE, R.string.filemanager_titleEncrypt);
intent.putExtra(FileManager.EXTRA_BUTTON_TEXT, R.string.filemanager_btnOpen);
try {
startActivityForResult(intent, Id.request.filename);
} catch (ActivityNotFoundException e) {
// No compatible file manager was found.
Toast.makeText(this, R.string.no_filemanager_installed, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.oiFilemanagerNotInstalled, Toast.LENGTH_SHORT).show();
}
}
@ -346,14 +345,14 @@ public class EncryptActivity extends BaseActivity {
private void updateSource() {
switch (mSource.getCurrentView().getId()) {
case R.id.source_file: {
case R.id.sourceFile: {
mSourceLabel.setText(R.string.label_file);
mEncryptButton.setText(R.string.btn_encrypt);
mEncryptToClipboardButton.setEnabled(false);
break;
}
case R.id.source_message: {
case R.id.sourceMessage: {
mSourceLabel.setText(R.string.label_message);
mEncryptButton.setText(R.string.btn_send);
mEncryptToClipboardButton.setEnabled(true);
@ -368,12 +367,12 @@ public class EncryptActivity extends BaseActivity {
private void updateMode() {
switch (mMode.getCurrentView().getId()) {
case R.id.mode_asymmetric: {
case R.id.modeAsymmetric: {
mModeLabel.setText(R.string.label_asymmetric);
break;
}
case R.id.mode_symmetric: {
case R.id.modeSymmetric: {
mModeLabel.setText(R.string.label_symmetric);
break;
}
@ -390,7 +389,7 @@ public class EncryptActivity extends BaseActivity {
}
private void encryptClicked() {
if (mSource.getCurrentView().getId() == R.id.source_file) {
if (mSource.getCurrentView().getId() == R.id.sourceFile) {
mEncryptTarget = Id.target.file;
} else {
mEncryptTarget = Id.target.email;
@ -406,43 +405,44 @@ public class EncryptActivity extends BaseActivity {
}
if (mInputFilename.equals("")) {
Toast.makeText(this, "Select a file first.", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.noFileSelected, Toast.LENGTH_SHORT).show();
return;
}
File file = new File(mInputFilename);
if (!file.exists() || !file.isFile()) {
Toast.makeText(this, "Error: file not found", Toast.LENGTH_SHORT).show();
Toast.makeText(this, getString(R.string.errorMessage,
getString(R.string.error_fileNotFound)),
Toast.LENGTH_SHORT).show();
return;
}
}
// symmetric encryption
if (mMode.getCurrentView().getId() == R.id.mode_symmetric) {
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
boolean gotPassPhrase = false;
String passPhrase = mPassPhrase.getText().toString();
String passPhraseAgain = mPassPhraseAgain.getText().toString();
if (!passPhrase.equals(passPhraseAgain)) {
Toast.makeText(this, "Pass phrases don't match.", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.passPhrasesDoNotMatch, Toast.LENGTH_SHORT).show();
return;
}
gotPassPhrase = (passPhrase.length() != 0);
if (!gotPassPhrase) {
Toast.makeText(this, "Enter a pass phrase.", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.passPhraseMustNotBeEmpty, Toast.LENGTH_SHORT).show();
return;
}
} else {
boolean encryptIt = mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0;
// for now require at least one form of encryption for files
if (!encryptIt && mEncryptTarget == Id.target.file) {
Toast.makeText(this, "Select at least one encryption key.",
Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.selectEncryptionKey, Toast.LENGTH_SHORT).show();
return;
}
if (!encryptIt && getSecretKeyId() == 0) {
Toast.makeText(this, "Select at least one encryption key or a signature key.",
Toast.makeText(this, R.string.selectEncryptionOrSignatureKey,
Toast.LENGTH_SHORT).show();
return;
}
@ -495,7 +495,7 @@ public class EncryptActivity extends BaseActivity {
boolean signOnly = false;
String passPhrase = null;
if (mMode.getCurrentView().getId() == R.id.mode_symmetric) {
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
passPhrase = mPassPhrase.getText().toString();
if (passPhrase.length() == 0) {
passPhrase = null;
@ -510,7 +510,7 @@ public class EncryptActivity extends BaseActivity {
if (mInputFilename.startsWith(Environment.getExternalStorageDirectory().getAbsolutePath()) ||
mOutputFilename.startsWith(Environment.getExternalStorageDirectory().getAbsolutePath())) {
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
throw new GeneralException("external storage not ready");
throw new GeneralException(getString(R.string.error_externalStorageNotReady));
}
}
@ -583,12 +583,12 @@ public class EncryptActivity extends BaseActivity {
private void updateView() {
if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
mSelectKeysButton.setText(R.string.no_keys_selected);
mSelectKeysButton.setText(R.string.noKeysSelected);
} else if (mEncryptionKeyIds.length == 1) {
mSelectKeysButton.setText(R.string.one_key_selected);
mSelectKeysButton.setText(R.string.oneKeySelected);
} else {
mSelectKeysButton.setText("" + mEncryptionKeyIds.length + " " +
getResources().getString(R.string.n_keys_selected));
getResources().getString(R.string.nKeysSelected));
}
if (getSecretKeyId() == 0) {
@ -596,7 +596,7 @@ public class EncryptActivity extends BaseActivity {
mMainUserId.setText("");
mMainUserIdRest.setText("");
} else {
String uid = getResources().getString(R.string.unknown_user_id);
String uid = getResources().getString(R.string.unknownUserId);
String uidExtra = "";
PGPSecretKeyRing keyRing = Apg.getSecretKeyRing(getSecretKeyId());
if (keyRing != null) {
@ -699,7 +699,7 @@ public class EncryptActivity extends BaseActivity {
String error = data.getString("error");
if (error != null) {
Toast.makeText(EncryptActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage, data.getString("error")),
Toast.LENGTH_SHORT).show();
return;
} else {
@ -708,7 +708,7 @@ public class EncryptActivity extends BaseActivity {
case Id.target.clipboard: {
ClipboardManager clip = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clip.setText(message);
Toast.makeText(this, "Successfully encrypted to clipboard.",
Toast.makeText(this, R.string.encryptionToClipboardSuccessful,
Toast.LENGTH_SHORT).show();
break;
}
@ -726,11 +726,12 @@ public class EncryptActivity extends BaseActivity {
new String[] { mSendTo });
}
EncryptActivity.this.
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
startActivity(Intent.createChooser(emailIntent,
getString(R.string.title_sendEmail)));
}
case Id.target.file: {
Toast.makeText(this, "Successfully encrypted.", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.encryptionSuccessful, Toast.LENGTH_SHORT).show();
if (mDeleteAfter.isChecked()) {
setDeleteFile(mInputFilename);
showDialog(Id.dialog.delete_file);
@ -750,9 +751,8 @@ public class EncryptActivity extends BaseActivity {
protected Dialog onCreateDialog(int id) {
switch (id) {
case Id.dialog.output_filename: {
return FileDialog.build(this, "Encrypt to file",
"Please specify which file to encrypt to.\n" +
"WARNING! File will be overwritten if it exists.",
return FileDialog.build(this, getString(R.string.title_encryptToFile),
getString(R.string.specifyFileToEncryptTo),
mOutputFilename,
new FileDialog.OnClickListener() {
@ -768,8 +768,8 @@ public class EncryptActivity extends BaseActivity {
removeDialog(Id.dialog.output_filename);
}
},
getString(R.string.filemanager_title_save),
getString(R.string.filemanager_btn_save),
getString(R.string.filemanager_titleSave),
getString(R.string.filemanager_btnSave),
Id.request.output_filename);
}

View File

@ -113,7 +113,7 @@ public class FileDialog {
mActivity.startActivityForResult(intent, mRequestCode);
} catch (ActivityNotFoundException e) {
// No compatible file manager was found.
Toast.makeText(mActivity, R.string.no_filemanager_installed, Toast.LENGTH_SHORT).show();
Toast.makeText(mActivity, R.string.oiFilemanagerNotInstalled, Toast.LENGTH_SHORT).show();
}
}
}

View File

@ -81,6 +81,8 @@ public final class Id {
public static final class type {
public static final int public_key = 0x21070001;
public static final int secret_key = 0x21070002;
public static final int user_id = 0x21070003;
public static final int key = 0x21070004;
}
public static final class choice {

View File

@ -196,7 +196,7 @@ public class MailListActivity extends ListActivity {
Message message = (Message) getItem(position);
TextView subject = (TextView) view.findViewById(R.id.subject);
TextView email = (TextView) view.findViewById(R.id.email_address);
TextView email = (TextView) view.findViewById(R.id.emailAddress);
ImageView status = (ImageView) view.findViewById(R.id.ic_status);
subject.setText(message.subject);

View File

@ -57,7 +57,7 @@ public class MainActivity extends BaseActivity {
Button decryptMessageButton = (Button) findViewById(R.id.btn_decryptMessage);
Button encryptFileButton = (Button) findViewById(R.id.btn_encryptFile);
Button decryptFileButton = (Button) findViewById(R.id.btn_decryptFile);
mAccounts = (ListView) findViewById(R.id.account_list);
mAccounts = (ListView) findViewById(R.id.accounts);
encryptMessageButton.setOnClickListener(new OnClickListener() {
@Override
@ -126,44 +126,46 @@ public class MainActivity extends BaseActivity {
case Id.dialog.new_account: {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Add Account");
alert.setMessage("Specify the Google Mail account you want to add.");
alert.setTitle(R.string.title_addAccount);
alert.setMessage(R.string.specifyGoogleMailAccount);
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainActivity.this.removeDialog(Id.dialog.new_account);
String accountName = "" + input.getText();
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainActivity.this.removeDialog(Id.dialog.new_account);
String accountName = "" + input.getText();
Cursor testCursor =
managedQuery(Uri.parse("content://gmail-ls/conversations/" +
accountName),
null, null, null, null);
if (testCursor == null) {
Toast.makeText(MainActivity.this,
"Error: account '" + accountName +
"' not found",
Toast.LENGTH_SHORT).show();
return;
}
Cursor testCursor =
managedQuery(Uri.parse("content://gmail-ls/conversations/" +
accountName),
null, null, null, null);
if (testCursor == null) {
Toast.makeText(MainActivity.this,
getString(R.string.errorMessage,
getString(R.string.error_accountNotFound,
accountName)),
Toast.LENGTH_SHORT).show();
return;
}
ContentValues values = new ContentValues();
values.put(Accounts.NAME, accountName);
try {
MainActivity.this.getContentResolver()
.insert(Accounts.CONTENT_URI,
values);
} catch (SQLException e) {
Toast.makeText(MainActivity.this,
"Error: failed to add account '" +
accountName + "'",
Toast.LENGTH_SHORT).show();
}
}
});
ContentValues values = new ContentValues();
values.put(Accounts.NAME, accountName);
try {
MainActivity.this.getContentResolver()
.insert(Accounts.CONTENT_URI,
values);
} catch (SQLException e) {
Toast.makeText(MainActivity.this,
getString(R.string.errorMessage,
getString(R.string.error_addingAccountFailed,
accountName)),
Toast.LENGTH_SHORT).show();
}
}
});
alert.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@ -302,10 +304,10 @@ public class MainActivity extends BaseActivity {
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
TextView nameTextView = (TextView) v.findViewById(R.id.account_name);
TextView nameTextView = (TextView) v.findViewById(R.id.accountName);
if (nameTextView != null) {
menu.setHeaderTitle(nameTextView.getText());
menu.add(0, Id.menu.delete, 0, "Delete Account");
menu.add(0, Id.menu.delete, 0, R.string.menu_deleteAccount);
}
}
@ -348,7 +350,7 @@ public class MainActivity extends BaseActivity {
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView nameTextView = (TextView) view.findViewById(R.id.account_name);
TextView nameTextView = (TextView) view.findViewById(R.id.accountName);
int nameIndex = cursor.getColumnIndex(Accounts.NAME);
final String account = cursor.getString(nameIndex);
nameTextView.setText(account);

View File

@ -39,9 +39,9 @@ public class PreferencesActivity extends BaseActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.preferences);
mEncryptionAlgorithm = (Spinner) findViewById(R.id.encryption_algorithm);
mHashAlgorithm = (Spinner) findViewById(R.id.hash_algorithm);
mAsciiArmour = (CheckBox) findViewById(R.id.ascii_armour);
mEncryptionAlgorithm = (Spinner) findViewById(R.id.encryptionAlgorithm);
mHashAlgorithm = (Spinner) findViewById(R.id.hashAlgorithm);
mAsciiArmour = (CheckBox) findViewById(R.id.asciiArmour);
mAsciiArmour.setChecked(getDefaultAsciiArmour());

View File

@ -68,9 +68,9 @@ public class PublicKeyListActivity extends BaseActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Id.menu.option.import_keys, 0, "Import Keys")
menu.add(0, Id.menu.option.import_keys, 0, R.string.menu_importKeys)
.setIcon(android.R.drawable.ic_menu_add);
menu.add(0, Id.menu.option.export_keys, 1, "Export Keys")
menu.add(0, Id.menu.option.export_keys, 1, R.string.menu_exportKeys)
.setIcon(android.R.drawable.ic_menu_save);
return true;
}
@ -107,8 +107,8 @@ public class PublicKeyListActivity extends BaseActivity {
PGPPublicKeyRing keyRing = Apg.getPublicKeyRings().get(groupPosition);
String userId = Apg.getMainUserIdSafe(this, Apg.getMasterKey(keyRing));
menu.setHeaderTitle(userId);
menu.add(0, Id.menu.export, 0, "Export Key");
menu.add(0, Id.menu.delete, 1, "Delete Key");
menu.add(0, Id.menu.export, 0, R.string.menu_exportKey);
menu.add(0, Id.menu.delete, 1, R.string.menu_deleteKey);
}
}
@ -151,11 +151,11 @@ public class PublicKeyListActivity extends BaseActivity {
String userId = Apg.getMainUserIdSafe(this, Apg.getMasterKey(keyRing));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Warning ");
builder.setMessage("Do you really want to delete the key '" + userId + "'?\n" +
"You can't undo this!");
builder.setTitle(R.string.warning);
builder.setMessage(getString(R.string.keyDeletionConfirmation, userId));
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.btn_delete,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
deleteKey(mSelectedItem);
mSelectedItem = -1;
@ -173,8 +173,8 @@ public class PublicKeyListActivity extends BaseActivity {
}
case Id.dialog.import_keys: {
return FileDialog.build(this, "Import Keys",
"Please specify which file to import from.",
return FileDialog.build(this, getString(R.string.title_importKeys),
getString(R.string.specifyFileToImportFrom),
mImportFilename,
new FileDialog.OnClickListener() {
@ -190,8 +190,8 @@ public class PublicKeyListActivity extends BaseActivity {
removeDialog(Id.dialog.import_keys);
}
},
getString(R.string.filemanager_title_open),
getString(R.string.filemanager_btn_open),
getString(R.string.filemanager_titleOpen),
getString(R.string.filemanager_btnOpen),
Id.request.filename);
}
@ -201,17 +201,14 @@ public class PublicKeyListActivity extends BaseActivity {
}
case Id.dialog.export_keys: {
String title = "Export Key";
String title = (singleKeyExport ?
getString(R.string.title_exportKey) :
getString(R.string.title_exportKeys));
if (!singleKeyExport) {
// plural "Keys"
title += "s";
}
final int thisDialogId = (singleKeyExport ? Id.dialog.export_key : Id.dialog.export_keys);
return FileDialog.build(this, title,
"Please specify which file to export to.\n" +
"WARNING! File will be overwritten if it exists.",
getString(R.string.specifyFileToExportTo),
mExportFilename,
new FileDialog.OnClickListener() {
@ -227,8 +224,8 @@ public class PublicKeyListActivity extends BaseActivity {
removeDialog(thisDialogId);
}
},
getString(R.string.filemanager_title_save),
getString(R.string.filemanager_btn_save),
getString(R.string.filemanager_titleSave),
getString(R.string.filemanager_btnSave),
Id.request.filename);
}
@ -280,7 +277,7 @@ public class PublicKeyListActivity extends BaseActivity {
data = Apg.exportKeyRings(this, keys, filename, this);
}
} catch (FileNotFoundException e) {
error = "file '" + filename + "' not found";
error = getString(R.string.error_fileNotFound);
} catch (IOException e) {
error = e.getMessage();
} catch (PGPException e) {
@ -327,21 +324,20 @@ public class PublicKeyListActivity extends BaseActivity {
String error = data.getString("error");
if (error != null) {
Toast.makeText(PublicKeyListActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage, data.getString("error")),
Toast.LENGTH_SHORT).show();
} else {
int added = data.getInt("added");
int updated = data.getInt("updated");
String message;
if (added > 0 && updated > 0) {
message = "Succssfully added " + added + " keys and updated " +
updated + " keys.";
message = getString(R.string.keysAddedAndUpdated, added, updated);
} else if (added > 0) {
message = "Succssfully added " + added + " keys.";
message = getString(R.string.keysAdded, added);
} else if (updated > 0) {
message = "Succssfully updated " + updated + " keys.";
message = getString(R.string.keysUpdated, updated);
} else {
message = "No keys added or updated.";
message = getString(R.string.noKeysAddedOrUpdated);
}
Toast.makeText(PublicKeyListActivity.this, message,
Toast.LENGTH_SHORT).show();
@ -356,17 +352,17 @@ public class PublicKeyListActivity extends BaseActivity {
String error = data.getString("error");
if (error != null) {
Toast.makeText(PublicKeyListActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage, data.getString("error")),
Toast.LENGTH_SHORT).show();
} else {
int exported = data.getInt("exported");
String message;
if (exported == 1) {
message = "Succssfully exported 1 key.";
message = getString(R.string.keyExported);
} else if (exported > 0) {
message = "Succssfully exported " + exported + " keys.";
message = getString(R.string.keysExported);
} else{
message = "No keys exported.";
message = getString(R.string.noKeysExported);
}
Toast.makeText(PublicKeyListActivity.this, message,
Toast.LENGTH_SHORT).show();
@ -481,9 +477,9 @@ public class PublicKeyListActivity extends BaseActivity {
view = mInflater.inflate(R.layout.key_list_group_item, null);
view.setBackgroundResource(android.R.drawable.list_selector_background);
TextView mainUserId = (TextView) view.findViewById(R.id.main_user_id);
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
mainUserId.setText("");
TextView mainUserIdRest = (TextView) view.findViewById(R.id.main_user_id_rest);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
mainUserIdRest.setText("");
String userId = Apg.getMainUserId(key);
@ -497,7 +493,7 @@ public class PublicKeyListActivity extends BaseActivity {
}
if (mainUserId.getText().length() == 0) {
mainUserId.setText(R.string.unknown_user_id);
mainUserId.setText(R.string.unknownUserId);
}
if (mainUserIdRest.getText().length() == 0) {
@ -525,22 +521,22 @@ public class PublicKeyListActivity extends BaseActivity {
view = mInflater.inflate(R.layout.key_list_child_item_sub_key, null);
}
TextView keyId = (TextView) view.findViewById(R.id.key_id);
TextView keyId = (TextView) view.findViewById(R.id.keyId);
String keyIdStr = Long.toHexString(key.getKeyID() & 0xffffffffL);
while (keyIdStr.length() < 8) {
keyIdStr = "0" + keyIdStr;
}
keyId.setText(keyIdStr);
TextView keyDetails = (TextView) view.findViewById(R.id.key_details);
TextView keyDetails = (TextView) view.findViewById(R.id.keyDetails);
String algorithmStr = Apg.getAlgorithmInfo(key);
keyDetails.setText("(" + algorithmStr + ")");
ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encrypt_key);
ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
if (!Apg.isEncryptionKey(key)) {
encryptIcon.setVisibility(View.GONE);
}
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_sign_key);
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
if (!Apg.isSigningKey(key)) {
signIcon.setVisibility(View.GONE);
}
@ -549,7 +545,7 @@ public class PublicKeyListActivity extends BaseActivity {
case KeyChild.USER_ID: {
view = mInflater.inflate(R.layout.key_list_child_item_user_id, null);
TextView userId = (TextView) view.findViewById(R.id.user_id);
TextView userId = (TextView) view.findViewById(R.id.userId);
userId.setText(child.userId);
break;
}

View File

@ -70,11 +70,11 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, Id.menu.option.import_keys, 0, "Import Keys")
menu.add(0, Id.menu.option.import_keys, 0, R.string.menu_importKeys)
.setIcon(android.R.drawable.ic_menu_add);
menu.add(0, Id.menu.option.export_keys, 1, "Export Keys")
menu.add(0, Id.menu.option.export_keys, 1, R.string.menu_exportKeys)
.setIcon(android.R.drawable.ic_menu_save);
menu.add(1, Id.menu.option.create, 2, "Create Key")
menu.add(1, Id.menu.option.create, 2, R.string.menu_createKey)
.setIcon(android.R.drawable.ic_menu_add);
return true;
}
@ -116,9 +116,9 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
PGPSecretKeyRing keyRing = Apg.getSecretKeyRings().get(groupPosition);
String userId = Apg.getMainUserIdSafe(this, Apg.getMasterKey(keyRing));
menu.setHeaderTitle(userId);
menu.add(0, Id.menu.edit, 0, "Edit Key");
menu.add(0, Id.menu.export, 1, "Export Key");
menu.add(0, Id.menu.delete, 2, "Delete Key");
menu.add(0, Id.menu.edit, 0, R.string.menu_editKey);
menu.add(0, Id.menu.export, 1, R.string.menu_exportKey);
menu.add(0, Id.menu.delete, 2, R.string.menu_deleteKey);
}
}
@ -176,11 +176,11 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
String userId = Apg.getMainUserIdSafe(this, Apg.getMasterKey(keyRing));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Warning ");
builder.setMessage("Do you really want to delete the key '" + userId + "'?\n" +
"You can't undo this!");
builder.setTitle(R.string.warning);
builder.setMessage(getString(R.string.secretKeyDeletionConfirmation, userId));
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.btn_delete,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
deleteKey(mSelectedItem);
mSelectedItem = -1;
@ -198,8 +198,8 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
}
case Id.dialog.import_keys: {
return FileDialog.build(this, "Import Keys",
"Please specify which file to import from.",
return FileDialog.build(this, getString(R.string.title_importKeys),
getString(R.string.specifyFileToImportFrom),
mImportFilename,
new FileDialog.OnClickListener() {
@ -215,8 +215,8 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
removeDialog(Id.dialog.import_keys);
}
},
getString(R.string.filemanager_title_open),
getString(R.string.filemanager_btn_open),
getString(R.string.filemanager_titleOpen),
getString(R.string.filemanager_btnOpen),
Id.request.filename);
}
@ -226,18 +226,14 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
}
case Id.dialog.export_keys: {
String title = "Export Key";
String title = (singleKeyExport ?
getString(R.string.title_exportKey) :
getString(R.string.title_exportKeys));
if (!singleKeyExport) {
// plural "Keys"
title += "s";
}
final int thisDialogId = (singleKeyExport ? Id.dialog.delete_key : Id.dialog.export_keys);
final int thisDialogId = (singleKeyExport ? Id.dialog.export_key : Id.dialog.export_keys);
return FileDialog.build(this, title,
"Please specify which file to export to.\n" +
"WARNING! You are about to export SECRET keys.\n" +
"WARNING! File will be overwritten if it exists.",
getString(R.string.specifyFileToExportSecretKeysTo),
mExportFilename,
new FileDialog.OnClickListener() {
@ -253,8 +249,8 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
removeDialog(thisDialogId);
}
},
getString(R.string.filemanager_title_save),
getString(R.string.filemanager_btn_save),
getString(R.string.filemanager_titleSave),
getString(R.string.filemanager_btnSave),
Id.request.filename);
}
@ -363,7 +359,7 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
data = Apg.exportKeyRings(this, keys, filename, this);
}
} catch (FileNotFoundException e) {
error = "file '" + filename + "' not found";
error = getString(R.string.error_fileNotFound);
} catch (IOException e) {
error = e.getMessage();
} catch (PGPException e) {
@ -410,21 +406,20 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
String error = data.getString("error");
if (error != null) {
Toast.makeText(SecretKeyListActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage, data.getString("error")),
Toast.LENGTH_SHORT).show();
} else {
int added = data.getInt("added");
int updated = data.getInt("updated");
String message;
if (added > 0 && updated > 0) {
message = "Succssfully added " + added + " keys and updated " +
updated + " keys.";
message = getString(R.string.keysAddedAndUpdated, added, updated);
} else if (added > 0) {
message = "Succssfully added " + added + " keys.";
message = getString(R.string.keysAdded, added);
} else if (updated > 0) {
message = "Succssfully updated " + updated + " keys.";
message = getString(R.string.keysUpdated, updated);
} else {
message = "No keys added or updated.";
message = getString(R.string.noKeysAddedOrUpdated);
}
Toast.makeText(SecretKeyListActivity.this, message,
Toast.LENGTH_SHORT).show();
@ -439,17 +434,17 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
String error = data.getString("error");
if (error != null) {
Toast.makeText(SecretKeyListActivity.this,
"Error: " + data.getString("error"),
getString(R.string.errorMessage, data.getString("error")),
Toast.LENGTH_SHORT).show();
} else {
int exported = data.getInt("exported");
String message;
if (exported == 1) {
message = "Succssfully exported 1 key.";
message = getString(R.string.keyExported);
} else if (exported > 0) {
message = "Succssfully exported " + exported + " keys.";
message = getString(R.string.keysExported);
} else{
message = "No keys exported.";
message = getString(R.string.noKeysExported);
}
Toast.makeText(SecretKeyListActivity.this, message,
Toast.LENGTH_SHORT).show();
@ -563,9 +558,9 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
view = mInflater.inflate(R.layout.key_list_group_item, null);
view.setBackgroundResource(android.R.drawable.list_selector_background);
TextView mainUserId = (TextView) view.findViewById(R.id.main_user_id);
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
mainUserId.setText("");
TextView mainUserIdRest = (TextView) view.findViewById(R.id.main_user_id_rest);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
mainUserIdRest.setText("");
String userId = Apg.getMainUserId(key);
@ -579,7 +574,7 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
}
if (mainUserId.getText().length() == 0) {
mainUserId.setText(R.string.unknown_user_id);
mainUserId.setText(R.string.unknownUserId);
}
if (mainUserIdRest.getText().length() == 0) {
@ -607,22 +602,22 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
view = mInflater.inflate(R.layout.key_list_child_item_sub_key, null);
}
TextView keyId = (TextView) view.findViewById(R.id.key_id);
TextView keyId = (TextView) view.findViewById(R.id.keyId);
String keyIdStr = Long.toHexString(key.getKeyID() & 0xffffffffL);
while (keyIdStr.length() < 8) {
keyIdStr = "0" + keyIdStr;
}
keyId.setText(keyIdStr);
TextView keyDetails = (TextView) view.findViewById(R.id.key_details);
TextView keyDetails = (TextView) view.findViewById(R.id.keyDetails);
String algorithmStr = Apg.getAlgorithmInfo(key);
keyDetails.setText("(" + algorithmStr + ")");
ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encrypt_key);
ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
if (!Apg.isEncryptionKey(key)) {
encryptIcon.setVisibility(View.GONE);
}
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_sign_key);
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
if (!Apg.isSigningKey(key)) {
signIcon.setVisibility(View.GONE);
}
@ -631,7 +626,7 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL
case KeyChild.USER_ID: {
view = mInflater.inflate(R.layout.key_list_child_item_user_id, null);
TextView userId = (TextView) view.findViewById(R.id.user_id);
TextView userId = (TextView) view.findViewById(R.id.userId);
userId.setText(child.userId);
break;
}

View File

@ -113,18 +113,18 @@ public class SelectPublicKeyListAdapter extends BaseAdapter {
Vector<PGPPublicKey> encryptKeys = Apg.getEncryptKeys(keyRing);
Vector<PGPPublicKey> usableKeys = Apg.getUsableEncryptKeys(keyRing);
TextView mainUserId = (TextView) view.findViewById(R.id.main_user_id);
mainUserId.setText(R.string.unknown_user_id);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.main_user_id_rest);
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
mainUserId.setText(R.string.unknownUserId);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
mainUserIdRest.setText("");
TextView keyId = (TextView) view.findViewById(R.id.key_id);
keyId.setText("<no key>");
TextView keyId = (TextView) view.findViewById(R.id.keyId);
keyId.setText(R.string.noKey);
TextView creation = (TextView) view.findViewById(R.id.creation);
creation.setText("-");
creation.setText(R.string.noDate);
TextView expiry = (TextView) view.findViewById(R.id.expiry);
expiry.setText("no expire");
expiry.setText(R.string.noExpiry);
TextView status = (TextView) view.findViewById(R.id.status);
status.setText("???");
status.setText(R.string.unknownStatus);
if (key != null) {
String userId = Apg.getMainUserId(key);
@ -147,17 +147,17 @@ public class SelectPublicKeyListAdapter extends BaseAdapter {
PGPPublicKey timespanKey = key;
if (usableKeys.size() > 0) {
timespanKey = usableKeys.get(0);
status.setText("can encrypt");
status.setText(R.string.canEncrypt);
} else if (encryptKeys.size() > 0) {
timespanKey = encryptKeys.get(0);
Date now = new Date();
if (now.compareTo(Apg.getCreationDate(timespanKey)) > 0) {
status.setText("not valid");
status.setText(R.string.notValid);
} else {
status.setText("expired");
status.setText(R.string.expired);
}
} else {
status.setText("no key");
status.setText(R.string.noKey);
}
creation.setText(DateFormat.getDateInstance().format(Apg.getCreationDate(timespanKey)));

View File

@ -134,18 +134,18 @@ public class SelectSecretKeyListActivity extends BaseActivity {
}
}
TextView mainUserId = (TextView) view.findViewById(R.id.main_user_id);
mainUserId.setText(R.string.unknown_user_id);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.main_user_id_rest);
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
mainUserId.setText(R.string.unknownUserId);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
mainUserIdRest.setText("");
TextView keyId = (TextView) view.findViewById(R.id.key_id);
keyId.setText("<no key>");
TextView keyId = (TextView) view.findViewById(R.id.keyId);
keyId.setText(R.string.noKey);
TextView creation = (TextView) view.findViewById(R.id.creation);
creation.setText("");
creation.setText(R.string.noDate);
TextView expiry = (TextView) view.findViewById(R.id.expiry);
expiry.setText("");
expiry.setText(R.string.noExpiry);
TextView status = (TextView) view.findViewById(R.id.status);
status.setText("???");
status.setText(R.string.unknownStatus);
if (key != null) {
String userId = Apg.getMainUserId(key);
@ -171,17 +171,17 @@ public class SelectSecretKeyListActivity extends BaseActivity {
PGPSecretKey timespanKey = key;
if (usableKeys.size() > 0) {
timespanKey = usableKeys.get(0);
status.setText("can sign");
status.setText(R.string.canSign);
} else if (signingKeys.size() > 0) {
timespanKey = signingKeys.get(0);
Date now = new Date();
if (now.compareTo(Apg.getCreationDate(timespanKey)) > 0) {
status.setText("not valid");
status.setText(R.string.notValid);
} else {
status.setText("expired");
status.setText(R.string.expired);
}
} else {
status.setText("no key");
status.setText(R.string.noKey);
}
creation.setText(DateFormat.getDateInstance().format(Apg.getCreationDate(timespanKey)));

View File

@ -81,17 +81,17 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
setAlwaysDrawnWithCacheEnabled(true);
mAlgorithm = (TextView) findViewById(R.id.algorithm);
mKeyId = (TextView) findViewById(R.id.key_id);
mKeyId = (TextView) findViewById(R.id.keyId);
mCreationDate = (TextView) findViewById(R.id.creation);
mExpiryDateButton = (Button) findViewById(R.id.expiry);
mUsage = (Spinner) findViewById(R.id.usage);
Choice choices[] = {
new Choice(Id.choice.usage.sign_only,
getResources().getString(R.string.sign_only)),
getResources().getString(R.string.choice_signOnly)),
new Choice(Id.choice.usage.encrypt_only,
getResources().getString(R.string.encrypt_only)),
getResources().getString(R.string.choice_encryptOnly)),
new Choice(Id.choice.usage.sign_and_encrypt,
getResources().getString(R.string.sign_and_encrypt)),
getResources().getString(R.string.choice_signAndEncrypt)),
};
ArrayAdapter<Choice> adapter =
new ArrayAdapter<Choice>(getContext(),
@ -99,7 +99,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mUsage.setAdapter(adapter);
mDeleteButton = (ImageButton) findViewById(R.id.edit_delete);
mDeleteButton = (ImageButton) findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this);
setExpiryDate(null);
@ -118,7 +118,8 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
date.get(Calendar.MONTH),
date.get(Calendar.DAY_OF_MONTH));
dialog.setCancelable(true);
dialog.setButton(Dialog.BUTTON_NEGATIVE, "None",
dialog.setButton(Dialog.BUTTON_NEGATIVE,
getContext().getString(R.string.btn_noDate),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setExpiryDate(null);
@ -154,15 +155,15 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
boolean isElGamalKey = (key.getPublicKey().getAlgorithm() == PGPPublicKey.ELGAMAL_ENCRYPT);
if (!isElGamalKey) {
choices.add(new Choice(Id.choice.usage.sign_only,
getResources().getString(R.string.sign_only)));
getResources().getString(R.string.choice_signOnly)));
}
if (!mIsMasterKey) {
choices.add(new Choice(Id.choice.usage.encrypt_only,
getResources().getString(R.string.encrypt_only)));
getResources().getString(R.string.choice_encryptOnly)));
}
if (!isElGamalKey) {
choices.add(new Choice(Id.choice.usage.sign_and_encrypt,
getResources().getString(R.string.sign_and_encrypt)));
getResources().getString(R.string.choice_signAndEncrypt)));
}
ArrayAdapter<Choice> adapter =

View File

@ -50,9 +50,6 @@ import android.widget.TextView;
import android.widget.Toast;
public class SectionView extends LinearLayout implements OnClickListener, EditorListener, Runnable {
public static final int TYPE_USER_ID = 1;
public static final int TYPE_KEY = 2;
private LayoutInflater mInflater;
private View mAdd;
private ViewGroup mEditors;
@ -82,7 +79,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
String error = data.getString("error");
if (error != null) {
Toast.makeText(getContext(),
"Error: " + error,
getContext().getString(R.string.errorMessage, error),
Toast.LENGTH_SHORT).show();
}
@ -116,12 +113,12 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
public void setType(int type) {
mType = type;
switch (type) {
case TYPE_USER_ID: {
case Id.type.user_id: {
mTitle.setText(R.string.section_userIds);
break;
}
case TYPE_KEY: {
case Id.type.key: {
mTitle.setText(R.string.section_keys);
break;
}
@ -163,7 +160,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
/** {@inheritDoc} */
public void onClick(View v) {
switch (mType) {
case TYPE_USER_ID: {
case Id.type.user_id: {
UserIdEditor view =
(UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item,
mEditors, false);
@ -175,15 +172,13 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
break;
}
case TYPE_KEY: {
case Id.type.key: {
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
View view = mInflater.inflate(R.layout.create_key, null);
dialog.setView(view);
dialog.setTitle("Create Key");
dialog.setMessage("Note: only subkeys support ElGamal, and for ElGamal " +
"the nearest keysize of 1536, 2048, 3072, 4096, or 8192 " +
"will be used");
dialog.setTitle(R.string.title_createKey);
dialog.setMessage(R.string.keyCreationElGamalInfo);
boolean wouldBeMasterKey = (mEditors.getChildCount() == 0);
@ -252,7 +247,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
}
public void setUserIds(Vector<String> list) {
if (mType != TYPE_USER_ID) {
if (mType != Id.type.user_id) {
return;
}
@ -272,7 +267,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
}
public void setKeys(Vector<PGPSecretKey> list) {
if (mType != TYPE_KEY) {
if (mType != Id.type.key) {
return;
}
@ -291,7 +286,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
private void createKey() {
mProgressDialog = new ProgressDialog(getContext());
mProgressDialog.setMessage("Generating key, this can take a while...");
mProgressDialog.setMessage(getContext().getString(R.string.progress_generating));
mProgressDialog.setCancelable(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.show();

View File

@ -81,9 +81,9 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
setDrawingCacheEnabled(true);
setAlwaysDrawnWithCacheEnabled(true);
mDeleteButton = (ImageButton) findViewById(R.id.edit_delete);
mDeleteButton = (ImageButton) findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this);
mIsMainUserId = (RadioButton) findViewById(R.id.is_main_user_id);
mIsMainUserId = (RadioButton) findViewById(R.id.isMainUserId);
mIsMainUserId.setOnClickListener(this);
mName = (EditText) findViewById(R.id.name);
@ -124,7 +124,8 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
if (email.length() > 0) {
Matcher emailMatcher = EMAIL_PATTERN.matcher(email);
if (!emailMatcher.matches()) {
throw new InvalidEmailException("invalid email '" + email + "'");
throw new InvalidEmailException(
getContext().getString(R.string.error_invalidEmail, email));
}
}