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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,6 +16,8 @@
<resources> <resources>
<string name="app_name">APG</string> <string name="app_name">APG</string>
<!-- title_lowerCase: capitalized words, no punctuation -->
<string name="title_mailInbox">Mail Inbox</string> <string name="title_mailInbox">Mail Inbox</string>
<string name="title_managePublicKeys">Manage Public Keys</string> <string name="title_managePublicKeys">Manage Public Keys</string>
<string name="title_manageSecretKeys">Manage Secret Keys</string> <string name="title_manageSecretKeys">Manage Secret Keys</string>
@ -27,11 +29,23 @@
<string name="title_createKey">Create Key</string> <string name="title_createKey">Create Key</string>
<string name="title_editKey">Edit Key</string> <string name="title_editKey">Edit Key</string>
<string name="title_preferences">Preferences</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_userIds">User IDs</string>
<string name="section_keys">Keys</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_send">Encrypt And Email</string>
<string name="btn_encrypt">Encrypt</string> <string name="btn_encrypt">Encrypt</string>
<string name="btn_decrypt">Decrypt</string> <string name="btn_decrypt">Decrypt</string>
@ -44,55 +58,128 @@
<string name="btn_decryptFile">Decrypt File</string> <string name="btn_decryptFile">Decrypt File</string>
<string name="btn_save">Save</string> <string name="btn_save">Save</string>
<string name="btn_doNotSave">Cancel</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_about">About</string>
<string name="menu_addAccount">Add GMail Account</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_managePublicKeys">Manage Public Keys</string>
<string name="menu_manageSecretKeys">Manage Secret Keys</string> <string name="menu_manageSecretKeys">Manage Secret Keys</string>
<string name="menu_preferences">Settings</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> <!-- label_lowerCase: capitalized words, no punctuation -->
<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>
<string name="label_sign">Sign</string> <string name="label_sign">Sign</string>
<string name="label_message">Message</string> <string name="label_message">Message</string>
<string name="label_file">File</string> <string name="label_file">File</string>
<string name="label_pass_phrase">Pass Phrase</string> <string name="label_passPhrase">Pass Phrase</string>
<string name="label_pass_phrase_again">Again</string> <string name="label_passPhraseAgain">Again</string>
<string name="label_algorithm">Algorithm</string> <string name="label_algorithm">Algorithm</string>
<string name="label_ascii_armour">ASCII Armour</string> <string name="label_asciiArmour">ASCII Armour</string>
<string name="label_select_public_keys">Public Key(s)</string> <string name="label_selectPublicKeys">Public Key(s)</string>
<string name="label_delete_after_encryption">Delete After Encryption</string> <string name="label_deleteAfterEncryption">Delete After Encryption</string>
<string name="label_delete_after_decryption">Delete After Decryption</string> <string name="label_deleteAfterDecryption">Delete After Decryption</string>
<string name="label_encryption_algorithm">Encryption Algorithm</string> <string name="label_encryptionAlgorithm">Encryption Algorithm</string>
<string name="label_hash_algorithm">Hash Algorithm</string> <string name="label_hashAlgorithm">Hash Algorithm</string>
<string name="label_asymmetric">Public Key</string> <string name="label_asymmetric">Public Key</string>
<string name="label_symmetric">Pass Phrase</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> <!-- choice_lowerCase: capitalized firwst word, no punctuation -->
<string name="encrypt_only">Encrypt only</string> <string name="choice_signOnly">Sign only</string>
<string name="sign_and_encrypt">Sign and Encrypt</string> <string name="choice_encryptOnly">Encrypt only</string>
<string name="choice_signAndEncrypt">Sign and Encrypt</string>
<string name="dsa">DSA</string> <string name="dsa">DSA</string>
<string name="elgamal">ElGamal</string> <string name="elgamal">ElGamal</string>
<string name="rsa">RSA</string> <string name="rsa">RSA</string>
<string name="wrong_pass_phrase">Wrong pass phrase.</string> <string name="filemanager_titleOpen">Open...</string>
<string name="using_clipboard_content">Using clipboard content.</string> <string name="filemanager_titleSave">Save As...</string>
<string name="key_saved">Key saved.</string> <string name="filemanager_titleEncrypt">Select File To Encrypt...</string>
<string name="set_a_pass_phrase">Set a pass phrase via the option menu first.</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="warning">Warning</string>
<string name="filemanager_title_open">Open...</string> <string name="error">Error</string>
<string name="filemanager_btn_open">Open</string> <string name="warningMessage">Warning: %s</string>
<string name="filemanager_title_save">Save As...</string> <string name="errorMessage">Error: %s</string>
<string name="filemanager_btn_save">Save</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> </resources>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -113,7 +113,7 @@ public class FileDialog {
mActivity.startActivityForResult(intent, mRequestCode); mActivity.startActivityForResult(intent, mRequestCode);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
// No compatible file manager was found. // 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 class type {
public static final int public_key = 0x21070001; public static final int public_key = 0x21070001;
public static final int secret_key = 0x21070002; 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 { public static final class choice {

View file

@ -196,7 +196,7 @@ public class MailListActivity extends ListActivity {
Message message = (Message) getItem(position); Message message = (Message) getItem(position);
TextView subject = (TextView) view.findViewById(R.id.subject); 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); ImageView status = (ImageView) view.findViewById(R.id.ic_status);
subject.setText(message.subject); subject.setText(message.subject);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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