mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
help activity
This commit is contained in:
parent
87e456e77c
commit
518fc2a310
@ -206,6 +206,9 @@
|
||||
android:excludeFromRecents="true"
|
||||
android:label="@string/title_about"
|
||||
android:theme="@style/Theme.Sherlock.Light.Dialog" />
|
||||
<activity
|
||||
android:name=".ui.HelpActivity"
|
||||
android:label="@string/title_help" />
|
||||
|
||||
<service android:name=".Service" />
|
||||
<service
|
||||
|
@ -48,10 +48,10 @@
|
||||
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:textColor="#ffffffff" />
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sourceNext"
|
||||
@ -103,7 +103,7 @@
|
||||
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
|
||||
@ -180,25 +180,4 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <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:layout_width="0dip" -->
|
||||
<!-- android:layout_height="fill_parent" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- android:text="@string/btn_reply" /> -->
|
||||
|
||||
<!-- <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>
|
@ -1,5 +1,19 @@
|
||||
<?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. -->
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
@ -173,6 +187,7 @@
|
||||
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" />
|
||||
|
14
org_apg/res/layout/help_activity.xml
Normal file
14
org_apg/res/layout/help_activity.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/help_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:textColor="#000" >
|
||||
</TextView>
|
||||
|
||||
</ScrollView>
|
16
org_apg/res/raw/help.html
Normal file
16
org_apg/res/raw/help.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!-- Maintain structure with headings with h2 tags and content with p tags.
|
||||
This makes it easy to translate the values with transifex!
|
||||
And don't add newlines before or after p tags because of transifex -->
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Beta software</h2>
|
||||
<p>This is beta software. It contains many remaining bugs!</p>
|
||||
<h2>APG+</h2>
|
||||
<p>Android Privacy Guard (APG) is a OpenPGP implementation for Android.
|
||||
<br />APG+ is a fork based on the original APG to introduce more features and a new user interface.</p>
|
||||
<h2>I found a bug in APG+!</h2>
|
||||
<p>Please report it in the <a href="https://github.com/dschuermann/apg/issues">issue tracker of APG+</a>.</p>
|
||||
</body>
|
||||
</html>
|
@ -46,7 +46,8 @@
|
||||
<string name="title_importFromQRCode">Import from QR Code</string>
|
||||
<string name="title_signKey">Sign Key</string>
|
||||
<string name="title_about">About</string>
|
||||
|
||||
<string name="title_help">Help</string>
|
||||
|
||||
<!-- section_lowerCase: capitalized words, no punctuation -->
|
||||
<string name="section_userIds">User IDs</string>
|
||||
<string name="section_keys">Keys</string>
|
||||
|
@ -47,7 +47,7 @@ public final class Id {
|
||||
public static final int encrypt = 0x21070013;
|
||||
public static final int encrypt_to_clipboard = 0x21070014;
|
||||
public static final int decrypt = 0x21070015;
|
||||
public static final int decrypt_to_clipboard = 0x21070016;
|
||||
public static final int reply = 0x21070016;
|
||||
public static final int cancel = 0x21070017;
|
||||
public static final int save = 0x21070018;
|
||||
|
||||
|
@ -117,13 +117,13 @@ public class DecryptActivity extends BaseActivity {
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
if (mDecryptEnabled) {
|
||||
menu.add(1, Id.menu.option.encrypt_to_clipboard, 0, mDecryptString)
|
||||
menu.add(1, Id.menu.option.decrypt, 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)
|
||||
menu.add(1, Id.menu.option.reply, 1, mReplyString)
|
||||
// .setIcon(R.drawable.ic_menu_decrypt)
|
||||
.setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||
@ -132,6 +132,26 @@ public class DecryptActivity extends BaseActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Id.menu.option.decrypt: {
|
||||
decryptClicked();
|
||||
|
||||
return true;
|
||||
}
|
||||
case Id.menu.option.reply: {
|
||||
replyClicked();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -171,8 +191,6 @@ 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);
|
||||
mSignatureLayout = (LinearLayout) findViewById(R.id.signature);
|
||||
mSignatureStatusImage = (ImageView) findViewById(R.id.ic_signature_status);
|
||||
mUserId = (TextView) findViewById(R.id.mainUserId);
|
||||
@ -258,6 +276,9 @@ public class DecryptActivity extends BaseActivity {
|
||||
mMessage.setText(textData);
|
||||
mDecryptString = getString(R.string.btn_verify);
|
||||
// mDecryptButton.setText(R.string.btn_verify);
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
} else {
|
||||
Log.d(Constants.TAG, "Nothing matched!");
|
||||
}
|
||||
@ -305,7 +326,8 @@ public class DecryptActivity extends BaseActivity {
|
||||
mMessage.setText(data);
|
||||
mDecryptString = getString(R.string.btn_verify);
|
||||
|
||||
// mDecryptButton.setText(R.string.btn_verify);
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -348,21 +370,11 @@ public class DecryptActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
// mDecryptButton.setOnClickListener(new OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// decryptClicked();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mReplyButton.setOnClickListener(new OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// replyClicked();
|
||||
// }
|
||||
// });
|
||||
// mReplyButton.setVisibility(View.INVISIBLE);
|
||||
|
||||
mReplyEnabled = false;
|
||||
|
||||
// build new actionbar
|
||||
invalidateOptionsMenu();
|
||||
|
||||
if (mReturnResult) {
|
||||
mSourcePrevious.setClickable(false);
|
||||
mSourcePrevious.setEnabled(false);
|
||||
@ -381,6 +393,7 @@ public class DecryptActivity extends BaseActivity {
|
||||
if (mSource.getCurrentView().getId() == R.id.sourceMessage
|
||||
&& (mMessage.getText().length() > 0 || mData != null || mContentUri != null)) {
|
||||
// mDecryptButton.performClick();
|
||||
// TODO: why was it performClick()???
|
||||
decryptClicked();
|
||||
}
|
||||
}
|
||||
@ -416,16 +429,19 @@ 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);
|
||||
mDecryptString = getString(R.string.btn_decrypt);
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.sourceMessage: {
|
||||
mSourceLabel.setText(R.string.label_message);
|
||||
// mDecryptButton.setText(R.string.btn_decrypt);
|
||||
mDecryptString = getString(R.string.btn_decrypt);
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -633,9 +649,11 @@ public class DecryptActivity extends BaseActivity {
|
||||
removeDialog(Id.dialog.decrypting);
|
||||
mSignatureKeyId = 0;
|
||||
mSignatureLayout.setVisibility(View.GONE);
|
||||
// mReplyButton.setVisibility(View.INVISIBLE);
|
||||
mReplyEnabled = false;
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
|
||||
String error = data.getString(Apg.EXTRA_ERROR);
|
||||
if (error != null) {
|
||||
Toast.makeText(this, getString(R.string.errorMessage, error), Toast.LENGTH_SHORT)
|
||||
@ -657,8 +675,10 @@ public class DecryptActivity extends BaseActivity {
|
||||
String decryptedMessage = data.getString(Apg.EXTRA_DECRYPTED_MESSAGE);
|
||||
mMessage.setText(decryptedMessage);
|
||||
mMessage.setHorizontallyScrolling(false);
|
||||
// mReplyButton.setVisibility(View.VISIBLE);
|
||||
mReplyEnabled = false;
|
||||
|
||||
// build new action bar
|
||||
invalidateOptionsMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
|
79
org_apg/src/org/apg/ui/HelpActivity.java
Normal file
79
org_apg/src/org/apg/ui/HelpActivity.java
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
import org.apg.R;
|
||||
import org.apg.util.Utils;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class HelpActivity extends SherlockActivity {
|
||||
Activity mActivity;
|
||||
TextView mHelpText;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case android.R.id.home:
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate View for this Activity
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.help_activity);
|
||||
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mActivity = this;
|
||||
|
||||
mHelpText = (TextView) findViewById(R.id.help_text);
|
||||
|
||||
// load html from html file from /res/raw
|
||||
String helpText = Utils.readContentFromResource(mActivity, R.raw.help);
|
||||
|
||||
// set text from resources with html markup
|
||||
mHelpText.setText(Html.fromHtml(helpText));
|
||||
// make links work
|
||||
mHelpText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -46,7 +46,6 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
public void myKeysOnClick(View view) {
|
||||
startActivity(new Intent(this, SecretKeyListActivity.class));
|
||||
|
||||
}
|
||||
|
||||
public void encryptOnClick(View view) {
|
||||
@ -68,7 +67,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
public void helpOnClick(View view) {
|
||||
// TODO: implement help view
|
||||
startActivity(new Intent(this, HelpActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
54
org_apg/src/org/apg/util/Utils.java
Normal file
54
org_apg/src/org/apg/util/Utils.java
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class Utils {
|
||||
|
||||
/**
|
||||
* Reads html files from /res/raw/example.html to output them as string. See
|
||||
* http://www.monocube.com/2011/02/08/android-tutorial-html-file-in-webview/
|
||||
*
|
||||
* @param context
|
||||
* current context
|
||||
* @param resourceID
|
||||
* of html file to read
|
||||
* @return content of html file with formatting
|
||||
*/
|
||||
public static String readContentFromResource(Context context, int resourceID) {
|
||||
InputStream raw = context.getResources().openRawResource(resourceID);
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
int i;
|
||||
try {
|
||||
i = raw.read();
|
||||
while (i != -1) {
|
||||
stream.write(i);
|
||||
i = raw.read();
|
||||
}
|
||||
raw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return stream.toString();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user