mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
Changed layout to have source on bottom in encrypt and decrypt, fixes for decrypt methods
This commit is contained in:
parent
8abfb5a6f4
commit
8f686e67f3
@ -34,6 +34,57 @@
|
|||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp" >
|
android:paddingRight="10dp" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/signature"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ic_signature_status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/overlay_error" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="5dip" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/mainUserId"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:text="Main User Id"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/mainUserIdRest"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:text="Main User Id Rest"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -124,57 +175,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ViewFlipper>
|
</ViewFlipper>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/signature"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clickable="true"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingRight="10dp" >
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
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" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/ic_signature_status"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/overlay_error" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="5dip" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/mainUserId"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="left"
|
|
||||||
android:text="Main User Id"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/mainUserIdRest"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="left"
|
|
||||||
android:text="Main User Id Rest"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
@ -27,132 +27,6 @@
|
|||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp" >
|
android:paddingRight="10dp" >
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="4dp" >
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sourcePrevious"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_previous" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/sourceLabel"
|
|
||||||
style="@style/SectionHeader"
|
|
||||||
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" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sourceNext"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_next" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ViewFlipper
|
|
||||||
android:id="@+id/source"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="0dip"
|
|
||||||
android:layout_weight="1" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/sourceMessage"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="4dp" >
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/message"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:gravity="top"
|
|
||||||
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:padding="4dp" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/filename"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
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_menu_filebrowser" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
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/textAppearanceSmall" />
|
|
||||||
|
|
||||||
<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" >
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/deleteAfterEncryption"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:text="@string/label_deleteAfterEncryption" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/asciiArmour"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:text="@string/label_asciiArmour" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</ViewFlipper>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -301,6 +175,132 @@
|
|||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</ViewFlipper>
|
</ViewFlipper>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="4dp" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sourcePrevious"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_previous" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sourceLabel"
|
||||||
|
style="@style/SectionHeader"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sourceNext"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/ic_next" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ViewFlipper
|
||||||
|
android:id="@+id/source"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dip"
|
||||||
|
android:layout_weight="1" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/sourceMessage"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="4dp" >
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/message"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:gravity="top"
|
||||||
|
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:padding="4dp" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/filename"
|
||||||
|
android:layout_width="0dip"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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_menu_filebrowser" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
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/textAppearanceSmall" />
|
||||||
|
|
||||||
|
<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" >
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/deleteAfterEncryption"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/label_deleteAfterEncryption" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/asciiArmour"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/label_asciiArmour" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ViewFlipper>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
@ -112,7 +112,7 @@
|
|||||||
<string name="label_passPhrase">Passphrase</string>
|
<string name="label_passPhrase">Passphrase</string>
|
||||||
<string name="label_passPhraseAgain">Again</string>
|
<string name="label_passPhraseAgain">Again</string>
|
||||||
<string name="label_algorithm">Algorithm</string>
|
<string name="label_algorithm">Algorithm</string>
|
||||||
<string name="label_asciiArmour">ASCII Armour</string>
|
<string name="label_asciiArmour">ASCII Armor</string>
|
||||||
<string name="label_selectPublicKeys">Public Key(s)</string>
|
<string name="label_selectPublicKeys">Public Key(s)</string>
|
||||||
<string name="label_deleteAfterEncryption">Delete After Encryption</string>
|
<string name="label_deleteAfterEncryption">Delete After Encryption</string>
|
||||||
<string name="label_deleteAfterDecryption">Delete After Decryption</string>
|
<string name="label_deleteAfterDecryption">Delete After Decryption</string>
|
||||||
|
@ -379,10 +379,9 @@ public class ApgProvider extends ContentProvider {
|
|||||||
|
|
||||||
qb.setTables(Tables.KEY_RINGS + " INNER JOIN " + Tables.KEYS + " ON " + "("
|
qb.setTables(Tables.KEY_RINGS + " INNER JOIN " + Tables.KEYS + " ON " + "("
|
||||||
+ Tables.KEY_RINGS + "." + BaseColumns._ID + " = " + Tables.KEYS + "."
|
+ Tables.KEY_RINGS + "." + BaseColumns._ID + " = " + Tables.KEYS + "."
|
||||||
+ KeysColumns.KEY_RING_ROW_ID + " AND " + Tables.KEYS + "."
|
+ KeysColumns.KEY_RING_ROW_ID + ") " + " INNER JOIN " + Tables.USER_IDS + " ON "
|
||||||
+ KeysColumns.IS_MASTER_KEY + " = '1') " + " INNER JOIN " + Tables.USER_IDS
|
+ "(" + Tables.KEY_RINGS + "." + BaseColumns._ID + " = " + Tables.USER_IDS + "."
|
||||||
+ " ON " + "(" + Tables.KEY_RINGS + "." + BaseColumns._ID + " = " + Tables.USER_IDS
|
+ UserIdsColumns.KEY_RING_ROW_ID + " AND " + Tables.USER_IDS + "."
|
||||||
+ "." + UserIdsColumns.KEY_RING_ROW_ID + " AND " + Tables.USER_IDS + "."
|
|
||||||
+ UserIdsColumns.RANK + " = '0')");
|
+ UserIdsColumns.RANK + " = '0')");
|
||||||
|
|
||||||
qb.setProjectionMap(getProjectionMapForKeyRings());
|
qb.setProjectionMap(getProjectionMapForKeyRings());
|
||||||
|
@ -70,10 +70,13 @@ public class DecryptActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
// possible intent actions for this activity
|
// possible intent actions for this activity
|
||||||
public static final String ACTION_DECRYPT = Constants.INTENT_PREFIX + "DECRYPT";
|
public static final String ACTION_DECRYPT = Constants.INTENT_PREFIX + "DECRYPT";
|
||||||
public static final String ACTION_DECRYPT_FILE = Constants.INTENT_PREFIX + "DECRYPT_FILE";
|
|
||||||
public static final String ACTION_DECRYPT_AND_RETURN = Constants.INTENT_PREFIX
|
public static final String ACTION_DECRYPT_AND_RETURN = Constants.INTENT_PREFIX
|
||||||
+ "DECRYPT_AND_RETURN";
|
+ "DECRYPT_AND_RETURN";
|
||||||
|
|
||||||
|
public static final String ACTION_DECRYPT_FILE = Constants.INTENT_PREFIX + "DECRYPT_FILE";
|
||||||
|
public static final String ACTION_DECRYPT_STREAM_AND_RETURN = Constants.INTENT_PREFIX
|
||||||
|
+ "DECRYPT_STREAM_AND_RETURN";
|
||||||
|
|
||||||
// possible extra keys
|
// possible extra keys
|
||||||
public static final String EXTRA_TEXT = "text";
|
public static final String EXTRA_TEXT = "text";
|
||||||
public static final String EXTRA_DATA = "data";
|
public static final String EXTRA_DATA = "data";
|
||||||
@ -126,6 +129,8 @@ public class DecryptActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
private boolean mLookupUnknownKey = true;
|
private boolean mLookupUnknownKey = true;
|
||||||
|
|
||||||
|
private boolean mDecryptImmediately = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
|
||||||
@ -169,20 +174,7 @@ public class DecryptActivity extends SherlockFragmentActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void initView() {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
// check permissions for intent actions without user interaction
|
|
||||||
String[] restrictedActions = new String[] { ACTION_DECRYPT_AND_RETURN };
|
|
||||||
OtherHelper.checkPackagePermissionForActions(this, this.getCallingPackage(),
|
|
||||||
Constants.PERMISSION_ACCESS_API, getIntent().getAction(), restrictedActions);
|
|
||||||
|
|
||||||
setContentView(R.layout.decrypt);
|
|
||||||
|
|
||||||
// set actionbar without home button if called from another app
|
|
||||||
OtherHelper.setActionBarBackButton(this);
|
|
||||||
|
|
||||||
mSource = (ViewFlipper) findViewById(R.id.source);
|
mSource = (ViewFlipper) findViewById(R.id.source);
|
||||||
mSourceLabel = (TextView) findViewById(R.id.sourceLabel);
|
mSourceLabel = (TextView) findViewById(R.id.sourceLabel);
|
||||||
mSourcePrevious = (ImageView) findViewById(R.id.sourcePrevious);
|
mSourcePrevious = (ImageView) findViewById(R.id.sourcePrevious);
|
||||||
@ -246,67 +238,26 @@ public class DecryptActivity extends SherlockFragmentActivity {
|
|||||||
while (mSource.getCurrentView().getId() != R.id.sourceMessage) {
|
while (mSource.getCurrentView().getId() != R.id.sourceMessage) {
|
||||||
mSource.showNext();
|
mSource.showNext();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boolean decryptImmediately = false;
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// Get intent, action and MIME type
|
// check permissions for intent actions without user interaction
|
||||||
Intent intent = getIntent();
|
String[] restrictedActions = new String[] { ACTION_DECRYPT_AND_RETURN };
|
||||||
String action = intent.getAction();
|
OtherHelper.checkPackagePermissionForActions(this, this.getCallingPackage(),
|
||||||
String type = intent.getType();
|
Constants.PERMISSION_ACCESS_API, getIntent().getAction(), restrictedActions);
|
||||||
|
|
||||||
if (Intent.ACTION_VIEW.equals(action)) {
|
setContentView(R.layout.decrypt);
|
||||||
// Android's Action when opening file associated to APG (see AndroidManifest.xml)
|
|
||||||
|
|
||||||
// This gets the Uri, where an inputStream can be opened from
|
// set actionbar without home button if called from another app
|
||||||
mContentUri = intent.getData();
|
OtherHelper.setActionBarBackButton(this);
|
||||||
|
|
||||||
// TODO: old implementation of ACTION_VIEW. Is this used in K9?
|
initView();
|
||||||
// Uri uri = mIntent.getData();
|
|
||||||
// try {
|
|
||||||
// InputStream attachment = getContentResolver().openInputStream(uri);
|
|
||||||
// ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
|
|
||||||
// byte bytes[] = new byte[1 << 16];
|
|
||||||
// int length;
|
|
||||||
// while ((length = attachment.read(bytes)) > 0) {
|
|
||||||
// byteOut.write(bytes, 0, length);
|
|
||||||
// }
|
|
||||||
// byteOut.close();
|
|
||||||
// String data = new String(byteOut.toByteArray());
|
|
||||||
// mMessage.setText(data);
|
|
||||||
// } catch (FileNotFoundException e) {
|
|
||||||
// // ignore, then
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// // ignore, then
|
|
||||||
// }
|
|
||||||
|
|
||||||
// same as ACTION_DECRYPT_FILE but decrypt it immediately
|
// Handle intent actions
|
||||||
handleActionDecryptFile(intent);
|
handleActions(getIntent());
|
||||||
decryptImmediately = true;
|
|
||||||
} else if (Intent.ACTION_SEND.equals(action) && type != null) {
|
|
||||||
// Android's Action when sending to APG Decrypt
|
|
||||||
|
|
||||||
if ("text/plain".equals(type)) {
|
|
||||||
// plain text
|
|
||||||
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
|
||||||
if (sharedText != null) {
|
|
||||||
intent.putExtra(EXTRA_TEXT, sharedText);
|
|
||||||
handleActionDecrypt(intent);
|
|
||||||
decryptImmediately = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// binary via content provider (could also be files)
|
|
||||||
Uri uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
|
||||||
if (uri != null) {
|
|
||||||
mContentUri = uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (ACTION_DECRYPT.equals(action)) {
|
|
||||||
handleActionDecrypt(intent);
|
|
||||||
} else if (ACTION_DECRYPT_FILE.equals(action)) {
|
|
||||||
handleActionDecryptFile(intent);
|
|
||||||
} else if (ACTION_DECRYPT_AND_RETURN.equals(action)) {
|
|
||||||
handleActionDecryptAndReturn(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mSource.getCurrentView().getId() == R.id.sourceMessage
|
if (mSource.getCurrentView().getId() == R.id.sourceMessage
|
||||||
&& mMessage.getText().length() == 0) {
|
&& mMessage.getText().length() == 0) {
|
||||||
@ -364,7 +315,7 @@ public class DecryptActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
updateSource();
|
updateSource();
|
||||||
|
|
||||||
if (decryptImmediately
|
if (mDecryptImmediately
|
||||||
|| (mSource.getCurrentView().getId() == R.id.sourceMessage && (mMessage.getText()
|
|| (mSource.getCurrentView().getId() == R.id.sourceMessage && (mMessage.getText()
|
||||||
.length() > 0 || mDataBytes != null || mContentUri != null))) {
|
.length() > 0 || mDataBytes != null || mContentUri != null))) {
|
||||||
decryptClicked();
|
decryptClicked();
|
||||||
@ -372,114 +323,167 @@ public class DecryptActivity extends SherlockFragmentActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles activity intent with ACTION_DECRYPT
|
* Handles all actions with this intent
|
||||||
*
|
*
|
||||||
* @param intent
|
* @param intent
|
||||||
*/
|
*/
|
||||||
private void handleActionDecrypt(Intent intent) {
|
private void handleActions(Intent intent) {
|
||||||
Log.d(Constants.TAG, "Apg Intent DECRYPT startet");
|
String action = intent.getAction();
|
||||||
|
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
|
String type = intent.getType();
|
||||||
|
Uri uri = intent.getData();
|
||||||
|
|
||||||
if (extras == null) {
|
if (extras == null) {
|
||||||
Log.d(Constants.TAG, "extra bundle was null");
|
|
||||||
extras = new Bundle();
|
extras = new Bundle();
|
||||||
} else {
|
|
||||||
Log.d(Constants.TAG, "got extras");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mDataBytes = extras.getByteArray(EXTRA_DATA);
|
/*
|
||||||
String textData = null;
|
* Android's Action
|
||||||
if (mDataBytes == null) {
|
*/
|
||||||
Log.d(Constants.TAG, "EXTRA_DATA was null");
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
textData = extras.getString(EXTRA_TEXT);
|
// When sending to APG Encrypt via share menu
|
||||||
} else {
|
if ("text/plain".equals(type)) {
|
||||||
Log.d(Constants.TAG, "Got data from EXTRA_DATA");
|
// Plain text
|
||||||
}
|
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
if (textData != null) {
|
if (sharedText != null) {
|
||||||
Log.d(Constants.TAG, "textData null, matching text ...");
|
// handle like normal text decryption, override action and extras to later
|
||||||
Matcher matcher = PGPMain.PGP_MESSAGE.matcher(textData);
|
// execute ACTION_DECRYPT in main actions
|
||||||
if (matcher.matches()) {
|
extras.putString(EXTRA_TEXT, sharedText);
|
||||||
Log.d(Constants.TAG, "PGP_MESSAGE matched");
|
action = ACTION_DECRYPT;
|
||||||
textData = matcher.group(1);
|
}
|
||||||
// replace non breakable spaces
|
|
||||||
textData = textData.replaceAll("\\xa0", " ");
|
|
||||||
mMessage.setText(textData);
|
|
||||||
} else {
|
} else {
|
||||||
matcher = PGPMain.PGP_SIGNED_MESSAGE.matcher(textData);
|
// Binary via content provider (could also be files)
|
||||||
|
// override uri to get stream from send
|
||||||
|
uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
|
action = ACTION_DECRYPT_FILE;
|
||||||
|
}
|
||||||
|
} else if (Intent.ACTION_VIEW.equals(action)) {
|
||||||
|
// Android's Action when opening file associated to APG (see AndroidManifest.xml)
|
||||||
|
|
||||||
|
// override action
|
||||||
|
action = ACTION_DECRYPT_FILE;
|
||||||
|
|
||||||
|
// EVERYTHING ELSE IS OLD CODE
|
||||||
|
// This gets the Uri, where an inputStream can be opened from
|
||||||
|
// mContentUri = intent.getData();
|
||||||
|
|
||||||
|
// TODO: old implementation of ACTION_VIEW. Is this used in K9?
|
||||||
|
// Uri uri = mIntent.getData();
|
||||||
|
// try {
|
||||||
|
// InputStream attachment = getContentResolver().openInputStream(uri);
|
||||||
|
// ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
|
||||||
|
// byte bytes[] = new byte[1 << 16];
|
||||||
|
// int length;
|
||||||
|
// while ((length = attachment.read(bytes)) > 0) {
|
||||||
|
// byteOut.write(bytes, 0, length);
|
||||||
|
// }
|
||||||
|
// byteOut.close();
|
||||||
|
// String data = new String(byteOut.toByteArray());
|
||||||
|
// mMessage.setText(data);
|
||||||
|
// } catch (FileNotFoundException e) {
|
||||||
|
// // ignore, then
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // ignore, then
|
||||||
|
// }
|
||||||
|
|
||||||
|
// same as ACTION_DECRYPT_FILE but decrypt it immediately
|
||||||
|
// handleActionDecryptFile(intent);
|
||||||
|
// mDecryptImmediately = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main Actions
|
||||||
|
*/
|
||||||
|
if (ACTION_DECRYPT.equals(action)) {
|
||||||
|
mDataBytes = extras.getByteArray(EXTRA_DATA);
|
||||||
|
String textData = null;
|
||||||
|
if (mDataBytes == null) {
|
||||||
|
Log.d(Constants.TAG, "EXTRA_DATA was null");
|
||||||
|
textData = extras.getString(EXTRA_TEXT);
|
||||||
|
} else {
|
||||||
|
Log.d(Constants.TAG, "Got data from EXTRA_DATA");
|
||||||
|
}
|
||||||
|
if (textData != null) {
|
||||||
|
Log.d(Constants.TAG, "textData null, matching text ...");
|
||||||
|
Matcher matcher = PGPMain.PGP_MESSAGE.matcher(textData);
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
Log.d(Constants.TAG, "PGP_SIGNED_MESSAGE matched");
|
Log.d(Constants.TAG, "PGP_MESSAGE matched");
|
||||||
textData = matcher.group(1);
|
textData = matcher.group(1);
|
||||||
// replace non breakable spaces
|
// replace non breakable spaces
|
||||||
textData = textData.replaceAll("\\xa0", " ");
|
textData = textData.replaceAll("\\xa0", " ");
|
||||||
mMessage.setText(textData);
|
mMessage.setText(textData);
|
||||||
|
|
||||||
mDecryptString = getString(R.string.btn_verify);
|
|
||||||
// build new action bar
|
|
||||||
invalidateOptionsMenu();
|
|
||||||
} else {
|
} else {
|
||||||
Log.d(Constants.TAG, "Nothing matched!");
|
matcher = PGPMain.PGP_SIGNED_MESSAGE.matcher(textData);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
Log.d(Constants.TAG, "PGP_SIGNED_MESSAGE matched");
|
||||||
|
textData = matcher.group(1);
|
||||||
|
// replace non breakable spaces
|
||||||
|
textData = textData.replaceAll("\\xa0", " ");
|
||||||
|
mMessage.setText(textData);
|
||||||
|
|
||||||
|
mDecryptString = getString(R.string.btn_verify);
|
||||||
|
// build new action bar
|
||||||
|
invalidateOptionsMenu();
|
||||||
|
} else {
|
||||||
|
Log.d(Constants.TAG, "Nothing matched!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
mReplyTo = extras.getString(EXTRA_REPLY_TO);
|
||||||
mReplyTo = extras.getString(EXTRA_REPLY_TO);
|
mSubject = extras.getString(EXTRA_SUBJECT);
|
||||||
mSubject = extras.getString(EXTRA_SUBJECT);
|
} else if (ACTION_DECRYPT_FILE.equals(action)) {
|
||||||
}
|
// get file path from uri
|
||||||
|
String path = FileHelper.getPath(this, uri);
|
||||||
|
|
||||||
/**
|
if (path != null) {
|
||||||
* Handles activity intent with ACTION_DECRYPT_FILE
|
mInputFilename = path;
|
||||||
*
|
mFilename.setText(mInputFilename);
|
||||||
* @param intent
|
guessOutputFilename();
|
||||||
*/
|
mSource.setInAnimation(null);
|
||||||
private void handleActionDecryptFile(Intent intent) {
|
mSource.setOutAnimation(null);
|
||||||
mInputFilename = intent.getData().getPath();
|
while (mSource.getCurrentView().getId() != R.id.sourceFile) {
|
||||||
mFilename.setText(mInputFilename);
|
mSource.showNext();
|
||||||
guessOutputFilename();
|
}
|
||||||
mSource.setInAnimation(null);
|
} else {
|
||||||
mSource.setOutAnimation(null);
|
Log.e(Constants.TAG,
|
||||||
while (mSource.getCurrentView().getId() != R.id.sourceFile) {
|
"Direct binary data without actual file in filesystem is not supported. This is only supported by ACTION_DECRYPT_STREAM_AND_RETURN.");
|
||||||
mSource.showNext();
|
Toast.makeText(this, R.string.error_onlyFilesAreSupported, Toast.LENGTH_LONG)
|
||||||
}
|
.show();
|
||||||
}
|
// end activity
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
} else if (ACTION_DECRYPT_AND_RETURN.equals(action)) {
|
||||||
|
mReturnBinary = extras.getBoolean(EXTRA_BINARY, false);
|
||||||
|
|
||||||
/**
|
if (mContentUri == null) {
|
||||||
* Handles activity intent with ACTION_DECRYPT_AND_RETURN
|
mDataBytes = extras.getByteArray(EXTRA_DATA);
|
||||||
*
|
String data = extras.getString(EXTRA_TEXT);
|
||||||
* @param intent
|
if (data != null) {
|
||||||
*/
|
Matcher matcher = PGPMain.PGP_MESSAGE.matcher(data);
|
||||||
private void handleActionDecryptAndReturn(Intent intent) {
|
|
||||||
Bundle extras = intent.getExtras();
|
|
||||||
if (extras == null) {
|
|
||||||
extras = new Bundle();
|
|
||||||
}
|
|
||||||
|
|
||||||
mReturnBinary = extras.getBoolean(EXTRA_BINARY, false);
|
|
||||||
|
|
||||||
if (mContentUri == null) {
|
|
||||||
mDataBytes = extras.getByteArray(EXTRA_DATA);
|
|
||||||
String data = extras.getString(EXTRA_TEXT);
|
|
||||||
if (data != null) {
|
|
||||||
Matcher matcher = PGPMain.PGP_MESSAGE.matcher(data);
|
|
||||||
if (matcher.matches()) {
|
|
||||||
data = matcher.group(1);
|
|
||||||
// replace non breakable spaces
|
|
||||||
data = data.replaceAll("\\xa0", " ");
|
|
||||||
mMessage.setText(data);
|
|
||||||
} else {
|
|
||||||
matcher = PGPMain.PGP_SIGNED_MESSAGE.matcher(data);
|
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
data = matcher.group(1);
|
data = matcher.group(1);
|
||||||
// replace non breakable spaces
|
// replace non breakable spaces
|
||||||
data = data.replaceAll("\\xa0", " ");
|
data = data.replaceAll("\\xa0", " ");
|
||||||
mMessage.setText(data);
|
mMessage.setText(data);
|
||||||
mDecryptString = getString(R.string.btn_verify);
|
} else {
|
||||||
|
matcher = PGPMain.PGP_SIGNED_MESSAGE.matcher(data);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
data = matcher.group(1);
|
||||||
|
// replace non breakable spaces
|
||||||
|
data = data.replaceAll("\\xa0", " ");
|
||||||
|
mMessage.setText(data);
|
||||||
|
mDecryptString = getString(R.string.btn_verify);
|
||||||
|
|
||||||
// build new action bar
|
// build new action bar
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mReturnResult = true;
|
||||||
|
} else if (ACTION_DECRYPT_STREAM_AND_RETURN.equals(action)) {
|
||||||
|
// TODO: Implement decrypt stream
|
||||||
}
|
}
|
||||||
mReturnResult = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void guessOutputFilename() {
|
private void guessOutputFilename() {
|
||||||
|
@ -95,7 +95,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
private long mEncryptionKeyIds[] = null;
|
private long mEncryptionKeyIds[] = null;
|
||||||
|
|
||||||
private boolean mReturnResult = false;
|
private boolean mEncryptImmediately = false;
|
||||||
private EditText mMessage = null;
|
private EditText mMessage = null;
|
||||||
private Button mSelectKeysButton = null;
|
private Button mSelectKeysButton = null;
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
updateSource();
|
updateSource();
|
||||||
updateMode();
|
updateMode();
|
||||||
|
|
||||||
if (mReturnResult) {
|
if (mEncryptImmediately) {
|
||||||
mSourcePrevious.setClickable(false);
|
mSourcePrevious.setClickable(false);
|
||||||
mSourcePrevious.setEnabled(false);
|
mSourcePrevious.setEnabled(false);
|
||||||
mSourcePrevious.setVisibility(View.INVISIBLE);
|
mSourcePrevious.setVisibility(View.INVISIBLE);
|
||||||
@ -228,7 +228,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
updateActionBarButtons();
|
updateActionBarButtons();
|
||||||
|
|
||||||
if (mReturnResult
|
if (mEncryptImmediately
|
||||||
&& (mMessage.getText().length() > 0 || mData != null)
|
&& (mMessage.getText().length() > 0 || mData != null)
|
||||||
&& ((mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0) || mSecretKeyId != 0)) {
|
&& ((mEncryptionKeyIds != null && mEncryptionKeyIds.length > 0) || mSecretKeyId != 0)) {
|
||||||
encryptClicked();
|
encryptClicked();
|
||||||
@ -250,20 +250,23 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
extras = new Bundle();
|
extras = new Bundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Android's Action
|
||||||
|
*/
|
||||||
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
// Android's Action when sending to APG Encrypt
|
// When sending to APG Encrypt via share menu
|
||||||
|
|
||||||
if ("text/plain".equals(type)) {
|
if ("text/plain".equals(type)) {
|
||||||
// plain text
|
// Plain text
|
||||||
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
if (sharedText != null) {
|
if (sharedText != null) {
|
||||||
// handle like normal text encryption, override action and extras
|
// handle like normal text encryption, override action and extras to later
|
||||||
action = ACTION_ENCRYPT;
|
// execute ACTION_ENCRYPT in main actions
|
||||||
extras.putString(EXTRA_TEXT, sharedText);
|
extras.putString(EXTRA_TEXT, sharedText);
|
||||||
extras.putBoolean(EXTRA_ASCII_ARMOUR, true);
|
extras.putBoolean(EXTRA_ASCII_ARMOUR, true);
|
||||||
|
action = ACTION_ENCRYPT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// files via content provider, override uri and action
|
// Files via content provider, override uri and action
|
||||||
uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
action = ACTION_ENCRYPT_FILE;
|
action = ACTION_ENCRYPT_FILE;
|
||||||
}
|
}
|
||||||
@ -271,7 +274,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
|
|
||||||
if (ACTION_ENCRYPT_AND_RETURN.equals(action)
|
if (ACTION_ENCRYPT_AND_RETURN.equals(action)
|
||||||
|| ACTION_GENERATE_SIGNATURE_AND_RETURN.equals(action)) {
|
|| ACTION_GENERATE_SIGNATURE_AND_RETURN.equals(action)) {
|
||||||
mReturnResult = true;
|
mEncryptImmediately = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACTION_GENERATE_SIGNATURE_AND_RETURN.equals(action)) {
|
if (ACTION_GENERATE_SIGNATURE_AND_RETURN.equals(action)) {
|
||||||
@ -299,6 +302,9 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
// preselect keys given by intent
|
// preselect keys given by intent
|
||||||
preselectKeys(signatureKeyId, encryptionKeyIds);
|
preselectKeys(signatureKeyId, encryptionKeyIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main Actions
|
||||||
|
*/
|
||||||
if (ACTION_ENCRYPT.equals(action) || ACTION_ENCRYPT_AND_RETURN.equals(action)
|
if (ACTION_ENCRYPT.equals(action) || ACTION_ENCRYPT_AND_RETURN.equals(action)
|
||||||
|| ACTION_GENERATE_SIGNATURE_AND_RETURN.equals(action)) {
|
|| ACTION_GENERATE_SIGNATURE_AND_RETURN.equals(action)) {
|
||||||
if (textData != null) {
|
if (textData != null) {
|
||||||
@ -330,10 +336,8 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
// end activity
|
// end activity
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ACTION_ENCRYPT_STREAM_AND_RETURN.equals(action)) {
|
} else if (ACTION_ENCRYPT_STREAM_AND_RETURN.equals(action)) {
|
||||||
// use mIntentDataUri to encrypt any stream and return
|
// TODO: Set mStreamAndReturnUri that is used later to encrypt a stream!
|
||||||
// TODO
|
|
||||||
|
|
||||||
mStreamAndReturnUri = null;
|
mStreamAndReturnUri = null;
|
||||||
}
|
}
|
||||||
@ -461,7 +465,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
mSourceLabel.setText(R.string.label_message);
|
mSourceLabel.setText(R.string.label_message);
|
||||||
|
|
||||||
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
|
if (mMode.getCurrentView().getId() == R.id.modeSymmetric) {
|
||||||
if (mReturnResult) {
|
if (mEncryptImmediately) {
|
||||||
setActionbarButtons(true, R.string.btn_encrypt, false, 0);
|
setActionbarButtons(true, R.string.btn_encrypt, false, 0);
|
||||||
} else {
|
} else {
|
||||||
setActionbarButtons(true, R.string.btn_encryptAndEmail, true,
|
setActionbarButtons(true, R.string.btn_encryptAndEmail, true,
|
||||||
@ -472,7 +476,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
if (mSecretKeyId == 0) {
|
if (mSecretKeyId == 0) {
|
||||||
setActionbarButtons(false, 0, false, 0);
|
setActionbarButtons(false, 0, false, 0);
|
||||||
} else {
|
} else {
|
||||||
if (mReturnResult) {
|
if (mEncryptImmediately) {
|
||||||
setActionbarButtons(true, R.string.btn_sign, false, 0);
|
setActionbarButtons(true, R.string.btn_sign, false, 0);
|
||||||
} else {
|
} else {
|
||||||
setActionbarButtons(true, R.string.btn_signAndEmail, true,
|
setActionbarButtons(true, R.string.btn_signAndEmail, true,
|
||||||
@ -480,7 +484,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mReturnResult) {
|
if (mEncryptImmediately) {
|
||||||
setActionbarButtons(true, R.string.btn_encrypt, false, 0);
|
setActionbarButtons(true, R.string.btn_encrypt, false, 0);
|
||||||
} else {
|
} else {
|
||||||
setActionbarButtons(true, R.string.btn_encryptAndEmail, true,
|
setActionbarButtons(true, R.string.btn_encryptAndEmail, true,
|
||||||
@ -716,7 +720,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
data.putByteArray(ApgIntentService.MESSAGE_BYTES, mData);
|
data.putByteArray(ApgIntentService.MESSAGE_BYTES, mData);
|
||||||
} else {
|
} else {
|
||||||
String message = mMessage.getText().toString();
|
String message = mMessage.getText().toString();
|
||||||
if (signOnly && !mReturnResult) {
|
if (signOnly && !mEncryptImmediately) {
|
||||||
fixBadCharactersForGmail(message);
|
fixBadCharactersForGmail(message);
|
||||||
}
|
}
|
||||||
data.putByteArray(ApgIntentService.MESSAGE_BYTES, message.getBytes());
|
data.putByteArray(ApgIntentService.MESSAGE_BYTES, message.getBytes());
|
||||||
@ -759,7 +763,7 @@ public class EncryptActivity extends SherlockFragmentActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Id.target.email:
|
case Id.target.email:
|
||||||
if (mReturnResult) {
|
if (mEncryptImmediately) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtras(data);
|
intent.putExtras(data);
|
||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
|
Loading…
Reference in New Issue
Block a user