further ui developments
@@ -30,7 +30,7 @@
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Sherlock.Light" >
|
||||
android:theme="@style/Theme.Sherlock.Light.ForceOverflow" >
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
@@ -45,7 +45,8 @@
|
||||
android:name=".ui.PublicKeyListActivity"
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
android:label="@string/title_managePublicKeys"
|
||||
android:launchMode="singleTop" >
|
||||
android:launchMode="singleTop"
|
||||
android:uiOptions="splitActionBarWhenNarrow" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
@@ -58,7 +59,8 @@
|
||||
android:name=".ui.SecretKeyListActivity"
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
android:label="@string/title_manageSecretKeys"
|
||||
android:launchMode="singleTop" >
|
||||
android:launchMode="singleTop"
|
||||
android:uiOptions="splitActionBarWhenNarrow" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
@@ -110,7 +112,8 @@
|
||||
<activity
|
||||
android:name=".ui.EncryptActivity"
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
android:label="@string/title_encrypt" >
|
||||
android:label="@string/title_encrypt"
|
||||
android:uiOptions="splitActionBarWhenNarrow" >
|
||||
<intent-filter>
|
||||
<action android:name="org.apg.intent.ENCRYPT" />
|
||||
<action android:name="org.apg.intent.ENCRYPT_FILE" />
|
||||
@@ -125,7 +128,8 @@
|
||||
<activity
|
||||
android:name=".ui.DecryptActivity"
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
android:label="@string/title_decrypt" >
|
||||
android:label="@string/title_decrypt"
|
||||
android:uiOptions="splitActionBarWhenNarrow" >
|
||||
<intent-filter>
|
||||
<action android:name="org.apg.intent.DECRYPT" />
|
||||
<action android:name="org.apg.intent.DECRYPT_FILE" />
|
||||
@@ -200,7 +204,7 @@
|
||||
android:name=".ui.AboutActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:label="@string/title_about"
|
||||
android:theme="@android:style/Theme.Dialog" />
|
||||
android:theme="@style/Theme.Sherlock.Light.Dialog" />
|
||||
|
||||
<service android:name=".Service" />
|
||||
<service
|
||||
|
||||
BIN
org_apg/res/drawable-hdpi/create_contact.png
Normal file
|
After Width: | Height: | Size: 956 B |
BIN
org_apg/res/drawable-hdpi/dashboard_decrypt_default.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
org_apg/res/drawable-hdpi/dashboard_decrypt_pressed.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
org_apg/res/drawable-hdpi/dashboard_encrypt_default.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
org_apg/res/drawable-hdpi/dashboard_encrypt_pressed.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
BIN
org_apg/res/drawable-hdpi/dashboard_scan_qrcode_default.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
org_apg/res/drawable-hdpi/dashboard_scan_qrcode_pressed.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_find_holo_light.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_search_holo_light.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_settings_holo_light.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_share_holo_light.png
Normal file
|
After Width: | Height: | Size: 505 B |
BIN
org_apg/res/drawable-hdpi/ic_suggestions_add.png
Normal file
|
After Width: | Height: | Size: 373 B |
BIN
org_apg/res/drawable-hdpi/ic_suggestions_delete.png
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
org_apg/res/drawable-mdpi/create_contact.png
Normal file
|
After Width: | Height: | Size: 689 B |
BIN
org_apg/res/drawable-mdpi/ic_menu_find_holo_light.png
Normal file
|
After Width: | Height: | Size: 863 B |
BIN
org_apg/res/drawable-mdpi/ic_menu_search_holo_light.png
Normal file
|
After Width: | Height: | Size: 858 B |
BIN
org_apg/res/drawable-mdpi/ic_menu_settings_holo_light.png
Normal file
|
After Width: | Height: | Size: 866 B |
BIN
org_apg/res/drawable-mdpi/ic_menu_share_holo_light.png
Normal file
|
After Width: | Height: | Size: 355 B |
BIN
org_apg/res/drawable-mdpi/ic_suggestions_add.png
Normal file
|
After Width: | Height: | Size: 359 B |
BIN
org_apg/res/drawable-mdpi/ic_suggestions_delete.png
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
org_apg/res/drawable-xhdpi/create_contact.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_find_holo_light.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_search_holo_light.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_settings_holo_light.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_share_holo_light.png
Normal file
|
After Width: | Height: | Size: 935 B |
BIN
org_apg/res/drawable-xhdpi/ic_suggestions_add.png
Normal file
|
After Width: | Height: | Size: 419 B |
BIN
org_apg/res/drawable-xhdpi/ic_suggestions_delete.png
Normal file
|
After Width: | Height: | Size: 771 B |
@@ -14,15 +14,15 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_file_pressed"
|
||||
<item android:drawable="@drawable/dashboard_decrypt_pressed"
|
||||
android:state_focused="true"
|
||||
android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_file_pressed"
|
||||
<item android:drawable="@drawable/dashboard_decrypt_pressed"
|
||||
android:state_focused="false"
|
||||
android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_file_pressed"
|
||||
<item android:drawable="@drawable/dashboard_decrypt_pressed"
|
||||
android:state_focused="true" />
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_file_default"
|
||||
<item android:drawable="@drawable/dashboard_decrypt_default"
|
||||
android:state_focused="false"
|
||||
android:state_pressed="false" />
|
||||
</selector>
|
||||
@@ -14,15 +14,15 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_text_pressed"
|
||||
<item android:drawable="@drawable/dashboard_encrypt_pressed"
|
||||
android:state_focused="true"
|
||||
android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_text_pressed"
|
||||
<item android:drawable="@drawable/dashboard_encrypt_pressed"
|
||||
android:state_focused="false"
|
||||
android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_text_pressed"
|
||||
<item android:drawable="@drawable/dashboard_encrypt_pressed"
|
||||
android:state_focused="true" />
|
||||
<item android:drawable="@drawable/dashboard_encrypt_decrypt_text_default"
|
||||
<item android:drawable="@drawable/dashboard_encrypt_default"
|
||||
android:state_focused="false"
|
||||
android:state_pressed="false" />
|
||||
</selector>
|
||||
28
org_apg/res/drawable/dashboard_scan_qrcode.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<!--
|
||||
Copyright 2011 Google Inc.
|
||||
|
||||
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.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/dashboard_scan_qrcode_pressed"
|
||||
android:state_focused="true"
|
||||
android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/dashboard_scan_qrcode_pressed"
|
||||
android:state_focused="false"
|
||||
android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/dashboard_scan_qrcode_pressed"
|
||||
android:state_focused="true" />
|
||||
<item android:drawable="@drawable/dashboard_scan_qrcode_default"
|
||||
android:state_focused="false"
|
||||
android:state_pressed="false" />
|
||||
</selector>
|
||||
@@ -8,9 +8,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:isScrollContainer="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:padding="15dp"
|
||||
android:scrollbars="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -1,382 +1,348 @@
|
||||
<?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. 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. -->
|
||||
|
||||
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"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="5dip">
|
||||
android:paddingTop="5dip" >
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
android:fillViewport="true"
|
||||
android:padding="10dip" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="5dip">
|
||||
android:layout_marginLeft="5dip"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sourcePrevious"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_previous"/>
|
||||
android:src="@drawable/ic_previous" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sourceLabel"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/label_message"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:textColor="#ffffffff"/>
|
||||
android:text="@string/label_message"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sourceNext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_next"/>
|
||||
|
||||
android:src="@drawable/ic_next" />
|
||||
</LinearLayout>
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/source"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1">
|
||||
android:layout_weight="1" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sourceMessage"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/message"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="top"
|
||||
android:inputType="text|textCapSentences|textMultiLine|textLongMessage"/>
|
||||
|
||||
android:inputType="text|textCapSentences|textMultiLine|textLongMessage" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sourceFile"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/filename"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_browse"
|
||||
android:src="@drawable/ic_launcher_folder_small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_fileCompression"
|
||||
android:text="@string/label_fileCompression"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/fileCompression"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
android:src="@drawable/ic_launcher_folder_small" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_fileCompression"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_fileCompression"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/fileCompression"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_deleteAfterEncryption"
|
||||
android:text="@string/label_deleteAfterEncryption"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_deleteAfterEncryption"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/deleteAfterEncryption"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_asciiArmour"
|
||||
android:text="@string/label_asciiArmour"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_asciiArmour"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/asciiArmour"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ViewFlipper>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="?android:attr/listDivider"
|
||||
android:layout_marginBottom="5dip"/>
|
||||
android:layout_marginBottom="5dip"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/modePrevious"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_previous"/>
|
||||
android:src="@drawable/ic_previous" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/modeLabel"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/label_asymmetric"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:textColor="#ffffffff"/>
|
||||
android:text="@string/label_asymmetric"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/modeNext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_next"/>
|
||||
|
||||
android:src="@drawable/ic_next" />
|
||||
</LinearLayout>
|
||||
|
||||
<ViewFlipper
|
||||
android:id="@+id/mode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/modeAsymmetric"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_sign"
|
||||
android:text="@string/label_sign"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/label_sign"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="5dip">
|
||||
android:orientation="vertical"
|
||||
android:paddingRight="5dip" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mainUserId"
|
||||
android:text="Main User Id"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"/>
|
||||
android:layout_gravity="right"
|
||||
android:text="Main User Id"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mainUserIdRest"
|
||||
android:text="Main User Id Rest"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"/>
|
||||
|
||||
android:layout_gravity="right"
|
||||
android:text="Main User Id Rest"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/sign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
android:layout_gravity="center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="3dip"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="3dip" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_selectPublicKeys"
|
||||
android:text="@string/label_selectPublicKeys"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
android:text="@string/label_selectPublicKeys"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<Button
|
||||
android:text="@string/btn_selectEncryptKeys"
|
||||
android:id="@+id/btn_selectEncryptKeys"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/btn_selectEncryptKeys" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/modeSymmetric"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:stretchColumns="1">
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="1" >
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_passPhrase"
|
||||
android:text="@string/label_passPhrase"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"/>
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_passPhrase"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passPhrase"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:inputType="textPassword"/>
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_passPhraseAgain"
|
||||
android:text="@string/label_passPhraseAgain"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"/>
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_passPhraseAgain"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passPhraseAgain"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:inputType="textPassword"/>
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword" />
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
</ViewFlipper>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="?android:attr/listDivider"
|
||||
android:layout_marginBottom="5dip"/>
|
||||
|
||||
android:layout_marginBottom="5dip"
|
||||
android:background="?android:attr/listDivider" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
style="@android:style/ButtonBar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@android:style/ButtonBar">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_encryptToClipboard"
|
||||
android:text="@string/btn_encryptToClipboard"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"/>
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/btn_encryptToClipboard" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_encrypt"
|
||||
android:text="@string/btn_encrypt"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/btn_encrypt" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -39,18 +39,26 @@
|
||||
android:text="@string/dashboard_my_keys" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dashboard_encrypt_decrypt_file"
|
||||
android:id="@+id/dashboard_encrypt"
|
||||
style="@style/DashboardButton"
|
||||
android:drawableTop="@drawable/dashboard_encrypt_decrypt_file"
|
||||
android:onClick="encryptDecryptFileOnClick"
|
||||
android:text="@string/dashboard_encrypt_decrypt_file" />
|
||||
android:drawableTop="@drawable/dashboard_encrypt"
|
||||
android:onClick="encryptOnClick"
|
||||
android:text="@string/dashboard_encrypt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dashboard_encrypt_decrypt_text"
|
||||
android:id="@+id/dashboard_decrypt"
|
||||
style="@style/DashboardButton"
|
||||
android:drawableTop="@drawable/dashboard_encrypt_decrypt_text"
|
||||
android:onClick="encryptDecryptTextOnClick"
|
||||
android:text="@string/dashboard_encrypt_decrypt_text" />
|
||||
android:drawableTop="@drawable/dashboard_decrypt"
|
||||
android:onClick="decryptOnClick"
|
||||
android:text="@string/dashboard_decrypt" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/dashboard_scan_qrcode"
|
||||
style="@style/DashboardButton"
|
||||
android:drawableTop="@drawable/dashboard_scan_qrcode"
|
||||
android:onClick="scanQrcodeOnClick"
|
||||
android:text="@string/dashboard_scan_qrcode" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/dashboard_help"
|
||||
|
||||
@@ -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.
|
||||
@@ -29,7 +30,6 @@
|
||||
<item>@string/choice_4hours</item>
|
||||
<item>@string/choice_8hours</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pass_phrase_cache_ttl_values">
|
||||
<item>15</item>
|
||||
<item>60</item>
|
||||
@@ -44,171 +44,4 @@
|
||||
<item>28800</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="language_entries">
|
||||
<item>@string/choice_language_system</item>
|
||||
<item>Afrikaans</item>
|
||||
<item>Bahasa indonesia</item>
|
||||
<item>Bahasa melayu</item>
|
||||
<item>Bamanankan</item>
|
||||
<item>Català</item>
|
||||
<item>Cymraeg</item>
|
||||
<item>Dansk</item>
|
||||
<item>Deutsch</item>
|
||||
<item>Dholuo</item>
|
||||
<item>Eesti</item>
|
||||
<item>English</item>
|
||||
<item>Español</item>
|
||||
<item>Fulfulde, Pulaar, Pular</item>
|
||||
<item>Gaeilge</item>
|
||||
<item>Galego</item>
|
||||
<item>Hausa</item>
|
||||
<item>Hrvatski</item>
|
||||
<item>Kinyarwanda</item>
|
||||
<item>Kirundi</item>
|
||||
<item>Kiswahili</item>
|
||||
<item>Latviešu</item>
|
||||
<item>Lietuviškai</item>
|
||||
<item>Magyar</item>
|
||||
<item>Malti</item>
|
||||
<item>Nederlands</item>
|
||||
<item>Norsk bokmål</item>
|
||||
<item>Pyccĸий</item>
|
||||
<item>Română</item>
|
||||
<item>Slovenčina</item>
|
||||
<item>Slovenščina</item>
|
||||
<item>Somali</item>
|
||||
<item>Српски</item>
|
||||
<item>Tiếng Việt</item>
|
||||
<item>Tϋrkçe</item>
|
||||
<item>Wolof</item>
|
||||
<item>Yorùbá</item>
|
||||
<item>Azərbaycan</item>
|
||||
<item>Euskera</item>
|
||||
<item>Français</item>
|
||||
<item>isiXhosa</item>
|
||||
<item>isiZulu</item>
|
||||
<item>Italiano</item>
|
||||
<item>O\'zbek</item>
|
||||
<item>Polski</item>
|
||||
<item>Português</item>
|
||||
<item>Shqip</item>
|
||||
<item>Suomi</item>
|
||||
<item>Svenska</item>
|
||||
<item>Íslenska</item>
|
||||
<item>Čeština</item>
|
||||
<item>Ɛʋɛ</item>
|
||||
<item>Ελληνικά</item>
|
||||
<item>Беларуская</item>
|
||||
<item>Български</item>
|
||||
<item>Кыргыз</item>
|
||||
<item>Македонски</item>
|
||||
<item>Українська</item>
|
||||
<item>аҧсуа бызшәа</item>
|
||||
<item>Қазақ</item>
|
||||
<item>Հայերեն</item>
|
||||
<item>עברית</item>
|
||||
<item>اردو</item>
|
||||
<item>العربية</item>
|
||||
<item>فارسی</item>
|
||||
<item>پښتو</item>
|
||||
<item>हिंदी</item>
|
||||
<item>తెలుగు</item>
|
||||
<item>ಕನ್ನಡ</item>
|
||||
<item>ภาษาไทย</item>
|
||||
<item>አማርኛ</item>
|
||||
<item>中文</item>
|
||||
<item>日本語</item>
|
||||
<item>한국어</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="language_values">
|
||||
<item></item>
|
||||
<item>af</item>
|
||||
<item>id</item>
|
||||
<item>ms</item>
|
||||
<item>bm</item>
|
||||
<item>ca</item>
|
||||
<item>cy</item>
|
||||
<item>da</item>
|
||||
<item>de</item>
|
||||
<item>luo</item>
|
||||
<item>et</item>
|
||||
<item>en</item>
|
||||
<item>es</item>
|
||||
<item>ff</item>
|
||||
<item>ga</item>
|
||||
<item>gl</item>
|
||||
<item>ha</item>
|
||||
<item>hr</item>
|
||||
<item>rw</item>
|
||||
<item>rn</item>
|
||||
<item>sw</item>
|
||||
<item>lv</item>
|
||||
<item>lt</item>
|
||||
<item>hu</item>
|
||||
<item>mt</item>
|
||||
<item>nl</item>
|
||||
<item>no</item>
|
||||
<item>ru</item>
|
||||
<item>ro</item>
|
||||
<item>sk</item>
|
||||
<item>sl</item>
|
||||
<item>so</item>
|
||||
<item>sr</item>
|
||||
<item>vi</item>
|
||||
<item>tr</item>
|
||||
<item>wo</item>
|
||||
<item>yo</item>
|
||||
<item>az</item>
|
||||
<item>eu</item>
|
||||
<item>fr</item>
|
||||
<item>xs</item>
|
||||
<item>zu</item>
|
||||
<item>it</item>
|
||||
<item>uz</item>
|
||||
<item>pl</item>
|
||||
<item>pt</item>
|
||||
<item>sq</item>
|
||||
<item>fi</item>
|
||||
<item>sv</item>
|
||||
<item>is</item>
|
||||
<item>cs</item>
|
||||
<item>ee</item>
|
||||
<item>el</item>
|
||||
<item>be</item>
|
||||
<item>bg</item>
|
||||
<item>ky</item>
|
||||
<item>mk</item>
|
||||
<item>uk</item>
|
||||
<item>ab</item>
|
||||
<item>kk</item>
|
||||
<item>hy</item>
|
||||
<item>he</item>
|
||||
<item>ur</item>
|
||||
<item>ar</item>
|
||||
<item>fa</item>
|
||||
<item>ps</item>
|
||||
<item>hi</item>
|
||||
<item>te</item>
|
||||
<item>kn</item>
|
||||
<item>th</item>
|
||||
<item>am</item>
|
||||
<item>zh</item>
|
||||
<item>ja</item>
|
||||
<item>ko</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="supported_languages">
|
||||
<item></item>
|
||||
<item>da</item>
|
||||
<item>de</item>
|
||||
<item>en</item>
|
||||
<item>es</item>
|
||||
<item>it</item>
|
||||
<item>no</item>
|
||||
<item>pt</item>
|
||||
<item>sl</item>
|
||||
<item>zh</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
@@ -86,7 +86,7 @@
|
||||
<string name="menu_manageSecretKeys">Manage Secret Keys</string>
|
||||
<string name="menu_preferences">Settings</string>
|
||||
<string name="menu_importKeys">Import Keys</string>
|
||||
<string name="menu_exportKeys">Export Keys</string>
|
||||
<string name="menu_exportKeys">Export All Keys</string>
|
||||
<string name="menu_exportKey">Export Key</string>
|
||||
<string name="menu_deleteKey">Delete Key</string>
|
||||
<string name="menu_createKey">Create Key</string>
|
||||
@@ -119,7 +119,6 @@
|
||||
<string name="label_passPhraseCacheTtl">Pass Phrase Cache</string>
|
||||
<string name="label_messageCompression">Message Compression</string>
|
||||
<string name="label_fileCompression">File Compression</string>
|
||||
<string name="label_language">Language</string>
|
||||
<string name="label_forceV3Signature">Force V3 Signatures</string>
|
||||
<string name="label_keyServers">Key Servers</string>
|
||||
<string name="label_keyId">Key ID</string>
|
||||
@@ -323,16 +322,17 @@
|
||||
|
||||
|
||||
<!-- about -->
|
||||
<string name="about_description">Android Privacy Guard (APG) is a OpenPGP implementation for Android.</string>
|
||||
<string name="about_description">Android Privacy Guard (APG) is a OpenPGP implementation for Android.\n\nAPG+ is a fork based on the original APG to introduce more features and a new user interface.</string>
|
||||
<string name="about_license">License: Apache License 2.0</string>
|
||||
<string name="about_version">Version:</string>
|
||||
<string name="about_developer">Developer: Thialfihar (Main developer), Senecaso (QRCode, send key, sign key), Markus Doits (AIDL), Oliver Runge, Dominik Schürmann</string>
|
||||
<string name="about_developer">Developer: Thialfihar (Main developer), Senecaso (QRCode, sign key, upload key), Markus Doits (AIDL), Oliver Runge, Dominik Schürmann (APG+ fork)</string>
|
||||
|
||||
<!-- Dashboard -->
|
||||
<string name="dashboard_manage_keys">Manage Keys</string>
|
||||
<string name="dashboard_my_keys">My Keys</string>
|
||||
<string name="dashboard_encrypt_decrypt_file">Encrypt/Decrypt File</string>
|
||||
<string name="dashboard_encrypt_decrypt_text">Encrypt/Decrypt Text</string>
|
||||
<string name="dashboard_encrypt">Encrypt</string>
|
||||
<string name="dashboard_decrypt">Decrypt</string>
|
||||
<string name="dashboard_help">Help</string>
|
||||
<string name="dashboard_scan_qrcode">Scan QRCode</string>
|
||||
|
||||
</resources>
|
||||
@@ -18,13 +18,6 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<PreferenceCategory android:title="@string/section_general" >
|
||||
<ListPreference
|
||||
android:dialogTitle="@string/label_language"
|
||||
android:entries="@array/language_entries"
|
||||
android:entryValues="@array/language_values"
|
||||
android:key="language"
|
||||
android:title="@string/label_language" />
|
||||
|
||||
<org.apg.ui.widget.IntegerListPreference
|
||||
android:entries="@array/pass_phrase_cache_ttl_entries"
|
||||
android:entryValues="@array/pass_phrase_cache_ttl_values"
|
||||
|
||||
@@ -44,6 +44,10 @@ public final class Id {
|
||||
public static final int help = 0x21070010;
|
||||
public static final int key_server = 0x21070011;
|
||||
public static final int scanQRCode = 0x21070012;
|
||||
public static final int encrypt = 0x21070013;
|
||||
public static final int decrypt = 0x21070014;
|
||||
public static final int encrypt_ = 0x21070015;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.apg.ProgressDialogUpdater;
|
||||
import org.apg.Service;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
@@ -75,8 +76,11 @@ public class BaseActivity extends SherlockActivity implements Runnable, Progress
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mPreferences = Preferences.getPreferences(this);
|
||||
setLanguage(this, mPreferences.getLanguage());
|
||||
|
||||
Apg.initialize(this);
|
||||
|
||||
@@ -97,36 +101,22 @@ public class BaseActivity extends SherlockActivity implements Runnable, Progress
|
||||
activity.startService(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.preferences, 0, R.string.menu_preferences).setIcon(
|
||||
android.R.drawable.ic_menu_preferences);
|
||||
menu.add(0, Id.menu.option.about, 1, R.string.menu_about).setIcon(
|
||||
android.R.drawable.ic_menu_info_details);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.about: {
|
||||
startActivity(new Intent(this, AboutActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.option.preferences: {
|
||||
startActivity(new Intent(this, PreferencesActivity.class));
|
||||
case android.R.id.home:
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.option.search: {
|
||||
// TODO: needed?:
|
||||
case Id.menu.option.search:
|
||||
startSearch("", false, null, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -422,17 +412,4 @@ public class BaseActivity extends SherlockActivity implements Runnable, Progress
|
||||
protected String getDeleteFile() {
|
||||
return mDeleteFile;
|
||||
}
|
||||
|
||||
public static void setLanguage(Context context, String language) {
|
||||
Locale locale;
|
||||
if (language == null || language.equals("")) {
|
||||
locale = Locale.getDefault();
|
||||
} else {
|
||||
locale = new Locale(language);
|
||||
}
|
||||
Configuration config = new Configuration();
|
||||
config.locale = locale;
|
||||
context.getResources().updateConfiguration(config,
|
||||
context.getResources().getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ import org.spongycastle.openpgp.PGPSecretKey;
|
||||
import org.spongycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
@@ -113,6 +116,36 @@ public class EncryptActivity extends BaseActivity {
|
||||
|
||||
private boolean mGenerateSignature = false;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(1, Id.menu.option.encrypt, 0, R.string.btn_encrypt)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.key_server: {
|
||||
startActivity(new Intent(this, KeyServerQueryActivity.class));
|
||||
|
||||
return true;
|
||||
}
|
||||
case Id.menu.option.scanQRCode: {
|
||||
Intent intent = new Intent(this, ImportFromQRCodeActivity.class);
|
||||
intent.setAction(Apg.Intent.IMPORT_FROM_QR_CODE);
|
||||
startActivityForResult(intent, Id.request.import_from_qr_code);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@@ -87,7 +87,6 @@ public class MailListActivity extends ListActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Preferences prefs = Preferences.getPreferences(this);
|
||||
BaseActivity.setLanguage(this, prefs.getLanguage());
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.apg.Id;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
@@ -60,20 +61,22 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
public void encryptDecryptFileOnClick(View view) {
|
||||
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
|
||||
intent.setAction(Apg.Intent.ENCRYPT_FILE);
|
||||
startActivity(intent);
|
||||
|
||||
// intent.setAction(Apg.Intent.DECRYPT_FILE);
|
||||
}
|
||||
|
||||
public void encryptDecryptTextOnClick(View view) {
|
||||
public void encryptOnClick(View view) {
|
||||
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
|
||||
intent.setAction(Apg.Intent.ENCRYPT);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
// intent.setAction(Apg.Intent.DECRYPT);
|
||||
public void decryptOnClick(View view) {
|
||||
Intent intent = new Intent(MainActivity.this, EncryptActivity.class);
|
||||
intent.setAction(Apg.Intent.DECRYPT);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void scanQrcodeOnClick(View view) {
|
||||
Intent intent = new Intent(this, ImportFromQRCodeActivity.class);
|
||||
intent.setAction(Apg.Intent.IMPORT_FROM_QR_CODE);
|
||||
startActivityForResult(intent, Id.request.import_from_qr_code);
|
||||
}
|
||||
|
||||
public void helpOnClick(View view) {
|
||||
@@ -85,88 +88,92 @@ public class MainActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
// if (!mPreferences.hasSeenHelp()) {
|
||||
// showDialog(Id.dialog.help);
|
||||
// }
|
||||
//
|
||||
// if (Apg.isReleaseVersion(this) && !mPreferences.hasSeenChangeLog(Apg.getVersion(this))) {
|
||||
// showDialog(Id.dialog.change_log);
|
||||
// }
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
|
||||
// if (!mPreferences.hasSeenHelp()) {
|
||||
// showDialog(Id.dialog.help);
|
||||
// }
|
||||
//
|
||||
// if (Apg.isReleaseVersion(this) && !mPreferences.hasSeenChangeLog(Apg.getVersion(this))) {
|
||||
// showDialog(Id.dialog.change_log);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
switch (id) {
|
||||
|
||||
// case Id.dialog.change_log: {
|
||||
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
//
|
||||
// alert.setTitle("Changes " + Apg.getFullVersion(this));
|
||||
// LayoutInflater inflater = (LayoutInflater) this
|
||||
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
// View layout = inflater.inflate(R.layout.info, null);
|
||||
// TextView message = (TextView) layout.findViewById(R.id.message);
|
||||
//
|
||||
// message.setText("Changes:\n" + "* \n" + "\n"
|
||||
// + "WARNING: be careful editing your existing keys, as they "
|
||||
// + "WILL be stripped of certificates right now.\n" + "\n"
|
||||
// + "Also: key cross-certification is NOT supported, so signing "
|
||||
// + "with those keys will get a warning when the signature is " + "checked.\n"
|
||||
// + "\n" + "I hope APG continues to be useful to you, please send "
|
||||
// + "bug reports, feature wishes, feedback.");
|
||||
// alert.setView(layout);
|
||||
//
|
||||
// alert.setCancelable(false);
|
||||
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
// public void onClick(DialogInterface dialog, int id) {
|
||||
// MainActivity.this.removeDialog(Id.dialog.change_log);
|
||||
// mPreferences.setHasSeenChangeLog(Apg.getVersion(MainActivity.this), true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return alert.create();
|
||||
// }
|
||||
// case Id.dialog.change_log: {
|
||||
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
//
|
||||
// alert.setTitle("Changes " + Apg.getFullVersion(this));
|
||||
// LayoutInflater inflater = (LayoutInflater) this
|
||||
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
// View layout = inflater.inflate(R.layout.info, null);
|
||||
// TextView message = (TextView) layout.findViewById(R.id.message);
|
||||
//
|
||||
// message.setText("Changes:\n" + "* \n" + "\n"
|
||||
// + "WARNING: be careful editing your existing keys, as they "
|
||||
// + "WILL be stripped of certificates right now.\n" + "\n"
|
||||
// + "Also: key cross-certification is NOT supported, so signing "
|
||||
// + "with those keys will get a warning when the signature is " + "checked.\n"
|
||||
// + "\n" + "I hope APG continues to be useful to you, please send "
|
||||
// + "bug reports, feature wishes, feedback.");
|
||||
// alert.setView(layout);
|
||||
//
|
||||
// alert.setCancelable(false);
|
||||
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
// public void onClick(DialogInterface dialog, int id) {
|
||||
// MainActivity.this.removeDialog(Id.dialog.change_log);
|
||||
// mPreferences.setHasSeenChangeLog(Apg.getVersion(MainActivity.this), true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return alert.create();
|
||||
// }
|
||||
|
||||
// case Id.dialog.help: {
|
||||
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
//
|
||||
// alert.setTitle(R.string.title_help);
|
||||
//
|
||||
// LayoutInflater inflater = (LayoutInflater) this
|
||||
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
// View layout = inflater.inflate(R.layout.info, null);
|
||||
// TextView message = (TextView) layout.findViewById(R.id.message);
|
||||
// message.setText(R.string.text_help);
|
||||
//
|
||||
// TransformFilter packageNames = new TransformFilter() {
|
||||
// public final String transformUrl(final Matcher match, String url) {
|
||||
// String name = match.group(1).toLowerCase();
|
||||
// if (name.equals("astro")) {
|
||||
// return "com.metago.astro";
|
||||
// } else if (name.equals("k-9 mail")) {
|
||||
// return "com.fsck.k9";
|
||||
// } else {
|
||||
// return "org.openintents.filemanager";
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// Pattern pattern = Pattern.compile("(OI File Manager|ASTRO|K-9 Mail)");
|
||||
// String scheme = "market://search?q=pname:";
|
||||
// message.setAutoLinkMask(0);
|
||||
// Linkify.addLinks(message, pattern, scheme, null, packageNames);
|
||||
//
|
||||
// alert.setView(layout);
|
||||
//
|
||||
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
// public void onClick(DialogInterface dialog, int id) {
|
||||
// MainActivity.this.removeDialog(Id.dialog.help);
|
||||
// mPreferences.setHasSeenHelp(true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return alert.create();
|
||||
// }
|
||||
// case Id.dialog.help: {
|
||||
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
|
||||
//
|
||||
// alert.setTitle(R.string.title_help);
|
||||
//
|
||||
// LayoutInflater inflater = (LayoutInflater) this
|
||||
// .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
// View layout = inflater.inflate(R.layout.info, null);
|
||||
// TextView message = (TextView) layout.findViewById(R.id.message);
|
||||
// message.setText(R.string.text_help);
|
||||
//
|
||||
// TransformFilter packageNames = new TransformFilter() {
|
||||
// public final String transformUrl(final Matcher match, String url) {
|
||||
// String name = match.group(1).toLowerCase();
|
||||
// if (name.equals("astro")) {
|
||||
// return "com.metago.astro";
|
||||
// } else if (name.equals("k-9 mail")) {
|
||||
// return "com.fsck.k9";
|
||||
// } else {
|
||||
// return "org.openintents.filemanager";
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// Pattern pattern = Pattern.compile("(OI File Manager|ASTRO|K-9 Mail)");
|
||||
// String scheme = "market://search?q=pname:";
|
||||
// message.setAutoLinkMask(0);
|
||||
// Linkify.addLinks(message, pattern, scheme, null, packageNames);
|
||||
//
|
||||
// alert.setView(layout);
|
||||
//
|
||||
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
// public void onClick(DialogInterface dialog, int id) {
|
||||
// MainActivity.this.removeDialog(Id.dialog.help);
|
||||
// mPreferences.setHasSeenHelp(true);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return alert.create();
|
||||
// }
|
||||
|
||||
default: {
|
||||
return super.onCreateDialog(id);
|
||||
@@ -176,55 +183,81 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.manage_public_keys, 0, R.string.menu_managePublicKeys).setIcon(
|
||||
android.R.drawable.ic_menu_manage);
|
||||
menu.add(0, Id.menu.option.manage_secret_keys, 1, R.string.menu_manageSecretKeys).setIcon(
|
||||
android.R.drawable.ic_menu_manage);
|
||||
menu.add(2, Id.menu.option.preferences, 3, R.string.menu_preferences).setIcon(
|
||||
android.R.drawable.ic_menu_preferences);
|
||||
menu.add(2, Id.menu.option.key_server, 4, R.string.menu_keyServer).setIcon(
|
||||
android.R.drawable.ic_menu_search);
|
||||
menu.add(3, Id.menu.option.about, 5, R.string.menu_about).setIcon(
|
||||
android.R.drawable.ic_menu_info_details);
|
||||
menu.add(3, Id.menu.option.help, 6, R.string.menu_help).setIcon(
|
||||
android.R.drawable.ic_menu_help);
|
||||
menu.add(0, Id.menu.option.preferences, 0, R.string.menu_preferences)
|
||||
.setIcon(R.drawable.ic_menu_settings_holo_light)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(0, Id.menu.option.about, 1, R.string.menu_about).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.create: {
|
||||
showDialog(Id.dialog.new_account);
|
||||
case Id.menu.option.about: {
|
||||
startActivity(new Intent(this, AboutActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.option.manage_public_keys: {
|
||||
startActivity(new Intent(this, PublicKeyListActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.option.manage_secret_keys: {
|
||||
startActivity(new Intent(this, SecretKeyListActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.option.help: {
|
||||
showDialog(Id.dialog.help);
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.option.key_server: {
|
||||
startActivity(new Intent(this, KeyServerQueryActivity.class));
|
||||
case Id.menu.option.preferences: {
|
||||
startActivity(new Intent(this, PreferencesActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// menu.add(2, Id.menu.option.preferences, 3, R.string.menu_preferences).setIcon(
|
||||
// android.R.drawable.ic_menu_preferences);
|
||||
// menu.add(2, Id.menu.option.key_server, 4, R.string.menu_keyServer).setIcon(
|
||||
// android.R.drawable.ic_menu_search);
|
||||
// menu.add(3, Id.menu.option.about, 5, R.string.menu_about).setIcon(
|
||||
// android.R.drawable.ic_menu_info_details);
|
||||
// menu.add(3, Id.menu.option.help, 6, R.string.menu_help).setIcon(
|
||||
// android.R.drawable.ic_menu_help);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// switch (item.getItemId()) {
|
||||
// case Id.menu.option.create: {
|
||||
// showDialog(Id.dialog.new_account);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// case Id.menu.option.manage_public_keys: {
|
||||
// startActivity(new Intent(this, PublicKeyListActivity.class));
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// case Id.menu.option.manage_secret_keys: {
|
||||
// startActivity(new Intent(this, SecretKeyListActivity.class));
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// case Id.menu.option.help: {
|
||||
// showDialog(Id.dialog.help);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// case Id.menu.option.key_server: {
|
||||
// startActivity(new Intent(this, KeyServerQueryActivity.class));
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// default: {
|
||||
// return super.onOptionsItemSelected(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
|
||||
@@ -29,6 +29,10 @@ import org.spongycastle.bcpg.HashAlgorithmTags;
|
||||
import org.spongycastle.openpgp.PGPEncryptedData;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
@@ -41,7 +45,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Vector;
|
||||
|
||||
public class PreferencesActivity extends PreferenceActivity {
|
||||
public class PreferencesActivity extends SherlockPreferenceActivity {
|
||||
private ListPreference mLanguage = null;
|
||||
private IntegerListPreference mPassPhraseCacheTtl = null;
|
||||
private IntegerListPreference mEncryptionAlgorithm = null;
|
||||
@@ -56,66 +60,35 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
mPreferences = Preferences.getPreferences(this);
|
||||
BaseActivity.setLanguage(this, mPreferences.getLanguage());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.apg_preferences);
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mLanguage = (ListPreference) findPreference(Constants.pref.LANGUAGE);
|
||||
Vector<CharSequence> entryVector = new Vector<CharSequence>(Arrays.asList(mLanguage.getEntries()));
|
||||
Vector<CharSequence> entryValueVector = new Vector<CharSequence>(Arrays.asList(mLanguage.getEntryValues()));
|
||||
String supportedLanguages[] = getResources().getStringArray(R.array.supported_languages);
|
||||
HashSet<String> supportedLanguageSet = new HashSet<String>(Arrays.asList(supportedLanguages));
|
||||
for (int i = entryVector.size() - 1; i > -1; --i)
|
||||
{
|
||||
if (!supportedLanguageSet.contains(entryValueVector.get(i)))
|
||||
{
|
||||
entryVector.remove(i);
|
||||
entryValueVector.remove(i);
|
||||
}
|
||||
}
|
||||
CharSequence dummy[] = new CharSequence[0];
|
||||
mLanguage.setEntries(entryVector.toArray(dummy));
|
||||
mLanguage.setEntryValues(entryValueVector.toArray(dummy));
|
||||
mLanguage.setValue(mPreferences.getLanguage());
|
||||
mLanguage.setSummary(mLanguage.getEntry());
|
||||
mLanguage.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mLanguage.setValue(newValue.toString());
|
||||
mLanguage.setSummary(mLanguage.getEntry());
|
||||
mPreferences.setLanguage(newValue.toString());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
addPreferencesFromResource(R.xml.apg_preferences);
|
||||
|
||||
mPassPhraseCacheTtl = (IntegerListPreference) findPreference(Constants.pref.PASS_PHRASE_CACHE_TTL);
|
||||
mPassPhraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl());
|
||||
mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry());
|
||||
mPassPhraseCacheTtl.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mPassPhraseCacheTtl.setValue(newValue.toString());
|
||||
mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry());
|
||||
mPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString()));
|
||||
BaseActivity.startCacheService(PreferencesActivity.this, mPreferences);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mPassPhraseCacheTtl
|
||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mPassPhraseCacheTtl.setValue(newValue.toString());
|
||||
mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry());
|
||||
mPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString()));
|
||||
BaseActivity.startCacheService(PreferencesActivity.this, mPreferences);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mEncryptionAlgorithm = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM);
|
||||
int valueIds[] = {
|
||||
PGPEncryptedData.AES_128, PGPEncryptedData.AES_192, PGPEncryptedData.AES_256,
|
||||
PGPEncryptedData.BLOWFISH, PGPEncryptedData.TWOFISH, PGPEncryptedData.CAST5,
|
||||
PGPEncryptedData.DES, PGPEncryptedData.TRIPLE_DES, PGPEncryptedData.IDEA,
|
||||
};
|
||||
String entries[] = {
|
||||
"AES-128", "AES-192", "AES-256",
|
||||
"Blowfish", "Twofish", "CAST5",
|
||||
"DES", "Triple DES", "IDEA",
|
||||
};
|
||||
int valueIds[] = { PGPEncryptedData.AES_128, PGPEncryptedData.AES_192,
|
||||
PGPEncryptedData.AES_256, PGPEncryptedData.BLOWFISH, PGPEncryptedData.TWOFISH,
|
||||
PGPEncryptedData.CAST5, PGPEncryptedData.DES, PGPEncryptedData.TRIPLE_DES,
|
||||
PGPEncryptedData.IDEA, };
|
||||
String entries[] = { "AES-128", "AES-192", "AES-256", "Blowfish", "Twofish", "CAST5",
|
||||
"DES", "Triple DES", "IDEA", };
|
||||
String values[] = new String[valueIds.length];
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
values[i] = "" + valueIds[i];
|
||||
@@ -124,28 +97,23 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
mEncryptionAlgorithm.setEntryValues(values);
|
||||
mEncryptionAlgorithm.setValue("" + mPreferences.getDefaultEncryptionAlgorithm());
|
||||
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
||||
mEncryptionAlgorithm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mEncryptionAlgorithm.setValue(newValue.toString());
|
||||
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
||||
mPreferences.setDefaultEncryptionAlgorithm(Integer.parseInt(newValue.toString()));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mEncryptionAlgorithm
|
||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mEncryptionAlgorithm.setValue(newValue.toString());
|
||||
mEncryptionAlgorithm.setSummary(mEncryptionAlgorithm.getEntry());
|
||||
mPreferences.setDefaultEncryptionAlgorithm(Integer.parseInt(newValue
|
||||
.toString()));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mHashAlgorithm = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM);
|
||||
valueIds = new int[] {
|
||||
HashAlgorithmTags.MD5, HashAlgorithmTags.RIPEMD160, HashAlgorithmTags.SHA1,
|
||||
HashAlgorithmTags.SHA224, HashAlgorithmTags.SHA256, HashAlgorithmTags.SHA384,
|
||||
HashAlgorithmTags.SHA512,
|
||||
};
|
||||
entries = new String[] {
|
||||
"MD5", "RIPEMD-160", "SHA-1",
|
||||
"SHA-224", "SHA-256", "SHA-384",
|
||||
"SHA-512",
|
||||
};
|
||||
valueIds = new int[] { HashAlgorithmTags.MD5, HashAlgorithmTags.RIPEMD160,
|
||||
HashAlgorithmTags.SHA1, HashAlgorithmTags.SHA224, HashAlgorithmTags.SHA256,
|
||||
HashAlgorithmTags.SHA384, HashAlgorithmTags.SHA512, };
|
||||
entries = new String[] { "MD5", "RIPEMD-160", "SHA-1", "SHA-224", "SHA-256", "SHA-384",
|
||||
"SHA-512", };
|
||||
values = new String[valueIds.length];
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
values[i] = "" + valueIds[i];
|
||||
@@ -154,10 +122,8 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
mHashAlgorithm.setEntryValues(values);
|
||||
mHashAlgorithm.setValue("" + mPreferences.getDefaultHashAlgorithm());
|
||||
mHashAlgorithm.setSummary(mHashAlgorithm.getEntry());
|
||||
mHashAlgorithm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mHashAlgorithm.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mHashAlgorithm.setValue(newValue.toString());
|
||||
mHashAlgorithm.setSummary(mHashAlgorithm.getEntry());
|
||||
mPreferences.setDefaultHashAlgorithm(Integer.parseInt(newValue.toString()));
|
||||
@@ -166,18 +132,13 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
});
|
||||
|
||||
mMessageCompression = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION);
|
||||
valueIds = new int[] {
|
||||
Id.choice.compression.none,
|
||||
Id.choice.compression.zip,
|
||||
Id.choice.compression.zlib,
|
||||
Id.choice.compression.bzip2,
|
||||
};
|
||||
valueIds = new int[] { Id.choice.compression.none, Id.choice.compression.zip,
|
||||
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
||||
entries = new String[] {
|
||||
getString(R.string.choice_none) + " (" + getString(R.string.fast) + ")",
|
||||
"ZIP (" + getString(R.string.fast) + ")",
|
||||
"ZLIB (" + getString(R.string.fast) + ")",
|
||||
"BZIP2 (" + getString(R.string.very_slow) + ")",
|
||||
};
|
||||
"BZIP2 (" + getString(R.string.very_slow) + ")", };
|
||||
values = new String[valueIds.length];
|
||||
for (int i = 0; i < values.length; ++i) {
|
||||
values[i] = "" + valueIds[i];
|
||||
@@ -186,26 +147,24 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
mMessageCompression.setEntryValues(values);
|
||||
mMessageCompression.setValue("" + mPreferences.getDefaultMessageCompression());
|
||||
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
||||
mMessageCompression.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mMessageCompression.setValue(newValue.toString());
|
||||
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
||||
mPreferences.setDefaultMessageCompression(Integer.parseInt(newValue.toString()));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mMessageCompression
|
||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mMessageCompression.setValue(newValue.toString());
|
||||
mMessageCompression.setSummary(mMessageCompression.getEntry());
|
||||
mPreferences.setDefaultMessageCompression(Integer.parseInt(newValue
|
||||
.toString()));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mFileCompression = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION);
|
||||
mFileCompression.setEntries(entries);
|
||||
mFileCompression.setEntryValues(values);
|
||||
mFileCompression.setValue("" + mPreferences.getDefaultFileCompression());
|
||||
mFileCompression.setSummary(mFileCompression.getEntry());
|
||||
mFileCompression.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mFileCompression.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mFileCompression.setValue(newValue.toString());
|
||||
mFileCompression.setSummary(mFileCompression.getEntry());
|
||||
mPreferences.setDefaultFileCompression(Integer.parseInt(newValue.toString()));
|
||||
@@ -215,60 +174,74 @@ public class PreferencesActivity extends PreferenceActivity {
|
||||
|
||||
mAsciiArmour = (CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR);
|
||||
mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour());
|
||||
mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mAsciiArmour.setChecked((Boolean)newValue);
|
||||
mPreferences.setDefaultAsciiArmour((Boolean)newValue);
|
||||
mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mAsciiArmour.setChecked((Boolean) newValue);
|
||||
mPreferences.setDefaultAsciiArmour((Boolean) newValue);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mForceV3Signatures = (CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES);
|
||||
mForceV3Signatures.setChecked(mPreferences.getForceV3Signatures());
|
||||
mForceV3Signatures.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
|
||||
{
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||
{
|
||||
mForceV3Signatures.setChecked((Boolean)newValue);
|
||||
mPreferences.setForceV3Signatures((Boolean)newValue);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mForceV3Signatures
|
||||
.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
mForceV3Signatures.setChecked((Boolean) newValue);
|
||||
mPreferences.setForceV3Signatures((Boolean) newValue);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS);
|
||||
String servers[] = mPreferences.getKeyServers();
|
||||
mKeyServerPreference.setSummary(getResources().getString(R.string.nKeyServers, servers.length));
|
||||
mKeyServerPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent intent = new Intent(PreferencesActivity.this,
|
||||
KeyServerPreferenceActivity.class);
|
||||
intent.putExtra(Apg.EXTRA_KEY_SERVERS, mPreferences.getKeyServers());
|
||||
startActivityForResult(intent, Id.request.key_server_preference);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mKeyServerPreference.setSummary(getResources().getString(R.string.nKeyServers,
|
||||
servers.length));
|
||||
mKeyServerPreference
|
||||
.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent intent = new Intent(PreferencesActivity.this,
|
||||
KeyServerPreferenceActivity.class);
|
||||
intent.putExtra(Apg.EXTRA_KEY_SERVERS, mPreferences.getKeyServers());
|
||||
startActivityForResult(intent, Id.request.key_server_preference);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case Id.request.key_server_preference: {
|
||||
if (resultCode == RESULT_CANCELED || data == null) {
|
||||
return;
|
||||
}
|
||||
String servers[] = data.getStringArrayExtra(Apg.EXTRA_KEY_SERVERS);
|
||||
mPreferences.setKeyServers(servers);
|
||||
mKeyServerPreference.setSummary(getResources().getString(R.string.nKeyServers, servers.length));
|
||||
break;
|
||||
case Id.request.key_server_preference: {
|
||||
if (resultCode == RESULT_CANCELED || data == null) {
|
||||
return;
|
||||
}
|
||||
String servers[] = data.getStringArrayExtra(Apg.EXTRA_KEY_SERVERS);
|
||||
mPreferences.setKeyServers(servers);
|
||||
mKeyServerPreference.setSummary(getResources().getString(R.string.nKeyServers,
|
||||
servers.length));
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case android.R.id.home:
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.apg.Id.menu.option;
|
||||
import org.spongycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.ActionBarSherlock;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
@@ -48,21 +49,49 @@ public class PublicKeyListActivity extends KeyListActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.import_keys, 0, R.string.menu_importKeys).setIcon(
|
||||
android.R.drawable.ic_menu_add);
|
||||
menu.add(0, Id.menu.option.export_keys, 1, R.string.menu_exportKeys).setIcon(
|
||||
android.R.drawable.ic_menu_save);
|
||||
menu.add(1, Id.menu.option.search, 2, R.string.menu_search).setIcon(
|
||||
android.R.drawable.ic_menu_search);
|
||||
menu.add(1, Id.menu.option.preferences, 3, R.string.menu_preferences).setIcon(
|
||||
android.R.drawable.ic_menu_preferences);
|
||||
menu.add(1, Id.menu.option.about, 4, R.string.menu_about).setIcon(
|
||||
android.R.drawable.ic_menu_info_details);
|
||||
menu.add(1, Id.menu.option.scanQRCode, 5, R.string.menu_scanQRCode).setIcon(
|
||||
android.R.drawable.ic_menu_add);
|
||||
menu.add(1, Id.menu.option.key_server, 0, R.string.menu_keyServer)
|
||||
.setIcon(R.drawable.ic_menu_find_holo_light)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
menu.add(1, Id.menu.option.scanQRCode, 1, R.string.menu_scanQRCode)
|
||||
// .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_suggestions_add)
|
||||
.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_share_holo_light)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
menu.add(1, Id.menu.option.search, 4, R.string.menu_search)
|
||||
.setIcon(R.drawable.ic_menu_search_holo_light)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.key_server: {
|
||||
startActivity(new Intent(this, KeyServerQueryActivity.class));
|
||||
|
||||
return true;
|
||||
}
|
||||
case Id.menu.option.scanQRCode: {
|
||||
Intent intent = new Intent(this, ImportFromQRCodeActivity.class);
|
||||
intent.setAction(Apg.Intent.IMPORT_FROM_QR_CODE);
|
||||
startActivityForResult(intent, Id.request.import_from_qr_code);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
@@ -150,23 +179,6 @@ public class PublicKeyListActivity extends KeyListActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.scanQRCode: {
|
||||
Intent intent = new Intent(this, ImportFromQRCodeActivity.class);
|
||||
intent.setAction(Apg.Intent.IMPORT_FROM_QR_CODE);
|
||||
startActivityForResult(intent, Id.request.import_from_qr_code);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.apg.Id.type;
|
||||
import org.apg.Id.menu.option;
|
||||
import org.apg.R;
|
||||
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
@@ -55,40 +54,41 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.import_keys, 0, R.string.menu_importKeys)
|
||||
.setIcon(android.R.drawable.ic_menu_add);
|
||||
menu.add(0, Id.menu.option.export_keys, 1, R.string.menu_exportKeys)
|
||||
.setIcon(android.R.drawable.ic_menu_save);
|
||||
menu.add(1, Id.menu.option.create, 2, R.string.menu_createKey)
|
||||
.setIcon(android.R.drawable.ic_menu_add);
|
||||
menu.add(1, Id.menu.option.create, 0, 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, 1, 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, 2, R.string.menu_exportKeys)
|
||||
// .setIcon(R.drawable.ic_menu_find_holo_light)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
|
||||
menu.add(3, Id.menu.option.search, 3, R.string.menu_search)
|
||||
.setIcon(android.R.drawable.ic_menu_search);
|
||||
menu.add(3, Id.menu.option.preferences, 4, R.string.menu_preferences)
|
||||
.setIcon(android.R.drawable.ic_menu_preferences);
|
||||
menu.add(3, Id.menu.option.about, 5, R.string.menu_about)
|
||||
.setIcon(android.R.drawable.ic_menu_info_details);
|
||||
.setIcon(R.drawable.ic_menu_search_holo_light)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.create: {
|
||||
createKey();
|
||||
return true;
|
||||
}
|
||||
case Id.menu.option.create: {
|
||||
createKey();
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
ExpandableListView.ExpandableListContextMenuInfo info =
|
||||
(ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
|
||||
ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
|
||||
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
|
||||
|
||||
if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
|
||||
@@ -111,29 +111,31 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
|
||||
}
|
||||
|
||||
switch (menuItem.getItemId()) {
|
||||
case Id.menu.edit: {
|
||||
mSelectedItem = groupPosition;
|
||||
checkPassPhraseAndEdit();
|
||||
return true;
|
||||
}
|
||||
case Id.menu.edit: {
|
||||
mSelectedItem = groupPosition;
|
||||
checkPassPhraseAndEdit();
|
||||
return true;
|
||||
}
|
||||
|
||||
case Id.menu.share: {
|
||||
mSelectedItem = groupPosition;
|
||||
|
||||
long keyId = ((KeyListAdapter) mList.getExpandableListAdapter()).getGroupId(mSelectedItem);
|
||||
String msg = keyId + "," + Apg.getFingerPrint(keyId);;
|
||||
|
||||
new IntentIntegrator(this).shareText(msg);
|
||||
}
|
||||
case Id.menu.share: {
|
||||
mSelectedItem = groupPosition;
|
||||
|
||||
default: {
|
||||
return super.onContextItemSelected(menuItem);
|
||||
}
|
||||
long keyId = ((KeyListAdapter) mList.getExpandableListAdapter())
|
||||
.getGroupId(mSelectedItem);
|
||||
String msg = keyId + "," + Apg.getFingerPrint(keyId);
|
||||
;
|
||||
|
||||
new IntentIntegrator(this).shareText(msg);
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onContextItemSelected(menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
|
||||
int childPosition, long id) {
|
||||
int childPosition, long id) {
|
||||
mSelectedItem = groupPosition;
|
||||
checkPassPhraseAndEdit();
|
||||
return true;
|
||||
@@ -142,14 +144,15 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
switch (id) {
|
||||
case Id.dialog.pass_phrase: {
|
||||
long keyId = ((KeyListAdapter) mList.getExpandableListAdapter()).getGroupId(mSelectedItem);
|
||||
return AskForSecretKeyPassPhrase.createDialog(this, keyId, this);
|
||||
}
|
||||
case Id.dialog.pass_phrase: {
|
||||
long keyId = ((KeyListAdapter) mList.getExpandableListAdapter())
|
||||
.getGroupId(mSelectedItem);
|
||||
return AskForSecretKeyPassPhrase.createDialog(this, keyId, this);
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onCreateDialog(id);
|
||||
}
|
||||
default: {
|
||||
return super.onCreateDialog(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,17 +190,17 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case Id.message.create_key: // intentionally no break
|
||||
case Id.message.edit_key: {
|
||||
if (resultCode == RESULT_OK) {
|
||||
refreshList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
case Id.message.create_key: // intentionally no break
|
||||
case Id.message.edit_key: {
|
||||
if (resultCode == RESULT_OK) {
|
||||
refreshList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.view.ViewGroup;
|
||||
*/
|
||||
public class DashboardLayout extends ViewGroup {
|
||||
private static final int UNEVEN_GRID_PENALTY_MULTIPLIER = 10;
|
||||
private static final int OVERLAP_PENALTY_MULTIPLIER = 10;
|
||||
|
||||
private int mMaxChildWidth = 0;
|
||||
private int mMaxChildHeight = 0;
|
||||
@@ -129,12 +128,8 @@ public class DashboardLayout extends ViewGroup {
|
||||
spaceDifference = Math.abs(vSpace - hSpace);
|
||||
if (rows * cols != visibleCount) {
|
||||
spaceDifference *= UNEVEN_GRID_PENALTY_MULTIPLIER;
|
||||
}
|
||||
if (hSpace < 0) {
|
||||
spaceDifference *= OVERLAP_PENALTY_MULTIPLIER;
|
||||
}
|
||||
if (vSpace < 0) {
|
||||
spaceDifference *= OVERLAP_PENALTY_MULTIPLIER;
|
||||
} else if (rows * mMaxChildHeight > height || cols * mMaxChildWidth > width) {
|
||||
spaceDifference *= UNEVEN_GRID_PENALTY_MULTIPLIER;
|
||||
}
|
||||
|
||||
if (spaceDifference < bestSpaceDifference) {
|
||||
|
||||
@@ -79,15 +79,14 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
String error = data.getString(Apg.EXTRA_ERROR);
|
||||
if (error != null) {
|
||||
Toast.makeText(getContext(),
|
||||
getContext().getString(R.string.errorMessage, error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
getContext().getString(R.string.errorMessage, error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
boolean gotNewKey = data.getBoolean("gotNewKey");
|
||||
if (gotNewKey) {
|
||||
KeyEditor view =
|
||||
(KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
|
||||
mEditors, false);
|
||||
KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
|
||||
mEditors, false);
|
||||
view.setEditorListener(SectionView.this);
|
||||
boolean isMasterKey = (mEditors.getChildCount() == 0);
|
||||
view.setValue(mNewKey, isMasterKey);
|
||||
@@ -113,19 +112,19 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
public void setType(int type) {
|
||||
mType = type;
|
||||
switch (type) {
|
||||
case Id.type.user_id: {
|
||||
mTitle.setText(R.string.section_userIds);
|
||||
break;
|
||||
}
|
||||
case Id.type.user_id: {
|
||||
mTitle.setText(R.string.section_userIds);
|
||||
break;
|
||||
}
|
||||
|
||||
case Id.type.key: {
|
||||
mTitle.setText(R.string.section_keys);
|
||||
break;
|
||||
}
|
||||
case Id.type.key: {
|
||||
mTitle.setText(R.string.section_keys);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,86 +159,80 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
/** {@inheritDoc} */
|
||||
public void onClick(View v) {
|
||||
switch (mType) {
|
||||
case Id.type.user_id: {
|
||||
UserIdEditor view =
|
||||
(UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item,
|
||||
mEditors, false);
|
||||
view.setEditorListener(this);
|
||||
if (mEditors.getChildCount() == 0) {
|
||||
view.setIsMainUserId(true);
|
||||
}
|
||||
mEditors.addView(view);
|
||||
break;
|
||||
case Id.type.user_id: {
|
||||
UserIdEditor view = (UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item,
|
||||
mEditors, false);
|
||||
view.setEditorListener(this);
|
||||
if (mEditors.getChildCount() == 0) {
|
||||
view.setIsMainUserId(true);
|
||||
}
|
||||
mEditors.addView(view);
|
||||
break;
|
||||
}
|
||||
|
||||
case Id.type.key: {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
|
||||
|
||||
View view = mInflater.inflate(R.layout.create_key, null);
|
||||
dialog.setView(view);
|
||||
dialog.setTitle(R.string.title_createKey);
|
||||
dialog.setMessage(R.string.keyCreationElGamalInfo);
|
||||
|
||||
boolean wouldBeMasterKey = (mEditors.getChildCount() == 0);
|
||||
|
||||
final Spinner algorithm = (Spinner) view.findViewById(R.id.algorithm);
|
||||
Vector<Choice> choices = new Vector<Choice>();
|
||||
choices.add(new Choice(Id.choice.algorithm.dsa, getResources().getString(R.string.dsa)));
|
||||
if (!wouldBeMasterKey) {
|
||||
choices.add(new Choice(Id.choice.algorithm.elgamal, getResources().getString(
|
||||
R.string.elgamal)));
|
||||
}
|
||||
|
||||
case Id.type.key: {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
|
||||
choices.add(new Choice(Id.choice.algorithm.rsa, getResources().getString(R.string.rsa)));
|
||||
|
||||
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);
|
||||
Vector<Choice> choices = new Vector<Choice>();
|
||||
choices.add(new Choice(Id.choice.algorithm.dsa,
|
||||
getResources().getString(R.string.dsa)));
|
||||
if (!wouldBeMasterKey) {
|
||||
choices.add(new Choice(Id.choice.algorithm.elgamal,
|
||||
getResources().getString(R.string.elgamal)));
|
||||
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(getContext(),
|
||||
android.R.layout.simple_spinner_item, choices);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
algorithm.setAdapter(adapter);
|
||||
// make RSA the default
|
||||
for (int i = 0; i < choices.size(); ++i) {
|
||||
if (choices.get(i).getId() == Id.choice.algorithm.rsa) {
|
||||
algorithm.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
choices.add(new Choice(Id.choice.algorithm.rsa,
|
||||
getResources().getString(R.string.rsa)));
|
||||
final EditText keySize = (EditText) view.findViewById(R.id.size);
|
||||
|
||||
ArrayAdapter<Choice> adapter =
|
||||
new ArrayAdapter<Choice>(getContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
choices);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
algorithm.setAdapter(adapter);
|
||||
// make RSA the default
|
||||
for (int i = 0; i < choices.size(); ++i) {
|
||||
if (choices.get(i).getId() == Id.choice.algorithm.rsa) {
|
||||
algorithm.setSelection(i);
|
||||
break;
|
||||
dialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface di, int id) {
|
||||
di.dismiss();
|
||||
try {
|
||||
mNewKeySize = Integer.parseInt("" + keySize.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
mNewKeySize = 0;
|
||||
}
|
||||
|
||||
mNewKeyAlgorithmChoice = (Choice) algorithm.getSelectedItem();
|
||||
createKey();
|
||||
}
|
||||
});
|
||||
|
||||
final EditText keySize = (EditText) view.findViewById(R.id.size);
|
||||
|
||||
dialog.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface di, int id) {
|
||||
di.dismiss();
|
||||
try {
|
||||
mNewKeySize = Integer.parseInt("" + keySize.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
mNewKeySize = 0;
|
||||
dialog.setCancelable(true);
|
||||
dialog.setNegativeButton(android.R.string.cancel,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface di, int id) {
|
||||
di.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
mNewKeyAlgorithmChoice = (Choice) algorithm.getSelectedItem();
|
||||
createKey();
|
||||
}
|
||||
});
|
||||
dialog.create().show();
|
||||
break;
|
||||
}
|
||||
|
||||
dialog.setCancelable(true);
|
||||
dialog.setNegativeButton(android.R.string.cancel,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface di, int id) {
|
||||
di.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.create().show();
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.updateEditorsVisible();
|
||||
}
|
||||
@@ -251,8 +244,8 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
|
||||
mEditors.removeAllViews();
|
||||
for (String userId : list) {
|
||||
UserIdEditor view =
|
||||
(UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item, mEditors, false);
|
||||
UserIdEditor view = (UserIdEditor) mInflater.inflate(R.layout.edit_key_user_id_item,
|
||||
mEditors, false);
|
||||
view.setEditorListener(this);
|
||||
view.setValue(userId);
|
||||
if (mEditors.getChildCount() == 0) {
|
||||
@@ -271,8 +264,8 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
|
||||
mEditors.removeAllViews();
|
||||
for (PGPSecretKey key : list) {
|
||||
KeyEditor view =
|
||||
(KeyEditor) mInflater.inflate(R.layout.edit_key_key_item, mEditors, false);
|
||||
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);
|
||||
@@ -303,10 +296,8 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
||||
} else {
|
||||
passPhrase = "";
|
||||
}
|
||||
mNewKey = Apg.createKey(getContext(),
|
||||
mNewKeyAlgorithmChoice.getId(),
|
||||
mNewKeySize, passPhrase,
|
||||
masterKey);
|
||||
mNewKey = Apg.createKey(getContext(), mNewKeyAlgorithmChoice.getId(), mNewKeySize,
|
||||
passPhrase, masterKey);
|
||||
} catch (NoSuchProviderException e) {
|
||||
error = "" + e;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
|
||||
@@ -40,9 +40,9 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
private EditText mEmail;
|
||||
private EditText mComment;
|
||||
|
||||
private static final Pattern EMAIL_PATTERN =
|
||||
Pattern.compile("^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+[.]([a-zA-Z])+([a-zA-Z])+",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern EMAIL_PATTERN = Pattern.compile(
|
||||
"^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+[.]([a-zA-Z])+([a-zA-Z])+",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
|
||||
public static class NoNameException extends Exception {
|
||||
static final long serialVersionUID = 0xf812773343L;
|
||||
@@ -124,8 +124,8 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
if (email.length() > 0) {
|
||||
Matcher emailMatcher = EMAIL_PATTERN.matcher(email);
|
||||
if (!emailMatcher.matches()) {
|
||||
throw new InvalidEmailException(
|
||||
getContext().getString(R.string.error_invalidEmail, email));
|
||||
throw new InvalidEmailException(getContext().getString(R.string.error_invalidEmail,
|
||||
email));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
final ViewGroup parent = (ViewGroup)getParent();
|
||||
final ViewGroup parent = (ViewGroup) getParent();
|
||||
if (v == mDeleteButton) {
|
||||
boolean wasMainUserId = mIsMainUserId.isChecked();
|
||||
parent.removeView(this);
|
||||
|
||||