diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-04-12 19:44:00 +0200 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-06-13 19:28:22 +0300 |
commit | 2008c2608e3bc1d9a84f276d756f86d8c18b6182 (patch) | |
tree | 5220ca8424f9c0834ea8743db18e77b94650a39e | |
parent | 1a33f4d886ce45596dd7f6dfc3356fe32ec71c1c (diff) | |
download | open-keychain-2008c2608e3bc1d9a84f276d756f86d8c18b6182.tar.gz open-keychain-2008c2608e3bc1d9a84f276d756f86d8c18b6182.tar.bz2 open-keychain-2008c2608e3bc1d9a84f276d756f86d8c18b6182.zip |
started reworking the key creation
-rw-r--r-- | org_apg/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | org_apg/res/drawable/section_header.xml | 11 | ||||
-rw-r--r-- | org_apg/res/layout/create_key.xml | 89 | ||||
-rw-r--r-- | org_apg/res/layout/edit_key.xml | 76 | ||||
-rw-r--r-- | org_apg/res/layout/edit_key_key_item.xml | 97 | ||||
-rw-r--r-- | org_apg/res/layout/edit_key_section.xml | 41 | ||||
-rw-r--r-- | org_apg/res/layout/edit_key_user_id_item.xml | 86 | ||||
-rw-r--r-- | org_apg/res/layout/pass_phrase.xml | 37 | ||||
-rw-r--r-- | org_apg/res/layout/passphrase.xml | 61 | ||||
-rw-r--r-- | org_apg/res/values/colors.xml | 7 | ||||
-rw-r--r-- | org_apg/res/values/strings.xml | 33 | ||||
-rw-r--r-- | org_apg/res/values/styles.xml | 11 | ||||
-rw-r--r-- | org_apg/src/org/apg/AskForSecretKeyPassPhrase.java | 12 | ||||
-rw-r--r-- | org_apg/src/org/apg/ui/EditKeyActivity.java | 30 | ||||
-rw-r--r-- | org_apg/src/org/apg/ui/PublicKeyListActivity.java | 10 | ||||
-rw-r--r-- | org_apg/src/org/apg/ui/SecretKeyListActivity.java | 5 | ||||
-rw-r--r-- | org_apg/src/org/apg/ui/widget/SectionView.java | 27 | ||||
-rw-r--r-- | org_apg_integration_lib/src/org/apg/integration/ApgIntentHelper.java | 17 |
18 files changed, 364 insertions, 289 deletions
diff --git a/org_apg/AndroidManifest.xml b/org_apg/AndroidManifest.xml index 60c76079b..5d6ff4021 100644 --- a/org_apg/AndroidManifest.xml +++ b/org_apg/AndroidManifest.xml @@ -75,7 +75,8 @@ android:name=".ui.EditKeyActivity" android:configChanges="keyboardHidden|orientation|keyboard" android:label="@string/title_editKey" - android:uiOptions="splitActionBarWhenNarrow" > + android:uiOptions="splitActionBarWhenNarrow" + android:windowSoftInputMode="stateHidden" > <intent-filter> <action android:name="org.apg.intent.EDIT_KEY" /> diff --git a/org_apg/res/drawable/section_header.xml b/org_apg/res/drawable/section_header.xml new file mode 100644 index 000000000..a4468484e --- /dev/null +++ b/org_apg/res/drawable/section_header.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + + <size + android:height="2dp" + android:width="1000dp" /> + + <solid android:color="@color/emphasis" /> + +</shape>
\ No newline at end of file diff --git a/org_apg/res/layout/create_key.xml b/org_apg/res/layout/create_key.xml index d8ccc73ec..235d33f88 100644 --- a/org_apg/res/layout/create_key.xml +++ b/org_apg/res/layout/create_key.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> +<!-- + Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,51 +15,59 @@ limitations under the License. --> -<ScrollView - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="fill_parent" - android:layout_width="fill_parent"> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > - <TableLayout - android:layout_height="fill_parent" - android:layout_width="fill_parent" - android:stretchColumns="1" - android:layout_marginRight="?android:attr/scrollbarSize" - android:paddingLeft="6dip"> + <TableLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:stretchColumns="1" > - <TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:padding="4dp" + android:text="@string/keyCreationElGamalInfo" /> - <TextView android:id="@+id/label_algorithm" - android:text="@string/label_algorithm" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + <TableRow> - <Spinner - android:id="@+id/algorithm" - android:layout_width="fill_parent" - android:layout_height="wrap_content"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:padding="4dp" + android:text="@string/label_algorithm" /> - </TableRow> + <Spinner + android:id="@+id/create_key_algorithm" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:padding="4dp" /> + </TableRow> - <TableRow> + <TableRow> - <TextView android:id="@+id/label_size" - android:text="@string/label_keySize" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:padding="4dp" + android:text="@string/label_keySize" /> - <EditText android:id="@+id/size" - android:text="1024" - android:layout_height="wrap_content" - android:layout_width="fill_parent" - android:gravity="right" - android:numeric="integer"/> - </TableRow> + <EditText + android:id="@+id/create_key_size" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="right" + android:numeric="integer" + android:padding="4dp" + android:text="1024" /> + </TableRow> + </TableLayout> + <!-- </LinearLayout> --> - </TableLayout> - -</ScrollView> +</ScrollView>
\ No newline at end of file diff --git a/org_apg/res/layout/edit_key.xml b/org_apg/res/layout/edit_key.xml index de004f0b5..3ab5f1c52 100644 --- a/org_apg/res/layout/edit_key.xml +++ b/org_apg/res/layout/edit_key.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> +<!-- + Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,52 +15,45 @@ limitations under the License. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:paddingTop="5dip" - android:fillViewport="true"> + android:fillViewport="true" + android:orientation="vertical" > - <ScrollView + <LinearLayout android:layout_width="fill_parent" - android:layout_height="0dip" - android:layout_weight="1"> + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="16dp" + android:paddingRight="16dp" > + + <TextView + style="@style/SectionHeader" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="4dp" + android:text="@string/label_passPhrase" /> + + <CheckBox + android:id="@+id/edit_key_no_passphrase" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/label_noPassPhrase" /> + + <Button + android:id="@+id/edit_key_btn_change_pass_phrase" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="4dp" + android:text="@string/btn_setPassPhrase" /> <LinearLayout - android:id="@+id/container" + android:id="@+id/edit_key_container" android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:orientation="vertical" - android:layout_marginRight="?android:attr/scrollbarSize"> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <View - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1"/> - - <Button - android:id="@+id/btn_change_pass_phrase" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="2" - android:text="@string/btn_setPassPhrase"/> - - <View - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1"/> - - </LinearLayout> - + android:layout_height="wrap_content" + android:orientation="vertical" > </LinearLayout> + </LinearLayout> - </ScrollView> - -</LinearLayout> +</ScrollView>
\ No newline at end of file diff --git a/org_apg/res/layout/edit_key_key_item.xml b/org_apg/res/layout/edit_key_key_item.xml index 850879f64..cf816c797 100644 --- a/org_apg/res/layout/edit_key_key_item.xml +++ b/org_apg/res/layout/edit_key_key_item.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> +<!-- + Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,130 +15,120 @@ limitations under the License. --> -<org.apg.ui.widget.KeyEditor - xmlns:android="http://schemas.android.com/apk/res/android" +<org.apg.ui.widget.KeyEditor xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingLeft="5dip"> - - <View - android:id="@+id/separator" - android:layout_width="fill_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider"/> + android:orientation="vertical" > <LinearLayout - android:layout_height="wrap_content" android:layout_width="fill_parent" - android:orientation="horizontal"> + android:layout_height="wrap_content" + android:orientation="horizontal" > <TableLayout - android:layout_height="wrap_content" android:layout_width="0dip" + android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginLeft="16dip" - android:stretchColumns="1"> + android:stretchColumns="1" > <TableRow> <TextView - android:id="@+id/label_keyId" - android:text="@string/label_keyId" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + android:id="@+id/label_keyId" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="10dip" + android:text="@string/label_keyId" /> <TextView android:id="@+id/keyId" - android:text="00000000 00000000" - android:layout_height="wrap_content" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:paddingRight="5dip" - android:typeface="monospace"/> - + android:text="00000000 00000000" + android:typeface="monospace" /> </TableRow> <TableRow> <TextView android:id="@+id/label_algorithm" - android:text="@string/label_algorithm" - android:layout_height="wrap_content" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + android:paddingRight="10dip" + android:text="@string/label_algorithm" /> <TextView android:id="@+id/algorithm" - android:text="Name" - android:layout_height="wrap_content" android:layout_width="wrap_content" - android:paddingRight="5dip"/> - + android:layout_height="wrap_content" + android:paddingRight="5dip" + android:text="Name" /> </TableRow> <TableRow> <TextView android:id="@+id/label_creation" - android:text="@string/label_creation" - android:layout_height="wrap_content" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + android:paddingRight="10dip" + android:text="@string/label_creation" /> <TextView android:id="@+id/creation" android:layout_width="fill_parent" - android:layout_height="wrap_content"/> - + android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:id="@+id/label_expiry" - android:text="@string/label_expiry" - android:layout_height="wrap_content" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + android:paddingRight="10dip" + android:text="@string/label_expiry" /> <Button android:id="@+id/expiry" android:layout_width="fill_parent" - android:layout_height="wrap_content"/> - + android:layout_height="wrap_content" /> </TableRow> <TableRow> <TextView android:id="@+id/label_usage" - android:text="@string/label_usage" - android:layout_height="wrap_content" android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:paddingRight="10dip"/> + android:paddingRight="10dip" + android:text="@string/label_usage" /> <Spinner android:id="@+id/usage" android:layout_width="fill_parent" - android:layout_height="wrap_content"/> - + android:layout_height="wrap_content" /> </TableRow> - </TableLayout> <ImageButton android:id="@+id/delete" + style="@style/MinusButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - style="@style/MinusButton" - android:layout_gravity="center_vertical"/> - + android:layout_gravity="center_vertical" /> </LinearLayout> -</org.apg.ui.widget.KeyEditor> + <View + android:id="@+id/separator" + android:layout_width="fill_parent" + android:layout_height="1dip" + android:background="?android:attr/listDivider" /> + +</org.apg.ui.widget.KeyEditor>
\ No newline at end of file diff --git a/org_apg/res/layout/edit_key_section.xml b/org_apg/res/layout/edit_key_section.xml index d14748d4b..333d0b753 100644 --- a/org_apg/res/layout/edit_key_section.xml +++ b/org_apg/res/layout/edit_key_section.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> +<!-- + Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,53 +15,43 @@ limitations under the License. --> -<org.apg.ui.widget.SectionView - xmlns:android="http://schemas.android.com/apk/res/android" +<org.apg.ui.widget.SectionView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical"> - - <View - android:layout_width="fill_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider"/> + android:orientation="vertical" > <LinearLayout android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginLeft="14dip" - android:layout_marginTop="2dip" - android:layout_marginBottom="2dip" - android:orientation="horizontal" - android:gravity="center_vertical" + android:clickable="true" android:focusable="true" - android:clickable="true"> + android:gravity="center_vertical" + android:orientation="horizontal" > <TextView android:id="@+id/title" - android:text="Section Name" + style="@style/SectionHeader" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" - android:textAppearance="?android:attr/textAppearanceMedium" - android:singleLine="true" android:ellipsize="marquee" - android:fadingEdge="horizontal"/> + android:fadingEdge="horizontal" + android:singleLine="true" + android:text="Section Name" /> <ImageView + style="@style/PlusButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:duplicateParentState="true" - style="@style/PlusButton"/> - + android:duplicateParentState="true" /> </LinearLayout> <LinearLayout android:id="@+id/editors" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:paddingBottom="6dip" - android:orientation="vertical"/> + android:orientation="vertical" + android:paddingBottom="6dip" /> -</org.apg.ui.widget.SectionView> +</org.apg.ui.widget.SectionView>
\ No newline at end of file diff --git a/org_apg/res/layout/edit_key_user_id_item.xml b/org_apg/res/layout/edit_key_user_id_item.xml index 6e7b552dd..1961cf109 100644 --- a/org_apg/res/layout/edit_key_user_id_item.xml +++ b/org_apg/res/layout/edit_key_user_id_item.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> +<!-- + Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,102 +15,93 @@ limitations under the License. --> -<org.apg.ui.widget.UserIdEditor - xmlns:android="http://schemas.android.com/apk/res/android" +<org.apg.ui.widget.UserIdEditor xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingLeft="5dip"> - - <View - android:id="@+id/separator" - android:layout_width="fill_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider"/> + android:orientation="vertical" > <RadioButton android:id="@+id/isMainUserId" - android:text="@string/label_mainUserId" - android:layout_height="wrap_content" android:layout_width="wrap_content" - android:layout_marginLeft="20dip"/> + android:layout_height="wrap_content" + android:text="@string/label_mainUserId" /> <LinearLayout - android:layout_height="wrap_content" android:layout_width="fill_parent" - android:orientation="horizontal"> + android:layout_height="wrap_content" + android:orientation="horizontal" > <TableLayout - android:layout_height="wrap_content" android:layout_width="0dip" - android:layout_weight="1" - android:layout_marginLeft="16dip"> + android:layout_height="wrap_content" + android:layout_weight="1" > <TableRow> <TextView android:id="@+id/label_name" - android:text="@string/label_name" - android:layout_gravity="center_vertical" - android:layout_height="wrap_content" android:layout_width="wrap_content" - android:paddingRight="5dip"/> + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="5dip" + android:text="@string/label_name" /> <EditText android:id="@+id/name" - android:layout_weight="1" - android:layout_height="wrap_content" android:layout_width="fill_parent" - android:inputType="textPersonName|textCapWords"/> - + android:layout_height="wrap_content" + android:layout_weight="1" + android:inputType="textPersonName|textCapWords" /> </TableRow> <TableRow> <TextView android:id="@+id/label_email" - android:text="@string/label_email" - android:layout_gravity="center_vertical" - android:layout_height="wrap_content" android:layout_width="wrap_content" - android:paddingRight="5dip"/> + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="5dip" + android:text="@string/label_email" /> <EditText android:id="@+id/email" - android:layout_weight="1" - android:layout_height="wrap_content" android:layout_width="fill_parent" - android:inputType="textEmailAddress"/> - + android:layout_height="wrap_content" + android:layout_weight="1" + android:inputType="textEmailAddress" /> </TableRow> <TableRow> <TextView android:id="@+id/label_comment" - android:text="@string/label_comment" - android:layout_gravity="center_vertical" - android:layout_height="wrap_content" android:layout_width="wrap_content" - android:paddingRight="5dip"/> + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:paddingRight="5dip" + android:text="@string/label_comment" /> <EditText android:id="@+id/comment" - android:layout_weight="1" + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_width="fill_parent"/> - + android:layout_weight="1" /> </TableRow> - </TableLayout> <ImageButton android:id="@+id/delete" + style="@style/MinusButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - style="@style/MinusButton" - android:layout_gravity="center_vertical"/> - + android:layout_gravity="center_vertical" /> </LinearLayout> -</org.apg.ui.widget.UserIdEditor> + <View + android:id="@+id/separator" + android:layout_width="fill_parent" + android:layout_height="1dip" + android:background="?android:attr/listDivider" /> + +</org.apg.ui.widget.UserIdEditor>
\ No newline at end of file diff --git a/org_apg/res/layout/pass_phrase.xml b/org_apg/res/layout/pass_phrase.xml deleted file mode 100644 index d66ffca07..000000000 --- a/org_apg/res/layout/pass_phrase.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingLeft="5dip" - android:paddingRight="5dip"> - - <EditText - android:id="@+id/passPhrase" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:inputType="textPassword"/> - - <EditText - android:id="@+id/passPhraseAgain" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:inputType="textPassword"/> - -</LinearLayout> diff --git a/org_apg/res/layout/passphrase.xml b/org_apg/res/layout/passphrase.xml new file mode 100644 index 000000000..73a085588 --- /dev/null +++ b/org_apg/res/layout/passphrase.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2010 Thialfihar <thi@thialfihar.org> + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:stretchColumns="1" > + + <TableRow> + + <TextView + android:id="@+id/passphrase_label_passphrase" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:padding="4dp" + android:text="@string/label_passPhrase" /> + + <EditText + android:id="@+id/passphrase_passphrase" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:inputType="textPassword" + android:padding="4dp" /> + </TableRow> + + <TableRow> + + <TextView + android:id="@+id/passphrase_label_passphrase_again" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:padding="4dp" + android:text="@string/label_passPhraseAgain" /> + + <EditText + android:id="@+id/passphrase_passphrase_again" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:inputType="textPassword" + android:padding="4dp" /> + </TableRow> + +</TableLayout>
\ No newline at end of file diff --git a/org_apg/res/values/colors.xml b/org_apg/res/values/colors.xml new file mode 100644 index 000000000..d1dc6c1f4 --- /dev/null +++ b/org_apg/res/values/colors.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <color name="emphasis">#31b6e7</color> + <color name="bg_gray">#cecbce</color> + +</resources>
\ No newline at end of file diff --git a/org_apg/res/values/strings.xml b/org_apg/res/values/strings.xml index 8d3a89d09..a56e7de28 100644 --- a/org_apg/res/values/strings.xml +++ b/org_apg/res/values/strings.xml @@ -25,13 +25,13 @@ <string name="title_selectSignature">Select Signature</string> <string name="title_encrypt">Encrypt</string> <string name="title_decrypt">Decrypt</string> - <string name="title_authentication">Pass Phrase</string> + <string name="title_authentication">Passphrase</string> <string name="title_createKey">Create Key</string> <string name="title_editKey">Edit Key</string> <string name="title_preferences">Preferences</string> <string name="title_keyServerPreference">Key Server Preference</string> - <string name="title_changePassPhrase">Change Pass Phrase</string> - <string name="title_setPassPhrase">Set Pass Phrase</string> + <string name="title_changePassPhrase">Change Passphrase</string> + <string name="title_setPassPhrase">Set Passphrase</string> <string name="title_sendEmail">"Send Mail..."</string> <string name="title_encryptToFile">Encrypt To File</string> <string name="title_decryptToFile">Decrypt To File</string> @@ -76,8 +76,8 @@ <string name="btn_noDate">None</string> <string name="btn_okay">Okay</string> <string name="btn_clearFilter">Clear Filter</string> - <string name="btn_changePassPhrase">Change Pass Phrase</string> - <string name="btn_setPassPhrase">Set Pass Phrase</string> + <string name="btn_changePassPhrase">Change Passphrase</string> + <string name="btn_setPassPhrase">Set Passphrase</string> <string name="btn_search">Search</string> <string name="btn_export_to_server">Export To Server</string> @@ -106,7 +106,8 @@ <string name="label_sign">Sign</string> <string name="label_message">Message</string> <string name="label_file">File</string> - <string name="label_passPhrase">Pass Phrase</string> + <string name="label_noPassPhrase">No Passphrase</string> + <string name="label_passPhrase">Passphrase</string> <string name="label_passPhraseAgain">Again</string> <string name="label_algorithm">Algorithm</string> <string name="label_asciiArmour">ASCII Armour</string> @@ -117,8 +118,8 @@ <string name="label_encryptionAlgorithm">Encryption Algorithm</string> <string name="label_hashAlgorithm">Hash Algorithm</string> <string name="label_asymmetric">Public Key</string> - <string name="label_symmetric">Pass Phrase</string> - <string name="label_passPhraseCacheTtl">Pass Phrase Cache</string> + <string name="label_symmetric">Passphrase</string> + <string name="label_passPhraseCacheTtl">Passphrase Cache</string> <string name="label_messageCompression">Message Compression</string> <string name="label_fileCompression">File Compression</string> <string name="label_forceV3Signature">Force V3 Signatures</string> @@ -182,13 +183,13 @@ <string name="errorMessage">Error: %s</string> <!-- sentences --> - <string name="wrongPassPhrase">Wrong pass phrase.</string> + <string name="wrongPassPhrase">Wrong passphrase.</string> <string name="usingClipboardContent">Using clipboard content.</string> <string name="keySaved">Key saved.</string> - <string name="setAPassPhrase">Set a pass phrase first.</string> + <string name="setAPassPhrase">Set a passphrase first.</string> <string name="noFilemanagerInstalled">No compatible file manager installed.</string> - <string name="passPhrasesDoNotMatch">The pass phrases didn\'t match.</string> - <string name="passPhraseMustNotBeEmpty">Empty pass phrases are not allowed.</string> + <string name="passPhrasesDoNotMatch">The passphrases didn\'t match.</string> + <string name="passPhraseMustNotBeEmpty">Empty passphrases are not allowed.</string> <string name="passPhraseForSymmetricEncryption">Symmetric encryption.</string> <string name="passPhraseFor">%s</string> <string name="fileDeleteConfirmation">Are you sure you want to delete\n%s?</string> @@ -197,7 +198,7 @@ <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="enterPassPhraseTwice">Enter the passphrase 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> @@ -246,14 +247,14 @@ <string name="error_mainUserIdMustNotBeEmpty">main user id must not be empty</string> <string name="error_keyNeedsMasterKey">need at least a master key</string> <string name="error_expiryMustComeAfterCreation">expiry date must come after creation date</string> - <string name="error_noEncryptionKeysOrPassPhrase">no encryption key(s) or pass phrase given</string> + <string name="error_noEncryptionKeysOrPassPhrase">no encryption key(s) or passphrase given</string> <string name="error_signatureFailed">signature failed</string> - <string name="error_noSignaturePassPhrase">no pass phrase given</string> + <string name="error_noSignaturePassPhrase">no passphrase given</string> <string name="error_noSignatureKey">no signature key given</string> <string name="error_invalidData">not valid encryption data</string> <string name="error_corruptData">corrupt data</string> <string name="error_noSymmetricEncryptionPacket">couldn\'t find a packet with symmetric encryption</string> - <string name="error_wrongPassPhrase">wrong pass phrase</string> + <string name="error_wrongPassPhrase">wrong passphrase</string> <string name="error_savingKeys">error saving some key(s)</string> <string name="error_couldNotExtractPrivateKey">could not extract private key</string> diff --git a/org_apg/res/values/styles.xml b/org_apg/res/values/styles.xml index 7e4572c31..ef3ff63f6 100644 --- a/org_apg/res/values/styles.xml +++ b/org_apg/res/values/styles.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- + Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de> Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,4 +39,14 @@ <item name="android:background">@android:color/transparent</item> </style> + <style name="SectionHeader"> + <item name="android:drawableBottom">@drawable/section_header</item> + <item name="android:drawablePadding">4dp</item> + <item name="android:layout_marginTop">8dp</item> + <item name="android:paddingLeft">4dp</item> + <item name="android:textAllCaps">true</item> + <item name="android:textColor">@color/emphasis</item> + <item name="android:textSize">14sp</item> + </style> + </resources>
\ No newline at end of file diff --git a/org_apg/src/org/apg/AskForSecretKeyPassPhrase.java b/org_apg/src/org/apg/AskForSecretKeyPassPhrase.java index ebed75667..5c55321c6 100644 --- a/org_apg/src/org/apg/AskForSecretKeyPassPhrase.java +++ b/org_apg/src/org/apg/AskForSecretKeyPassPhrase.java @@ -31,6 +31,7 @@ import android.content.DialogInterface.OnClickListener; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; +import android.widget.TextView; import android.widget.Toast; public class AskForSecretKeyPassPhrase { @@ -69,9 +70,14 @@ public class AskForSecretKeyPassPhrase { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View view = inflater.inflate(R.layout.pass_phrase, null); - final EditText input = (EditText) view.findViewById(R.id.passPhrase); - final EditText inputNotUsed = (EditText) view.findViewById(R.id.passPhraseAgain); + View view = inflater.inflate(R.layout.passphrase, null); + final EditText input = (EditText) view.findViewById(R.id.passphrase_passphrase); + + final TextView labelNotUsed = (TextView) view + .findViewById(R.id.passphrase_label_passphrase_again); + labelNotUsed.setVisibility(View.GONE); + final EditText inputNotUsed = (EditText) view + .findViewById(R.id.passphrase_passphrase_again); inputNotUsed.setVisibility(View.GONE); alert.setView(view); diff --git a/org_apg/src/org/apg/ui/EditKeyActivity.java b/org_apg/src/org/apg/ui/EditKeyActivity.java index b0e59a7bf..e00cb7d24 100644 --- a/org_apg/src/org/apg/ui/EditKeyActivity.java +++ b/org_apg/src/org/apg/ui/EditKeyActivity.java @@ -1,4 +1,5 @@ /* + * Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de> * Copyright (C) 2010 Thialfihar <thi@thialfihar.org> * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,9 +45,13 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; import android.widget.EditText; import android.widget.LinearLayout; +import android.widget.TableRow; import android.widget.Toast; +import android.widget.CompoundButton.OnCheckedChangeListener; import java.io.IOException; import java.security.NoSuchAlgorithmException; @@ -149,17 +154,32 @@ public class EditKeyActivity extends BaseActivity { } } - mChangePassPhrase = (Button) findViewById(R.id.btn_change_pass_phrase); + mChangePassPhrase = (Button) findViewById(R.id.edit_key_btn_change_pass_phrase); mChangePassPhrase.setOnClickListener(new OnClickListener() { public void onClick(View v) { showDialog(Id.dialog.new_pass_phrase); } }); + // disable passphrase when no passphrase checkobox is checked! + final CheckBox noPassphrase = (CheckBox) findViewById(R.id.edit_key_no_passphrase); + noPassphrase.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + mChangePassPhrase.setVisibility(View.GONE); + } else { + mChangePassPhrase.setVisibility(View.VISIBLE); + } + + } + }); + // Build layout based on given userIds and keys LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); - LinearLayout container = (LinearLayout) findViewById(R.id.container); + LinearLayout container = (LinearLayout) findViewById(R.id.edit_key_container); mUserIds = (SectionView) inflater.inflate(R.layout.edit_key_section, container, false); mUserIds.setType(Id.type.user_id); mUserIds.setUserIds(userIds); @@ -203,9 +223,9 @@ public class EditKeyActivity extends BaseActivity { alert.setMessage(R.string.enterPassPhraseTwice); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View view = inflater.inflate(R.layout.pass_phrase, null); - final EditText input1 = (EditText) view.findViewById(R.id.passPhrase); - final EditText input2 = (EditText) view.findViewById(R.id.passPhraseAgain); + View view = inflater.inflate(R.layout.passphrase, null); + final EditText input1 = (EditText) view.findViewById(R.id.passphrase_passphrase); + final EditText input2 = (EditText) view.findViewById(R.id.passphrase_passphrase_again); alert.setView(view); diff --git a/org_apg/src/org/apg/ui/PublicKeyListActivity.java b/org_apg/src/org/apg/ui/PublicKeyListActivity.java index e963a2029..5759350ec 100644 --- a/org_apg/src/org/apg/ui/PublicKeyListActivity.java +++ b/org_apg/src/org/apg/ui/PublicKeyListActivity.java @@ -53,12 +53,10 @@ public class PublicKeyListActivity extends KeyListActivity { .setIcon(R.drawable.ic_menu_search_list) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - menu.add(0, Id.menu.option.import_keys, 3, R.string.menu_importKeys) - // .setIcon(R.drawable.ic_suggestions_add) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - menu.add(0, Id.menu.option.export_keys, 4, R.string.menu_exportKeys) - // .setIcon(R.drawable.ic_menu_share_holo_light) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + menu.add(0, Id.menu.option.import_keys, 3, R.string.menu_importKeys).setShowAsAction( + MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + menu.add(0, Id.menu.option.export_keys, 4, R.string.menu_exportKeys).setShowAsAction( + MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; } diff --git a/org_apg/src/org/apg/ui/SecretKeyListActivity.java b/org_apg/src/org/apg/ui/SecretKeyListActivity.java index 5359aec8f..2e46ebcd4 100644 --- a/org_apg/src/org/apg/ui/SecretKeyListActivity.java +++ b/org_apg/src/org/apg/ui/SecretKeyListActivity.java @@ -49,17 +49,14 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(3, Id.menu.option.search, 0, R.string.menu_search) - .setIcon(R.drawable.ic_menu_search_list) + .setIcon(R.drawable.ic_menu_search) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(1, Id.menu.option.create, 1, R.string.menu_createKey) - // .setIcon(R.drawable.ic_suggestions_add) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add(0, Id.menu.option.import_keys, 2, R.string.menu_importKeys) - // .setIcon(R.drawable.ic_menu_find_holo_light) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add(0, Id.menu.option.export_keys, 3, R.string.menu_exportKeys) - // .setIcon(R.drawable.ic_menu_find_holo_light) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; diff --git a/org_apg/src/org/apg/ui/widget/SectionView.java b/org_apg/src/org/apg/ui/widget/SectionView.java index 565ccb241..c62e84c03 100644 --- a/org_apg/src/org/apg/ui/widget/SectionView.java +++ b/org_apg/src/org/apg/ui/widget/SectionView.java @@ -37,9 +37,13 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; +import android.widget.TableRow; import android.widget.TextView; import android.widget.Toast; @@ -176,11 +180,10 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor View view = mInflater.inflate(R.layout.create_key, null); dialog.setView(view); dialog.setTitle(R.string.title_createKey); - dialog.setMessage(R.string.keyCreationElGamalInfo); boolean wouldBeMasterKey = (mEditors.getChildCount() == 0); - final Spinner algorithm = (Spinner) view.findViewById(R.id.algorithm); + final Spinner algorithm = (Spinner) view.findViewById(R.id.create_key_algorithm); Vector<Choice> choices = new Vector<Choice>(); choices.add(new Choice(Id.choice.algorithm.dsa, getResources().getString(R.string.dsa))); if (!wouldBeMasterKey) { @@ -202,7 +205,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor } } - final EditText keySize = (EditText) view.findViewById(R.id.size); + final EditText keySize = (EditText) view.findViewById(R.id.create_key_size); dialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface di, int id) { @@ -275,6 +278,24 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor this.updateEditorsVisible(); } + // TODO !!! + public void createInitialKey() { + mEditors.removeAllViews(); + + // create initial key + // PGPSecretKey key = new PGPSecretKey(); + + // for (PGPSecretKey key : list) { + KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item, mEditors, false); + view.setEditorListener(this); + boolean isMasterKey = (mEditors.getChildCount() == 0); + // view.setValue(key, isMasterKey); + mEditors.addView(view); + // } + + this.updateEditorsVisible(); + } + private void createKey() { mProgressDialog = new ProgressDialog(getContext()); mProgressDialog.setMessage(getContext().getString(R.string.progress_generating)); diff --git a/org_apg_integration_lib/src/org/apg/integration/ApgIntentHelper.java b/org_apg_integration_lib/src/org/apg/integration/ApgIntentHelper.java index a03e74d2b..8c4c0a538 100644 --- a/org_apg_integration_lib/src/org/apg/integration/ApgIntentHelper.java +++ b/org_apg_integration_lib/src/org/apg/integration/ApgIntentHelper.java @@ -40,7 +40,7 @@ public class ApgIntentHelper { * * @param userIds * value to specify prefilled values for user that should be created - * @return true when user presses save, false when user presses cancel + * @return true when activity was found and executed successfully */ public boolean createNewKey(String userIds) { Intent intent = new Intent(Constants.Intent.EDIT_KEY); @@ -60,7 +60,7 @@ public class ApgIntentHelper { /** * Opens APG activity to create new key * - * @return true when user presses save, false when user presses cancel + * @return true when activity was found and executed successfully */ public boolean createNewKey() { return createNewKey(null); @@ -70,7 +70,7 @@ public class ApgIntentHelper { * Opens APG activity to edit already existing key based on keyId * * @param keyId - * @return true when user presses save, false when user presses cancel + * @return true when activity was found and executed successfully */ public boolean editKey(long keyId) { Intent intent = new Intent(Constants.Intent.EDIT_KEY); @@ -88,7 +88,7 @@ public class ApgIntentHelper { /** * Opens APG activity to select the signature key. * - * @return true when user presses okay, false when user presses cancel + * @return true when activity was found and executed successfully */ public boolean selectSecretKey() { Intent intent = new Intent(Constants.Intent.SELECT_SECRET_KEY); @@ -112,7 +112,7 @@ public class ApgIntentHelper { * long[] that holds the ids of the encryption keys * @param signatureKeyId * id of the signature key - * @return + * @return true when activity was found and executed successfully */ public boolean encrypt(String data, long[] encryptionKeyIds, long signatureKeyId) { Intent intent = new Intent(Constants.Intent.ENCRYPT_AND_RETURN); @@ -136,7 +136,7 @@ public class ApgIntentHelper { * @param activity * @param data * @param pgpData - * @return success or failure + * @return true when activity was found and executed successfully */ public boolean decrypt(String data) { Intent intent = new Intent(Constants.Intent.DECRYPT_AND_RETURN); @@ -168,6 +168,7 @@ public class ApgIntentHelper { switch (requestCode) { case Constants.SELECT_SECRET_KEY: if (resultCode != Activity.RESULT_OK || data == null) { + // user canceled! break; } apgData.setSignatureKeyId(data.getLongExtra(Constants.EXTRA_KEY_ID, 0)); @@ -225,7 +226,7 @@ public class ApgIntentHelper { * * @param emails * The emails that should be used for preselection. - * @return false when activity could not be found! + * @return true when activity was found and executed successfully */ public boolean selectEncryptionKeys(String emails) { return selectEncryptionKeys(emails, null); @@ -238,7 +239,7 @@ public class ApgIntentHelper { * The emails that should be used for preselection. * @param apgData * ApgData with encryption keys and signature keys preselected - * @return false when activity could not be found! + * @return true when activity was found and executed successfully */ public boolean selectEncryptionKeys(String emails, ApgData apgData) { Intent intent = new Intent(Constants.Intent.SELECT_PUBLIC_KEYS); |