diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4b7569009..67daac710 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -39,6 +39,7 @@
Export Key
Export Keys
Key Not Found
+ Getting Started
User IDs
@@ -80,6 +81,7 @@
Create Key
Edit Key
Search
+ Help
Sign
@@ -263,5 +265,14 @@
slow
very slow
+
+
+ Install K-9 Mail for the best integration, it supports APG for PGP/INLINE and lets you directly encrypt/decrypt emails.
+\n\nIt is recommended that you install OI File Manager or ASTRO to be able to use the browse button for file selection in APG.
+\n\nFirst you need some keys. Either import them via the option menus in \"Manage Public Keys\" and \"Manage Secret Keys\" or create them in \"Manage Secret Keys\".
+\n\nYou can also add a GMail account in the main activity via \"Add Account\", which simplifies decrypting emails received there.
+\n\nCheck out the option menus in the various activities to find more functions.
+
+
diff --git a/src/org/thialfihar/android/apg/Constants.java b/src/org/thialfihar/android/apg/Constants.java
index 0a819a509..b61395269 100644
--- a/src/org/thialfihar/android/apg/Constants.java
+++ b/src/org/thialfihar/android/apg/Constants.java
@@ -24,6 +24,7 @@ public final class Constants {
}
public static final class pref {
+ public static final String has_seen_help = "seenHelp";
public static final String has_seen_change_log = "seenChangeLogDialog";
public static final String default_encryption_algorithm = "defaultEncryptionAlgorithm";
public static final String default_hash_algorithm = "defaultHashAlgorithm";
diff --git a/src/org/thialfihar/android/apg/Id.java b/src/org/thialfihar/android/apg/Id.java
index 73ac39218..cc256caee 100644
--- a/src/org/thialfihar/android/apg/Id.java
+++ b/src/org/thialfihar/android/apg/Id.java
@@ -34,6 +34,7 @@ public final class Id {
public static final int export_keys = 0x21070007;
public static final int preferences = 0x21070008;
public static final int search = 0x21070009;
+ public static final int help = 0x21070010;
}
}
@@ -76,6 +77,7 @@ public final class Id {
public static final int output_filename = 0x21070011;
public static final int delete_file = 0x21070012;
public static final int deleting = 0x21070013;
+ public static final int help = 0x21070014;
}
public static final class task {
diff --git a/src/org/thialfihar/android/apg/MainActivity.java b/src/org/thialfihar/android/apg/MainActivity.java
index 31ff027d3..6ac44b71a 100644
--- a/src/org/thialfihar/android/apg/MainActivity.java
+++ b/src/org/thialfihar/android/apg/MainActivity.java
@@ -16,6 +16,9 @@
package org.thialfihar.android.apg;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.thialfihar.android.apg.provider.Accounts;
import android.app.AlertDialog;
@@ -28,6 +31,8 @@ import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
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;
@@ -117,6 +122,10 @@ public class MainActivity extends BaseActivity {
});
registerForContextMenu(mAccounts);
+ if (!mPreferences.hasSeenHelp()) {
+ showDialog(Id.dialog.help);
+ }
+
if (!mPreferences.hasSeenChangeLog(Apg.getVersion(this))) {
showDialog(Id.dialog.change_log);
}
@@ -189,20 +198,13 @@ public class MainActivity extends BaseActivity {
View layout = inflater.inflate(R.layout.info, null);
TextView message = (TextView) layout.findViewById(R.id.message);
- message.setText("Read the warnings!\n\n" +
- "Changes:\n" +
- "* k9mail integration, k9mail beta build is available on the k9mail website\n" +
- "* German and Italian translation (thanks, cwoehrl and Fabrizio)\n" +
- "* new preferences GUI\n" +
- "* much smaller package\n" +
- "* signature bugfix\n" +
+ message.setText("Changes:\n" +
+ "* \n" +
"\n" +
"WARNING: be careful editing your existing keys, as they " +
"WILL be stripped of certificates right now.\n" +
"\n" +
- "WARNING: key creation/editing doesn't support all " +
- "GPG features yet. In particular: " +
- "key cross-certification is NOT supported, so signing " +
+ "Also: key cross-certification is NOT supported, so signing " +
"with those keys will get a warning when the signature is " +
"checked.\n" +
"\n" +
@@ -223,6 +225,48 @@ public class MainActivity extends BaseActivity {
return alert.create();
}
+ case Id.dialog.help: {
+ AlertDialog.Builder alert = new AlertDialog.Builder(this);
+
+ alert.setTitle(R.string.title_help);
+
+ LayoutInflater inflater =
+ (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View layout = inflater.inflate(R.layout.info, null);
+ TextView message = (TextView) layout.findViewById(R.id.message);
+ message.setText(R.string.text_help);
+
+ TransformFilter packageNames = new TransformFilter() {
+ public final String transformUrl(final Matcher match, String url) {
+ String name = match.group(1).toLowerCase();
+ if (name.equals("astro")) {
+ return "com.metago.astro";
+ } else if (name.equals("k-9 mail")) {
+ return "com.fsck.k9";
+ } else {
+ return "org.openintents.filemanager";
+ }
+ }
+ };
+
+ Pattern pattern = Pattern.compile("(OI File Manager|ASTRO|K-9 Mail)");
+ String scheme = "market://search?q=pname:";
+ message.setAutoLinkMask(0);
+ Linkify.addLinks(message, pattern, scheme, null, packageNames);
+
+ alert.setView(layout);
+
+ alert.setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ MainActivity.this.removeDialog(Id.dialog.help);
+ mPreferences.setHasSeenHelp(true);
+ }
+ });
+
+ return alert.create();
+ }
+
default: {
return super.onCreateDialog(id);
}
@@ -241,6 +285,8 @@ public class MainActivity extends BaseActivity {
.setIcon(android.R.drawable.ic_menu_preferences);
menu.add(2, Id.menu.option.about, 4, R.string.menu_about)
.setIcon(android.R.drawable.ic_menu_info_details);
+ menu.add(22, Id.menu.option.help, 4, R.string.menu_help)
+ .setIcon(android.R.drawable.ic_menu_help);
return true;
}
@@ -262,6 +308,11 @@ public class MainActivity extends BaseActivity {
return true;
}
+ case Id.menu.option.help: {
+ showDialog(Id.dialog.help);
+ return true;
+ }
+
default: {
return super.onOptionsItemSelected(item);
}
diff --git a/src/org/thialfihar/android/apg/Preferences.java b/src/org/thialfihar/android/apg/Preferences.java
index cf5470f2a..0df29718c 100644
--- a/src/org/thialfihar/android/apg/Preferences.java
+++ b/src/org/thialfihar/android/apg/Preferences.java
@@ -113,4 +113,14 @@ public class Preferences {
editor.putBoolean(Constants.pref.has_seen_change_log + version, value);
editor.commit();
}
+
+ public boolean hasSeenHelp() {
+ return mSharedPreferences.getBoolean(Constants.pref.has_seen_help, false);
+ }
+
+ public void setHasSeenHelp(boolean value) {
+ SharedPreferences.Editor editor = mSharedPreferences.edit();
+ editor.putBoolean(Constants.pref.has_seen_help, value);
+ editor.commit();
+ }
}