refactoring...
@@ -182,7 +182,7 @@
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
android:label="@string/title_keyServerQuery" />
|
||||
<activity
|
||||
android:name=".ui.SendKeyActivity"
|
||||
android:name=".ui.KeyServerExportActivity"
|
||||
android:configChanges="keyboardHidden|orientation|keyboard"
|
||||
android:label="@string/title_sendKey" />
|
||||
<activity
|
||||
|
||||
|
Before Width: | Height: | Size: 956 B |
BIN
org_apg/res/drawable-hdpi/ic_menu_about.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_decrypt.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_encrypt.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_filebrowser.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
org_apg/res/drawable-hdpi/ic_menu_scan_qrcode.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 505 B |
|
Before Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 689 B |
BIN
org_apg/res/drawable-mdpi/ic_menu_about.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
org_apg/res/drawable-mdpi/ic_menu_decrypt.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
org_apg/res/drawable-mdpi/ic_menu_encrypt.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
org_apg/res/drawable-mdpi/ic_menu_filebrowser.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
org_apg/res/drawable-mdpi/ic_menu_scan_qrcode.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 858 B After Width: | Height: | Size: 858 B |
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 863 B |
|
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 866 B |
|
Before Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 359 B |
|
Before Width: | Height: | Size: 460 B |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_about.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_decrypt.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_encrypt.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_filebrowser.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
org_apg/res/drawable-xhdpi/ic_menu_scan_qrcode.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 935 B |
|
Before Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 771 B |
@@ -1,19 +0,0 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/background_noise_tile"
|
||||
android:tileMode="repeat" />
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
<!--
|
||||
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,203 +15,190 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true">
|
||||
android:fillViewport="true"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_margin="10dip"
|
||||
android:fillViewport="true" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="5dip">
|
||||
android:layout_height="wrap_content"
|
||||
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:gravity="center_horizontal|center_vertical"
|
||||
android:text="@string/label_message"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:textColor="#ffffffff"/>
|
||||
android:textColor="#ffffffff" />
|
||||
|
||||
<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:inputType="text|textCapSentences|textMultiLine|textLongMessage"
|
||||
android:scrollHorizontally="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="top"/>
|
||||
|
||||
android:gravity="top"
|
||||
android:inputType="text|textCapSentences|textMultiLine|textLongMessage"
|
||||
android:scrollHorizontally="true" />
|
||||
</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"
|
||||
android:inputType="textNoSuggestions" />
|
||||
|
||||
<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"/>
|
||||
|
||||
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_deleteAfterDecryption"
|
||||
android:text="@string/label_deleteAfterDecryption"
|
||||
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_deleteAfterDecryption"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/deleteAfterDecryption"
|
||||
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>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/signature"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:clickable="true">
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_signature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/signed_large"/>
|
||||
android:src="@drawable/signed_large" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_signature_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/overlay_error"/>
|
||||
|
||||
android:src="@drawable/overlay_error" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingLeft="5dip">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="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="left"/>
|
||||
android:layout_gravity="left"
|
||||
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="left"/>
|
||||
|
||||
android:layout_gravity="left"
|
||||
android:text="Main User Id Rest"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@android:style/ButtonBar">
|
||||
<!-- <LinearLayout -->
|
||||
<!-- style="@android:style/ButtonBar" -->
|
||||
<!-- android:layout_width="fill_parent" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:orientation="horizontal" > -->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_reply"
|
||||
android:text="@string/btn_reply"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"/>
|
||||
<!-- <Button -->
|
||||
<!-- android:id="@+id/btn_reply" -->
|
||||
<!-- android:layout_width="0dip" -->
|
||||
<!-- android:layout_height="fill_parent" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- android:text="@string/btn_reply" /> -->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_decrypt"
|
||||
android:text="@string/btn_decrypt"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"/>
|
||||
<!-- <Button -->
|
||||
<!-- android:id="@+id/btn_decrypt" -->
|
||||
<!-- android:layout_width="0dip" -->
|
||||
<!-- android:layout_height="fill_parent" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- android:text="@string/btn_decrypt" /> -->
|
||||
<!-- </LinearLayout> -->
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,12 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
|
||||
|
||||
<!-- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" -->
|
||||
<!-- android:layout_width="fill_parent" -->
|
||||
<!-- android:layout_height="fill_parent" -->
|
||||
<!-- android:orientation="vertical" -->
|
||||
<!-- android:paddingTop="5dip" > -->
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
@@ -15,7 +9,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
@@ -80,13 +74,14 @@
|
||||
android:id="@+id/filename"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1"
|
||||
android:inputType="textNoSuggestions" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_browse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_launcher_folder_small" />
|
||||
android:src="@drawable/ic_menu_filebrowser" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -178,7 +173,6 @@
|
||||
android:id="@+id/modeLabel"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:text="@string/label_asymmetric"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
@@ -321,25 +315,4 @@
|
||||
android:background="?android:attr/listDivider" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView> <!-- <LinearLayout -->
|
||||
<!-- style="@android:style/ButtonBar" -->
|
||||
<!-- android:layout_width="fill_parent" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:orientation="horizontal" > -->
|
||||
|
||||
<!-- <Button -->
|
||||
<!-- android:id="@+id/btn_encryptToClipboard" -->
|
||||
<!-- android:layout_width="0dip" -->
|
||||
<!-- android:layout_height="fill_parent" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- android:text="@string/btn_encryptToClipboard" /> -->
|
||||
|
||||
<!-- <Button -->
|
||||
<!-- android:id="@+id/btn_encrypt" -->
|
||||
<!-- android:layout_width="0dip" -->
|
||||
<!-- android:layout_height="fill_parent" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- android:text="@string/btn_encrypt" /> -->
|
||||
<!-- </LinearLayout> -->
|
||||
|
||||
<!-- </LinearLayout> -->
|
||||
</ScrollView>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
<!--
|
||||
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,37 +15,35 @@
|
||||
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="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="5dip"
|
||||
android:paddingRight="5dip">
|
||||
android:paddingRight="5dip" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/input"
|
||||
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_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_menu_filebrowser" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"/>
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
<!--
|
||||
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,29 +15,20 @@
|
||||
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:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
<Spinner
|
||||
android:id="@+id/keyServer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_export_to_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:text="@string/btn_export_to_server" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/keyServer"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_export_to_server"
|
||||
android:text="@string/btn_export_to_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
public class CachedPassPhrase {
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
@@ -37,8 +37,6 @@ public class FileDialog {
|
||||
private static ImageButton mBrowse;
|
||||
private static CheckBox mCheckBox;
|
||||
private static Activity mActivity;
|
||||
private static String mFileManagerTitle;
|
||||
private static String mFileManagerButton;
|
||||
private static int mRequestCode;
|
||||
|
||||
public static interface OnClickListener {
|
||||
@@ -70,8 +68,6 @@ public class FileDialog {
|
||||
openFile();
|
||||
}
|
||||
});
|
||||
mFileManagerTitle = fileManagerTitle;
|
||||
mFileManagerButton = fileManagerButton;
|
||||
mRequestCode = requestCode;
|
||||
mCheckBox = (CheckBox) view.findViewById(R.id.checkbox);
|
||||
if (checkboxText == null) {
|
||||
@@ -121,7 +117,7 @@ public class FileDialog {
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
|
||||
intent.setData(Uri.parse("file://" + filename));
|
||||
intent.setType("*/*");
|
||||
intent.setType("text/plain"); // only .asc or .gpg files
|
||||
|
||||
try {
|
||||
mActivity.startActivityForResult(intent, mRequestCode);
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
public class PausableThread extends Thread {
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import org.spongycastle.bcpg.HashAlgorithmTags;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.provider;
|
||||
|
||||
import org.apg.ApgService;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.provider;
|
||||
|
||||
import org.apg.ApgService;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.provider;
|
||||
|
||||
import org.apg.Apg;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import org.apg.Constants;
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.apg.ui;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.AskForSecretKeyPassPhrase;
|
||||
@@ -33,24 +32,18 @@ import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class BaseActivity extends SherlockActivity implements Runnable, ProgressDialogUpdater,
|
||||
|
||||
@@ -31,6 +31,9 @@ import org.spongycastle.openpgp.PGPException;
|
||||
import org.spongycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
@@ -43,7 +46,6 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
@@ -85,8 +87,13 @@ public class DecryptActivity extends BaseActivity {
|
||||
private ImageView mSourcePrevious = null;
|
||||
private ImageView mSourceNext = null;
|
||||
|
||||
private Button mDecryptButton = null;
|
||||
private Button mReplyButton = null;
|
||||
// private Button mDecryptButton = null;
|
||||
// private Button mReplyButton = null;
|
||||
|
||||
private boolean mDecryptEnabled = true;
|
||||
private String mDecryptString = "";
|
||||
private boolean mReplyEnabled = true;
|
||||
private String mReplyString = "";
|
||||
|
||||
private int mDecryptTarget;
|
||||
|
||||
@@ -106,6 +113,25 @@ public class DecryptActivity extends BaseActivity {
|
||||
|
||||
private long mUnknownSignatureKeyId = 0;
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
if (mDecryptEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mDecryptString)
|
||||
// .setIcon(R.drawable.ic_menu_encrypt)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
if (mReplyEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt, 1, mReplyString)
|
||||
// .setIcon(R.drawable.ic_menu_decrypt)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -145,8 +171,8 @@ public class DecryptActivity extends BaseActivity {
|
||||
mSourceLabel.setOnClickListener(nextSourceClickListener);
|
||||
|
||||
mMessage = (EditText) findViewById(R.id.message);
|
||||
mDecryptButton = (Button) findViewById(R.id.btn_decrypt);
|
||||
mReplyButton = (Button) findViewById(R.id.btn_reply);
|
||||
// mDecryptButton = (Button) findViewById(R.id.btn_decrypt);
|
||||
// mReplyButton = (Button) findViewById(R.id.btn_reply);
|
||||
mSignatureLayout = (LinearLayout) findViewById(R.id.signature);
|
||||
mSignatureStatusImage = (ImageView) findViewById(R.id.ic_signature_status);
|
||||
mUserId = (TextView) findViewById(R.id.mainUserId);
|
||||
@@ -230,7 +256,8 @@ public class DecryptActivity extends BaseActivity {
|
||||
// replace non breakable spaces
|
||||
textData = textData.replaceAll("\\xa0", " ");
|
||||
mMessage.setText(textData);
|
||||
mDecryptButton.setText(R.string.btn_verify);
|
||||
mDecryptString = getString(R.string.btn_verify);
|
||||
// mDecryptButton.setText(R.string.btn_verify);
|
||||
} else {
|
||||
Log.d(Constants.TAG, "Nothing matched!");
|
||||
}
|
||||
@@ -276,7 +303,9 @@ public class DecryptActivity extends BaseActivity {
|
||||
// replace non breakable spaces
|
||||
data = data.replaceAll("\\xa0", " ");
|
||||
mMessage.setText(data);
|
||||
mDecryptButton.setText(R.string.btn_verify);
|
||||
mDecryptString = getString(R.string.btn_verify);
|
||||
|
||||
// mDecryptButton.setText(R.string.btn_verify);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,18 +348,20 @@ public class DecryptActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
mDecryptButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
decryptClicked();
|
||||
}
|
||||
});
|
||||
// mDecryptButton.setOnClickListener(new OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// decryptClicked();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mReplyButton.setOnClickListener(new OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// replyClicked();
|
||||
// }
|
||||
// });
|
||||
// mReplyButton.setVisibility(View.INVISIBLE);
|
||||
|
||||
mReplyButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
replyClicked();
|
||||
}
|
||||
});
|
||||
mReplyButton.setVisibility(View.INVISIBLE);
|
||||
mReplyEnabled = false;
|
||||
|
||||
if (mReturnResult) {
|
||||
mSourcePrevious.setClickable(false);
|
||||
@@ -349,7 +380,8 @@ public class DecryptActivity extends BaseActivity {
|
||||
|
||||
if (mSource.getCurrentView().getId() == R.id.sourceMessage
|
||||
&& (mMessage.getText().length() > 0 || mData != null || mContentUri != null)) {
|
||||
mDecryptButton.performClick();
|
||||
// mDecryptButton.performClick();
|
||||
decryptClicked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,13 +416,16 @@ public class DecryptActivity extends BaseActivity {
|
||||
switch (mSource.getCurrentView().getId()) {
|
||||
case R.id.sourceFile: {
|
||||
mSourceLabel.setText(R.string.label_file);
|
||||
mDecryptButton.setText(R.string.btn_decrypt);
|
||||
// mDecryptButton.setText(R.string.btn_decrypt);
|
||||
mDecryptString = getString(R.string.btn_decrypt);
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.sourceMessage: {
|
||||
mSourceLabel.setText(R.string.label_message);
|
||||
mDecryptButton.setText(R.string.btn_decrypt);
|
||||
// mDecryptButton.setText(R.string.btn_decrypt);
|
||||
mDecryptString = getString(R.string.btn_decrypt);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -598,7 +633,8 @@ public class DecryptActivity extends BaseActivity {
|
||||
removeDialog(Id.dialog.decrypting);
|
||||
mSignatureKeyId = 0;
|
||||
mSignatureLayout.setVisibility(View.GONE);
|
||||
mReplyButton.setVisibility(View.INVISIBLE);
|
||||
// mReplyButton.setVisibility(View.INVISIBLE);
|
||||
mReplyEnabled = false;
|
||||
|
||||
String error = data.getString(Apg.EXTRA_ERROR);
|
||||
if (error != null) {
|
||||
@@ -621,7 +657,8 @@ public class DecryptActivity extends BaseActivity {
|
||||
String decryptedMessage = data.getString(Apg.EXTRA_DECRYPTED_MESSAGE);
|
||||
mMessage.setText(decryptedMessage);
|
||||
mMessage.setHorizontallyScrolling(false);
|
||||
mReplyButton.setVisibility(View.VISIBLE);
|
||||
// mReplyButton.setVisibility(View.VISIBLE);
|
||||
mReplyEnabled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +59,6 @@ public class EditKeyActivity extends BaseActivity {
|
||||
private SectionView mUserIds;
|
||||
private SectionView mKeys;
|
||||
|
||||
// private Button mSaveButton;
|
||||
// private Button mDiscardButton;
|
||||
|
||||
private String mCurrentPassPhrase = null;
|
||||
private String mNewPassPhrase = null;
|
||||
|
||||
@@ -162,10 +159,6 @@ public class EditKeyActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
updatePassPhraseButtonText();
|
||||
|
||||
// Toast.makeText(this,
|
||||
// getString(R.string.warningMessage, getString(R.string.keyEditingIsBeta)),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
private long getMasterKeyId() {
|
||||
@@ -180,15 +173,6 @@ public class EditKeyActivity extends BaseActivity {
|
||||
|| (mNewPassPhrase != null && !mNewPassPhrase.equals(""));
|
||||
}
|
||||
|
||||
// @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
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
switch (id) {
|
||||
@@ -245,15 +229,6 @@ public class EditKeyActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
// public void onClick(View v) {
|
||||
// if (v == mSaveButton) {
|
||||
// // TODO: some warning
|
||||
// saveClicked();
|
||||
// } else if (v == mDiscardButton) {
|
||||
// finish();
|
||||
// }
|
||||
// }
|
||||
|
||||
private void saveClicked() {
|
||||
if (!havePassPhrase()) {
|
||||
Toast.makeText(this, R.string.setAPassPhrase, Toast.LENGTH_SHORT).show();
|
||||
|
||||
@@ -76,10 +76,9 @@ public class EncryptActivity extends BaseActivity {
|
||||
private boolean mReturnResult = false;
|
||||
private EditText mMessage = null;
|
||||
private Button mSelectKeysButton = null;
|
||||
// private Button mEncryptButton = null;
|
||||
|
||||
private boolean mEncryptEnabled = false;
|
||||
private String mEncryptString = "";
|
||||
// private Button mEncryptToClipboardButton = null;
|
||||
private boolean mEncryptToClipboardEnabled = false;
|
||||
private String mEncryptToClipboardString = "";
|
||||
|
||||
@@ -126,12 +125,15 @@ public class EncryptActivity extends BaseActivity {
|
||||
|
||||
if (mEncryptToClipboardEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mEncryptToClipboardString)
|
||||
// .setIcon(R.drawable.ic_menu_encrypt)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
if (mEncryptEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt, 1, mEncryptString).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
menu.add(1, Id.menu.option.encrypt, 1, mEncryptString)
|
||||
// .setIcon(R.drawable.ic_menu_decrypt)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -231,8 +233,8 @@ public class EncryptActivity extends BaseActivity {
|
||||
|
||||
mMessage = (EditText) findViewById(R.id.message);
|
||||
mSelectKeysButton = (Button) findViewById(R.id.btn_selectEncryptKeys);
|
||||
// mEncryptButton = (Button) findViewById(R.id.btn_encrypt);
|
||||
// mEncryptToClipboardButton = (Button) findViewById(R.id.btn_encryptToClipboard);
|
||||
// mEncryptButton = (Button) findViewById(R.id.btn_encrypt);
|
||||
// mEncryptToClipboardButton = (Button) findViewById(R.id.btn_encryptToClipboard);
|
||||
mSign = (CheckBox) findViewById(R.id.sign);
|
||||
mMainUserId = (TextView) findViewById(R.id.mainUserId);
|
||||
mMainUserIdRest = (TextView) findViewById(R.id.mainUserIdRest);
|
||||
@@ -286,18 +288,6 @@ public class EncryptActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
// mEncryptToClipboardButton.setOnClickListener(new OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// encryptToClipboardClicked();
|
||||
// }
|
||||
// });
|
||||
|
||||
// mEncryptButton.setOnClickListener(new OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// encryptClicked();
|
||||
// }
|
||||
// });
|
||||
|
||||
mSelectKeysButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
selectPublicKeys();
|
||||
@@ -502,81 +492,50 @@ public class EncryptActivity extends BaseActivity {
|
||||
mSourceLabel.setText(R.string.label_message);
|
||||
if (mReturnResult) {
|
||||
mEncryptToClipboardEnabled = false;
|
||||
// mEncryptToClipboardButton.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mEncryptToClipboardEnabled = true;
|
||||
// mEncryptToClipboardButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
|
||||
if (mReturnResult) {
|
||||
mEncryptString = getString(R.string.btn_encrypt);
|
||||
// mEncryptButton.setText(R.string.btn_encrypt);
|
||||
} else {
|
||||
mEncryptString = getString(R.string.btn_encryptAndEmail);
|
||||
|
||||
// mEncryptButton.setText(R.string.btn_encryptAndEmail);
|
||||
}
|
||||
mEncryptEnabled = true;
|
||||
mEncryptToClipboardString = getString(R.string.btn_encryptToClipboard);
|
||||
mEncryptToClipboardEnabled = true;
|
||||
|
||||
// mEncryptButton.setEnabled(true);
|
||||
// mEncryptToClipboardButton.setText(R.string.btn_encryptToClipboard);
|
||||
// mEncryptToClipboardButton.setEnabled(true);
|
||||
} else {
|
||||
if (mEncryptionKeyIds == null || mEncryptionKeyIds.length == 0) {
|
||||
if (getSecretKeyId() == 0) {
|
||||
if (mReturnResult) {
|
||||
mEncryptString = getString(R.string.btn_encrypt);
|
||||
// mEncryptButton.setText(R.string.btn_encrypt);
|
||||
} else {
|
||||
mEncryptString = getString(R.string.btn_encryptAndEmail);
|
||||
|
||||
// mEncryptButton.setText(R.string.btn_encryptAndEmail);
|
||||
}
|
||||
mEncryptEnabled = false;
|
||||
mEncryptToClipboardString = getString(R.string.btn_encryptToClipboard);
|
||||
mEncryptToClipboardEnabled = false;
|
||||
|
||||
// mEncryptButton.setEnabled(false);
|
||||
// mEncryptToClipboardButton.setText(R.string.btn_encryptToClipboard);
|
||||
// mEncryptToClipboardButton.setEnabled(false);
|
||||
} else {
|
||||
if (mReturnResult) {
|
||||
mEncryptString = getString(R.string.btn_sign);
|
||||
|
||||
// mEncryptButton.setText(R.string.btn_sign);
|
||||
} else {
|
||||
mEncryptString = getString(R.string.btn_signAndEmail);
|
||||
|
||||
// mEncryptButton.setText(R.string.btn_signAndEmail);
|
||||
}
|
||||
|
||||
mEncryptEnabled = true;
|
||||
mEncryptToClipboardString = getString(R.string.btn_signToClipboard);
|
||||
mEncryptToClipboardEnabled = true;
|
||||
|
||||
// mEncryptButton.setEnabled(true);
|
||||
// mEncryptToClipboardButton.setText(R.string.btn_signToClipboard);
|
||||
// mEncryptToClipboardButton.setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
if (mReturnResult) {
|
||||
mEncryptString = getString(R.string.btn_encrypt);
|
||||
|
||||
// mEncryptButton.setText(R.string.btn_encrypt);
|
||||
} else {
|
||||
mEncryptString = getString(R.string.btn_encryptAndEmail);
|
||||
|
||||
// mEncryptButton.setText(R.string.btn_encryptAndEmail);
|
||||
}
|
||||
|
||||
mEncryptEnabled = true;
|
||||
mEncryptToClipboardString = getString(R.string.btn_encryptToClipboard);
|
||||
mEncryptToClipboardEnabled = true;
|
||||
// mEncryptButton.setEnabled(true);
|
||||
// mEncryptToClipboardButton.setText(R.string.btn_encryptToClipboard);
|
||||
// mEncryptToClipboardButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.Constants;
|
||||
import org.apg.HkpKeyServer;
|
||||
import org.apg.Id;
|
||||
import org.apg.Constants.extras;
|
||||
import org.apg.Id.message;
|
||||
import org.spongycastle.openpgp.PGPKeyRing;
|
||||
import org.spongycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
@@ -24,11 +39,26 @@ import android.widget.Toast;
|
||||
*
|
||||
* Sends the selected public key to a key server
|
||||
*/
|
||||
public class SendKeyActivity extends BaseActivity {
|
||||
public class KeyServerExportActivity extends BaseActivity {
|
||||
|
||||
private Button export;
|
||||
private Spinner keyServer;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case android.R.id.home:
|
||||
startActivity(new Intent(this, PublicKeyListActivity.class));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -38,7 +68,8 @@ public class SendKeyActivity extends BaseActivity {
|
||||
export = (Button) findViewById(R.id.btn_export_to_server);
|
||||
keyServer = (Spinner) findViewById(R.id.keyServer);
|
||||
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mPreferences.getKeyServers());
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_spinner_item, mPreferences.getKeyServers());
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
keyServer.setAdapter(adapter);
|
||||
if (adapter.getCount() > 0) {
|
||||
@@ -90,7 +121,8 @@ public class SendKeyActivity extends BaseActivity {
|
||||
Bundle data = msg.getData();
|
||||
String error = data.getString(Apg.EXTRA_ERROR);
|
||||
if (error != null) {
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import java.util.List;
|
||||
@@ -13,6 +27,8 @@ import org.apg.KeyServer.QueryException;
|
||||
import org.apg.KeyServer.TooManyResponses;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -50,6 +66,21 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
private volatile List<KeyInfo> mSearchResult;
|
||||
private volatile String mKeyData;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case android.R.id.home:
|
||||
startActivity(new Intent(this, PublicKeyListActivity.class));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -63,10 +94,8 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
mList.setAdapter(mAdapter);
|
||||
|
||||
mKeyServer = (Spinner) findViewById(R.id.keyServer);
|
||||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_spinner_item,
|
||||
mPreferences.getKeyServers());
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_spinner_item, mPreferences.getKeyServers());
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mKeyServer.setAdapter(adapter);
|
||||
if (adapter.getCount() > 0) {
|
||||
@@ -89,8 +118,8 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
});
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (Apg.Intent.LOOK_UP_KEY_ID.equals(intent.getAction()) ||
|
||||
Apg.Intent.LOOK_UP_KEY_ID_AND_RETURN.equals(intent.getAction())) {
|
||||
if (Apg.Intent.LOOK_UP_KEY_ID.equals(intent.getAction())
|
||||
|| Apg.Intent.LOOK_UP_KEY_ID_AND_RETURN.equals(intent.getAction())) {
|
||||
long keyId = intent.getLongExtra(Apg.EXTRA_KEY_ID, 0);
|
||||
if (keyId != 0) {
|
||||
String query = "0x" + Apg.keyToHex(keyId);
|
||||
@@ -116,10 +145,10 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
protected Dialog onCreateDialog(int id) {
|
||||
ProgressDialog progress = (ProgressDialog) super.onCreateDialog(id);
|
||||
progress.setMessage(this.getString(R.string.progress_queryingServer,
|
||||
(String)mKeyServer.getSelectedItem()));
|
||||
(String) mKeyServer.getSelectedItem()));
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -130,7 +159,7 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
Message msg = new Message();
|
||||
|
||||
try {
|
||||
HkpKeyServer server = new HkpKeyServer((String)mKeyServer.getSelectedItem());
|
||||
HkpKeyServer server = new HkpKeyServer((String) mKeyServer.getSelectedItem());
|
||||
if (mQueryType == Id.keyserver.search) {
|
||||
mSearchResult = server.search(mQueryString);
|
||||
} else if (mQueryType == Id.keyserver.get) {
|
||||
@@ -163,13 +192,15 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
Bundle data = msg.getData();
|
||||
String error = data.getString(Apg.EXTRA_ERROR);
|
||||
if (error != null) {
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mQueryType == Id.keyserver.search) {
|
||||
if (mSearchResult != null) {
|
||||
Toast.makeText(this, getString(R.string.keysFound, mSearchResult.size()), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, getString(R.string.keysFound, mSearchResult.size()),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
mAdapter.setKeys(mSearchResult);
|
||||
}
|
||||
} else if (mQueryType == Id.keyserver.get) {
|
||||
@@ -284,7 +315,8 @@ public class KeyServerQueryActivity extends BaseActivity {
|
||||
sep.setBackgroundResource(android.R.drawable.divider_horizontal_dark);
|
||||
ll.addView(sep);
|
||||
}
|
||||
TextView uidView = (TextView) mInflater.inflate(R.layout.key_server_query_result_user_id, null);
|
||||
TextView uidView = (TextView) mInflater.inflate(
|
||||
R.layout.key_server_query_result_user_id, null);
|
||||
uidView.setText(uid);
|
||||
ll.addView(uidView);
|
||||
second = false;
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
package org.apg.ui;
|
||||
|
||||
import java.security.Security;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.Id;
|
||||
@@ -26,26 +24,16 @@ 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;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.util.Linkify;
|
||||
import android.text.util.Linkify.TransformFilter;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
static {
|
||||
@@ -184,10 +172,10 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.preferences, 0, R.string.menu_preferences)
|
||||
.setIcon(R.drawable.ic_menu_settings_holo_light)
|
||||
.setIcon(R.drawable.ic_menu_settings)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(0, Id.menu.option.about, 1, R.string.menu_about).setIcon(R.drawable.ic_menu_about)
|
||||
.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;
|
||||
}
|
||||
|
||||
@@ -211,53 +199,6 @@ public class MainActivity extends BaseActivity {
|
||||
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);
|
||||
|
||||
@@ -20,10 +20,6 @@ import org.apg.Apg;
|
||||
import org.apg.Constants;
|
||||
import org.apg.Id;
|
||||
import org.apg.Preferences;
|
||||
import org.apg.Constants.pref;
|
||||
import org.apg.Id.choice;
|
||||
import org.apg.Id.request;
|
||||
import org.apg.Id.choice.compression;
|
||||
import org.apg.ui.widget.IntegerListPreference;
|
||||
import org.spongycastle.bcpg.HashAlgorithmTags;
|
||||
import org.spongycastle.openpgp.PGPEncryptedData;
|
||||
@@ -36,17 +32,11 @@ import com.actionbarsherlock.view.MenuItem;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Vector;
|
||||
|
||||
public class PreferencesActivity extends SherlockPreferenceActivity {
|
||||
private ListPreference mLanguage = null;
|
||||
private IntegerListPreference mPassPhraseCacheTtl = null;
|
||||
private IntegerListPreference mEncryptionAlgorithm = null;
|
||||
private IntegerListPreference mHashAlgorithm = null;
|
||||
|
||||
@@ -19,15 +19,9 @@ package org.apg.ui;
|
||||
import org.apg.Apg;
|
||||
import org.apg.Constants;
|
||||
import org.apg.Id;
|
||||
import org.apg.Constants.path;
|
||||
import org.apg.Id.menu;
|
||||
import org.apg.Id.request;
|
||||
import org.apg.Id.type;
|
||||
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;
|
||||
|
||||
@@ -50,15 +44,13 @@ public class PublicKeyListActivity extends KeyListActivity {
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(1, Id.menu.option.search, 0, R.string.menu_search)
|
||||
.setIcon(R.drawable.ic_menu_search_holo_light)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
.setIcon(R.drawable.ic_menu_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
menu.add(1, Id.menu.option.scanQRCode, 1, R.string.menu_scanQRCode)
|
||||
// .setIcon(R.drawable.ic_suggestions_add)
|
||||
.setIcon(R.drawable.ic_menu_scan_qrcode)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
|
||||
menu.add(1, Id.menu.option.key_server, 2, R.string.menu_keyServer)
|
||||
.setIcon(R.drawable.ic_menu_find_holo_light)
|
||||
.setIcon(R.drawable.ic_menu_search_list)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
menu.add(0, Id.menu.option.import_keys, 3, R.string.menu_importKeys)
|
||||
@@ -145,7 +137,7 @@ public class PublicKeyListActivity extends KeyListActivity {
|
||||
mSelectedItem = groupPosition;
|
||||
final int keyRingId = mListAdapter.getKeyRingId(groupPosition);
|
||||
|
||||
Intent intent = new Intent(this, SendKeyActivity.class);
|
||||
Intent intent = new Intent(this, KeyServerExportActivity.class);
|
||||
intent.setAction(Apg.Intent.EXPORT_KEY_TO_SERVER);
|
||||
intent.putExtra(Apg.EXTRA_KEY_ID, keyRingId);
|
||||
startActivityForResult(intent, Id.request.export_to_server);
|
||||
|
||||
@@ -20,12 +20,6 @@ import org.apg.Apg;
|
||||
import org.apg.AskForSecretKeyPassPhrase;
|
||||
import org.apg.Constants;
|
||||
import org.apg.Id;
|
||||
import org.apg.Constants.path;
|
||||
import org.apg.Id.dialog;
|
||||
import org.apg.Id.menu;
|
||||
import org.apg.Id.message;
|
||||
import org.apg.Id.type;
|
||||
import org.apg.Id.menu.option;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
@@ -55,10 +49,10 @@ public class SecretKeyListActivity extends KeyListActivity implements OnChildCli
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(3, Id.menu.option.search, 0, R.string.menu_search)
|
||||
.setIcon(R.drawable.ic_menu_search_holo_light)
|
||||
.setIcon(R.drawable.ic_menu_search_list)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
menu.add(1, Id.menu.option.create, 1, R.string.menu_createKey)
|
||||
.setIcon(R.drawable.ic_suggestions_add)
|
||||
// .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)
|
||||
|
||||
@@ -20,11 +20,8 @@ import java.util.Vector;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.Id;
|
||||
import org.apg.Id.menu;
|
||||
import org.apg.Id.menu.option;
|
||||
import org.apg.R;
|
||||
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
|
||||
import android.app.SearchManager;
|
||||
@@ -167,8 +164,8 @@ public class SelectPublicKeyListActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.search, 0, R.string.menu_search)
|
||||
.setIcon(android.R.drawable.ic_menu_search);
|
||||
menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
|
||||
android.R.drawable.ic_menu_search);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.Date;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.Id;
|
||||
import org.apg.Id.database;
|
||||
import org.apg.provider.KeyRings;
|
||||
import org.apg.provider.Keys;
|
||||
import org.apg.provider.UserIds;
|
||||
@@ -48,25 +47,23 @@ public class SelectPublicKeyListAdapter extends BaseAdapter {
|
||||
protected String mSearchString;
|
||||
protected Activity mActivity;
|
||||
|
||||
public SelectPublicKeyListAdapter(Activity activity, ListView parent,
|
||||
String searchString, long selectedKeyIds[]) {
|
||||
public SelectPublicKeyListAdapter(Activity activity, ListView parent, String searchString,
|
||||
long selectedKeyIds[]) {
|
||||
mSearchString = searchString;
|
||||
|
||||
mActivity = activity;
|
||||
mParent = parent;
|
||||
mDatabase = Apg.getDatabase().db();
|
||||
mInflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
mDatabase = Apg.getDatabase().db();
|
||||
mInflater = (LayoutInflater) parent.getContext().getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
long now = new Date().getTime() / 1000;
|
||||
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
||||
qb.setTables(KeyRings.TABLE_NAME + " INNER JOIN " + Keys.TABLE_NAME + " ON " +
|
||||
"(" + KeyRings.TABLE_NAME + "." + KeyRings._ID + " = " +
|
||||
Keys.TABLE_NAME + "." + Keys.KEY_RING_ID + " AND " +
|
||||
Keys.TABLE_NAME + "." + Keys.IS_MASTER_KEY + " = '1'" +
|
||||
") " +
|
||||
" INNER JOIN " + UserIds.TABLE_NAME + " ON " +
|
||||
"(" + Keys.TABLE_NAME + "." + Keys._ID + " = " +
|
||||
UserIds.TABLE_NAME + "." + UserIds.KEY_ID + " AND " +
|
||||
UserIds.TABLE_NAME + "." + UserIds.RANK + " = '0') ");
|
||||
qb.setTables(KeyRings.TABLE_NAME + " INNER JOIN " + Keys.TABLE_NAME + " ON " + "("
|
||||
+ KeyRings.TABLE_NAME + "." + KeyRings._ID + " = " + Keys.TABLE_NAME + "."
|
||||
+ Keys.KEY_RING_ID + " AND " + Keys.TABLE_NAME + "." + Keys.IS_MASTER_KEY
|
||||
+ " = '1'" + ") " + " INNER JOIN " + UserIds.TABLE_NAME + " ON " + "("
|
||||
+ Keys.TABLE_NAME + "." + Keys._ID + " = " + UserIds.TABLE_NAME + "."
|
||||
+ UserIds.KEY_ID + " AND " + UserIds.TABLE_NAME + "." + UserIds.RANK + " = '0') ");
|
||||
|
||||
String inIdList = null;
|
||||
|
||||
@@ -83,10 +80,9 @@ public class SelectPublicKeyListAdapter extends BaseAdapter {
|
||||
|
||||
if (searchString != null && searchString.trim().length() > 0) {
|
||||
String[] chunks = searchString.trim().split(" +");
|
||||
qb.appendWhere("(EXISTS (SELECT tmp." + UserIds._ID + " FROM " +
|
||||
UserIds.TABLE_NAME + " AS tmp WHERE " +
|
||||
"tmp." + UserIds.KEY_ID + " = " +
|
||||
Keys.TABLE_NAME + "." + Keys._ID);
|
||||
qb.appendWhere("(EXISTS (SELECT tmp." + UserIds._ID + " FROM " + UserIds.TABLE_NAME
|
||||
+ " AS tmp WHERE " + "tmp." + UserIds.KEY_ID + " = " + Keys.TABLE_NAME + "."
|
||||
+ Keys._ID);
|
||||
for (int i = 0; i < chunks.length; ++i) {
|
||||
qb.appendWhere(" AND tmp." + UserIds.USER_ID + " LIKE ");
|
||||
qb.appendWhereEscapeString("%" + chunks[i] + "%");
|
||||
@@ -103,28 +99,22 @@ public class SelectPublicKeyListAdapter extends BaseAdapter {
|
||||
orderBy = inIdList + " DESC, " + orderBy;
|
||||
}
|
||||
|
||||
mCursor = qb.query(mDatabase,
|
||||
new String[] {
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID, // 0
|
||||
KeyRings.TABLE_NAME + "." + KeyRings.MASTER_KEY_ID, // 1
|
||||
UserIds.TABLE_NAME + "." + UserIds.USER_ID, // 2
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE " +
|
||||
"tmp." + Keys.KEY_RING_ID + " = " +
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID + " AND " +
|
||||
"tmp." + Keys.IS_REVOKED + " = '0' AND " +
|
||||
"tmp." + Keys.CAN_ENCRYPT + " = '1')", // 3
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE " +
|
||||
"tmp." + Keys.KEY_RING_ID + " = " +
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID + " AND " +
|
||||
"tmp." + Keys.IS_REVOKED + " = '0' AND " +
|
||||
"tmp." + Keys.CAN_ENCRYPT + " = '1' AND " +
|
||||
"tmp." + Keys.CREATION + " <= '" + now + "' AND " +
|
||||
"(tmp." + Keys.EXPIRY + " IS NULL OR " +
|
||||
"tmp." + Keys.EXPIRY + " >= '" + now + "'))", // 4
|
||||
},
|
||||
KeyRings.TABLE_NAME + "." + KeyRings.TYPE + " = ?",
|
||||
new String[] { "" + Id.database.type_public },
|
||||
null, null, orderBy);
|
||||
mCursor = qb.query(mDatabase, new String[] {
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID, // 0
|
||||
KeyRings.TABLE_NAME + "." + KeyRings.MASTER_KEY_ID, // 1
|
||||
UserIds.TABLE_NAME + "." + UserIds.USER_ID, // 2
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE "
|
||||
+ "tmp." + Keys.KEY_RING_ID + " = " + KeyRings.TABLE_NAME + "."
|
||||
+ KeyRings._ID + " AND " + "tmp." + Keys.IS_REVOKED + " = '0' AND "
|
||||
+ "tmp." + Keys.CAN_ENCRYPT + " = '1')", // 3
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE "
|
||||
+ "tmp." + Keys.KEY_RING_ID + " = " + KeyRings.TABLE_NAME + "."
|
||||
+ KeyRings._ID + " AND " + "tmp." + Keys.IS_REVOKED + " = '0' AND "
|
||||
+ "tmp." + Keys.CAN_ENCRYPT + " = '1' AND " + "tmp." + Keys.CREATION
|
||||
+ " <= '" + now + "' AND " + "(tmp." + Keys.EXPIRY + " IS NULL OR "
|
||||
+ "tmp." + Keys.EXPIRY + " >= '" + now + "'))", // 4
|
||||
}, KeyRings.TABLE_NAME + "." + KeyRings.TYPE + " = ?", new String[] { ""
|
||||
+ Id.database.type_public }, null, null, orderBy);
|
||||
|
||||
activity.startManagingCursor(mCursor);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,8 @@ package org.apg.ui;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.Id;
|
||||
import org.apg.Id.menu;
|
||||
import org.apg.Id.menu.option;
|
||||
import org.apg.R;
|
||||
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
|
||||
import android.app.SearchManager;
|
||||
@@ -59,7 +56,7 @@ public class SelectSecretKeyListActivity extends BaseActivity {
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(Apg.EXTRA_KEY_ID, id);
|
||||
data.putExtra(Apg.EXTRA_USER_ID, (String)mList.getItemAtPosition(position));
|
||||
data.putExtra(Apg.EXTRA_USER_ID, (String) mList.getItemAtPosition(position));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
@@ -110,8 +107,8 @@ public class SelectSecretKeyListActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, Id.menu.option.search, 0, R.string.menu_search)
|
||||
.setIcon(android.R.drawable.ic_menu_search);
|
||||
menu.add(0, Id.menu.option.search, 0, R.string.menu_search).setIcon(
|
||||
android.R.drawable.ic_menu_search);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apg.Apg;
|
||||
import org.apg.Id;
|
||||
import org.apg.Id.database;
|
||||
import org.apg.provider.KeyRings;
|
||||
import org.apg.provider.Keys;
|
||||
import org.apg.provider.UserIds;
|
||||
@@ -35,26 +48,23 @@ public class SelectSecretKeyListAdapter extends BaseAdapter {
|
||||
|
||||
mActivity = activity;
|
||||
mParent = parent;
|
||||
mDatabase = Apg.getDatabase().db();
|
||||
mInflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
mDatabase = Apg.getDatabase().db();
|
||||
mInflater = (LayoutInflater) parent.getContext().getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
long now = new Date().getTime() / 1000;
|
||||
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
|
||||
qb.setTables(KeyRings.TABLE_NAME + " INNER JOIN " + Keys.TABLE_NAME + " ON " +
|
||||
"(" + KeyRings.TABLE_NAME + "." + KeyRings._ID + " = " +
|
||||
Keys.TABLE_NAME + "." + Keys.KEY_RING_ID + " AND " +
|
||||
Keys.TABLE_NAME + "." + Keys.IS_MASTER_KEY + " = '1'" +
|
||||
") " +
|
||||
" INNER JOIN " + UserIds.TABLE_NAME + " ON " +
|
||||
"(" + Keys.TABLE_NAME + "." + Keys._ID + " = " +
|
||||
UserIds.TABLE_NAME + "." + UserIds.KEY_ID + " AND " +
|
||||
UserIds.TABLE_NAME + "." + UserIds.RANK + " = '0') ");
|
||||
qb.setTables(KeyRings.TABLE_NAME + " INNER JOIN " + Keys.TABLE_NAME + " ON " + "("
|
||||
+ KeyRings.TABLE_NAME + "." + KeyRings._ID + " = " + Keys.TABLE_NAME + "."
|
||||
+ Keys.KEY_RING_ID + " AND " + Keys.TABLE_NAME + "." + Keys.IS_MASTER_KEY
|
||||
+ " = '1'" + ") " + " INNER JOIN " + UserIds.TABLE_NAME + " ON " + "("
|
||||
+ Keys.TABLE_NAME + "." + Keys._ID + " = " + UserIds.TABLE_NAME + "."
|
||||
+ UserIds.KEY_ID + " AND " + UserIds.TABLE_NAME + "." + UserIds.RANK + " = '0') ");
|
||||
|
||||
if (searchString != null && searchString.trim().length() > 0) {
|
||||
String[] chunks = searchString.trim().split(" +");
|
||||
qb.appendWhere("EXISTS (SELECT tmp." + UserIds._ID + " FROM " +
|
||||
UserIds.TABLE_NAME + " AS tmp WHERE " +
|
||||
"tmp." + UserIds.KEY_ID + " = " +
|
||||
Keys.TABLE_NAME + "." + Keys._ID);
|
||||
qb.appendWhere("EXISTS (SELECT tmp." + UserIds._ID + " FROM " + UserIds.TABLE_NAME
|
||||
+ " AS tmp WHERE " + "tmp." + UserIds.KEY_ID + " = " + Keys.TABLE_NAME + "."
|
||||
+ Keys._ID);
|
||||
for (int i = 0; i < chunks.length; ++i) {
|
||||
qb.appendWhere(" AND tmp." + UserIds.USER_ID + " LIKE ");
|
||||
qb.appendWhereEscapeString("%" + chunks[i] + "%");
|
||||
@@ -62,28 +72,23 @@ public class SelectSecretKeyListAdapter extends BaseAdapter {
|
||||
qb.appendWhere(")");
|
||||
}
|
||||
|
||||
mCursor = qb.query(mDatabase,
|
||||
new String[] {
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID, // 0
|
||||
KeyRings.TABLE_NAME + "." + KeyRings.MASTER_KEY_ID, // 1
|
||||
UserIds.TABLE_NAME + "." + UserIds.USER_ID, // 2
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE " +
|
||||
"tmp." + Keys.KEY_RING_ID + " = " +
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID + " AND " +
|
||||
"tmp." + Keys.IS_REVOKED + " = '0' AND " +
|
||||
"tmp." + Keys.CAN_SIGN + " = '1')", // 3,
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE " +
|
||||
"tmp." + Keys.KEY_RING_ID + " = " +
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID + " AND " +
|
||||
"tmp." + Keys.IS_REVOKED + " = '0' AND " +
|
||||
"tmp." + Keys.CAN_SIGN + " = '1' AND " +
|
||||
"tmp." + Keys.CREATION + " <= '" + now + "' AND " +
|
||||
"(tmp." + Keys.EXPIRY + " IS NULL OR " +
|
||||
"tmp." + Keys.EXPIRY + " >= '" + now + "'))", // 4
|
||||
},
|
||||
KeyRings.TABLE_NAME + "." + KeyRings.TYPE + " = ?",
|
||||
new String[] { "" + Id.database.type_secret },
|
||||
null, null, UserIds.TABLE_NAME + "." + UserIds.USER_ID + " ASC");
|
||||
mCursor = qb.query(mDatabase, new String[] {
|
||||
KeyRings.TABLE_NAME + "." + KeyRings._ID, // 0
|
||||
KeyRings.TABLE_NAME + "." + KeyRings.MASTER_KEY_ID, // 1
|
||||
UserIds.TABLE_NAME + "." + UserIds.USER_ID, // 2
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE "
|
||||
+ "tmp." + Keys.KEY_RING_ID + " = " + KeyRings.TABLE_NAME + "."
|
||||
+ KeyRings._ID + " AND " + "tmp." + Keys.IS_REVOKED + " = '0' AND "
|
||||
+ "tmp." + Keys.CAN_SIGN + " = '1')", // 3,
|
||||
"(SELECT COUNT(tmp." + Keys._ID + ") FROM " + Keys.TABLE_NAME + " AS tmp WHERE "
|
||||
+ "tmp." + Keys.KEY_RING_ID + " = " + KeyRings.TABLE_NAME + "."
|
||||
+ KeyRings._ID + " AND " + "tmp." + Keys.IS_REVOKED + " = '0' AND "
|
||||
+ "tmp." + Keys.CAN_SIGN + " = '1' AND " + "tmp." + Keys.CREATION + " <= '"
|
||||
+ now + "' AND " + "(tmp." + Keys.EXPIRY + " IS NULL OR " + "tmp."
|
||||
+ Keys.EXPIRY + " >= '" + now + "'))", // 4
|
||||
}, KeyRings.TABLE_NAME + "." + KeyRings.TYPE + " = ?", new String[] { ""
|
||||
+ Id.database.type_secret }, null, null, UserIds.TABLE_NAME + "." + UserIds.USER_ID
|
||||
+ " ASC");
|
||||
|
||||
activity.startManagingCursor(mCursor);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.ui;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -9,11 +23,6 @@ import org.apg.Apg;
|
||||
import org.apg.Constants;
|
||||
import org.apg.HkpKeyServer;
|
||||
import org.apg.Id;
|
||||
import org.apg.Constants.extras;
|
||||
import org.apg.Id.dialog;
|
||||
import org.apg.Id.message;
|
||||
import org.apg.Id.request;
|
||||
import org.apg.Id.return_value;
|
||||
import org.spongycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.spongycastle.openpgp.PGPException;
|
||||
import org.spongycastle.openpgp.PGPPrivateKey;
|
||||
@@ -27,6 +36,8 @@ import org.spongycastle.openpgp.PGPSignatureSubpacketVector;
|
||||
import org.spongycastle.openpgp.PGPUtil;
|
||||
import org.apg.R;
|
||||
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
@@ -51,7 +62,22 @@ public class SignKeyActivity extends BaseActivity {
|
||||
|
||||
private long pubKeyId = 0;
|
||||
private long masterKeyId = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case android.R.id.home:
|
||||
startActivity(new Intent(this, PublicKeyListActivity.class));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -60,7 +86,8 @@ public class SignKeyActivity extends BaseActivity {
|
||||
setContentView(R.layout.sign_key_layout);
|
||||
|
||||
final Spinner keyServer = (Spinner) findViewById(R.id.keyServer);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mPreferences.getKeyServers());
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_spinner_item, mPreferences.getKeyServers());
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
keyServer.setAdapter(adapter);
|
||||
|
||||
@@ -94,12 +121,13 @@ public class SignKeyActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pubKeyId = getIntent().getLongExtra(Apg.EXTRA_KEY_ID, 0);
|
||||
if (pubKeyId == 0) {
|
||||
finish(); // nothing to do if we dont know what key to sign
|
||||
} else {
|
||||
// kick off the SecretKey selection activity so the user chooses which key to sign with first
|
||||
// kick off the SecretKey selection activity so the user chooses which key to sign with
|
||||
// first
|
||||
Intent intent = new Intent(this, SelectSecretKeyListActivity.class);
|
||||
startActivityForResult(intent, Id.request.secret_keys);
|
||||
}
|
||||
@@ -113,7 +141,7 @@ public class SignKeyActivity extends BaseActivity {
|
||||
if (pubring != null) {
|
||||
// if we have already signed this key, dont bother doing it again
|
||||
boolean alreadySigned = false;
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<PGPSignature> itr = pubring.getPublicKey(pubKeyId).getSignatures();
|
||||
while (itr.hasNext()) {
|
||||
@@ -123,7 +151,7 @@ public class SignKeyActivity extends BaseActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!alreadySigned) {
|
||||
/*
|
||||
* get the user's passphrase for this key (if required)
|
||||
@@ -131,7 +159,8 @@ public class SignKeyActivity extends BaseActivity {
|
||||
String passphrase = Apg.getCachedPassPhrase(masterKeyId);
|
||||
if (passphrase == null) {
|
||||
showDialog(Id.dialog.pass_phrase);
|
||||
return; // bail out; need to wait until the user has entered the passphrase before trying again
|
||||
return; // bail out; need to wait until the user has entered the passphrase
|
||||
// before trying again
|
||||
} else {
|
||||
startSigning();
|
||||
}
|
||||
@@ -142,27 +171,27 @@ public class SignKeyActivity extends BaseActivity {
|
||||
status.putString(Apg.EXTRA_ERROR, "Key has already been signed");
|
||||
|
||||
status.putInt(Constants.extras.STATUS, Id.message.done);
|
||||
|
||||
|
||||
msg.setData(status);
|
||||
sendMessage(msg);
|
||||
|
||||
|
||||
setResult(Id.return_value.error);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getSecretKeyId() {
|
||||
return masterKeyId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void passPhraseCallback(long keyId, String passPhrase) {
|
||||
super.passPhraseCallback(keyId, passPhrase);
|
||||
startSigning();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* kicks off the actual signing process on a background thread
|
||||
*/
|
||||
@@ -170,7 +199,7 @@ public class SignKeyActivity extends BaseActivity {
|
||||
showDialog(Id.dialog.signing);
|
||||
startThread();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Bundle status = new Bundle();
|
||||
@@ -182,36 +211,39 @@ public class SignKeyActivity extends BaseActivity {
|
||||
status.putString(Apg.EXTRA_ERROR, "Unable to obtain passphrase");
|
||||
} else {
|
||||
PGPPublicKeyRing pubring = Apg.getPublicKeyRing(pubKeyId);
|
||||
|
||||
|
||||
/*
|
||||
* sign the incoming key
|
||||
*/
|
||||
PGPSecretKey secretKey = Apg.getSecretKey(masterKeyId);
|
||||
PGPPrivateKey signingKey = secretKey.extractPrivateKey(passphrase.toCharArray(), BouncyCastleProvider.PROVIDER_NAME);
|
||||
PGPSignatureGenerator sGen = new PGPSignatureGenerator(secretKey.getPublicKey().getAlgorithm(), PGPUtil.SHA256, BouncyCastleProvider.PROVIDER_NAME);
|
||||
PGPPrivateKey signingKey = secretKey.extractPrivateKey(passphrase.toCharArray(),
|
||||
BouncyCastleProvider.PROVIDER_NAME);
|
||||
PGPSignatureGenerator sGen = new PGPSignatureGenerator(secretKey.getPublicKey()
|
||||
.getAlgorithm(), PGPUtil.SHA256, BouncyCastleProvider.PROVIDER_NAME);
|
||||
sGen.initSign(PGPSignature.DIRECT_KEY, signingKey);
|
||||
|
||||
|
||||
PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
|
||||
|
||||
|
||||
PGPSignatureSubpacketVector packetVector = spGen.generate();
|
||||
sGen.setHashedSubpackets(packetVector);
|
||||
|
||||
PGPPublicKey signedKey = PGPPublicKey.addCertification(pubring.getPublicKey(pubKeyId), sGen.generate());
|
||||
|
||||
PGPPublicKey signedKey = PGPPublicKey.addCertification(
|
||||
pubring.getPublicKey(pubKeyId), sGen.generate());
|
||||
pubring = PGPPublicKeyRing.insertPublicKey(pubring, signedKey);
|
||||
|
||||
|
||||
// check if we need to send the key to the server or not
|
||||
CheckBox sendKey = (CheckBox) findViewById(R.id.sendKey);
|
||||
if (sendKey.isChecked()) {
|
||||
Spinner keyServer = (Spinner) findViewById(R.id.keyServer);
|
||||
HkpKeyServer server = new HkpKeyServer((String) keyServer.getSelectedItem());
|
||||
|
||||
|
||||
/*
|
||||
* upload the newly signed key to the key server
|
||||
*/
|
||||
|
||||
|
||||
Apg.uploadKeyRingToServer(server, pubring);
|
||||
}
|
||||
|
||||
|
||||
// store the signed key in our local cache
|
||||
int retval = Apg.storeKeyRingInCache(pubring);
|
||||
if (retval != Id.return_value.ok && retval != Id.return_value.updated) {
|
||||
@@ -239,52 +271,53 @@ public class SignKeyActivity extends BaseActivity {
|
||||
status.putInt(Constants.extras.STATUS, Id.message.done);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
status.putInt(Constants.extras.STATUS, Id.message.done);
|
||||
|
||||
|
||||
msg.setData(status);
|
||||
sendMessage(msg);
|
||||
|
||||
|
||||
if (status.containsKey(Apg.EXTRA_ERROR)) {
|
||||
setResult(Id.return_value.error);
|
||||
} else {
|
||||
setResult(Id.return_value.ok);
|
||||
}
|
||||
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case Id.request.secret_keys: {
|
||||
if (resultCode == RESULT_OK) {
|
||||
masterKeyId = data.getLongExtra(Apg.EXTRA_KEY_ID, 0);
|
||||
|
||||
// re-enable the sign button so the user can initiate the sign process
|
||||
Button sign = (Button) findViewById(R.id.sign);
|
||||
sign.setEnabled(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
case Id.request.secret_keys: {
|
||||
if (resultCode == RESULT_OK) {
|
||||
masterKeyId = data.getLongExtra(Apg.EXTRA_KEY_ID, 0);
|
||||
|
||||
// re-enable the sign button so the user can initiate the sign process
|
||||
Button sign = (Button) findViewById(R.id.sign);
|
||||
sign.setEnabled(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doneCallback(Message msg) {
|
||||
super.doneCallback(msg);
|
||||
|
||||
|
||||
removeDialog(Id.dialog.signing);
|
||||
|
||||
Bundle data = msg.getData();
|
||||
String error = data.getString(Apg.EXTRA_ERROR);
|
||||
if (error != null) {
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.util;
|
||||
|
||||
public interface ApgConInterface {
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apg.util;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||