added a little getting started dialog for first-time use, explaining some basics and recommending other apps

Update issue 39
Added:
    <string name="title_help">Getting Started</string>
    <string name="menu_help">Help</string>
    <!-- "OI File Manager", "ASTRO", and "K-9 Mail" must NOT be translated in order for the links to the market to work. -->
    <string name="text_help">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.
    </string>
This commit is contained in:
Thialfihar 2010-07-24 16:30:38 +00:00
parent b650b30a11
commit f65888046e
5 changed files with 85 additions and 10 deletions

View File

@ -39,6 +39,7 @@
<string name="title_exportKey">Export Key</string> <string name="title_exportKey">Export Key</string>
<string name="title_exportKeys">Export Keys</string> <string name="title_exportKeys">Export Keys</string>
<string name="title_keyNotFound">Key Not Found</string> <string name="title_keyNotFound">Key Not Found</string>
<string name="title_help">Getting Started</string>
<!-- section_lowerCase: capitalized words, no punctuation --> <!-- section_lowerCase: capitalized words, no punctuation -->
<string name="section_userIds">User IDs</string> <string name="section_userIds">User IDs</string>
@ -80,6 +81,7 @@
<string name="menu_createKey">Create Key</string> <string name="menu_createKey">Create Key</string>
<string name="menu_editKey">Edit Key</string> <string name="menu_editKey">Edit Key</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="menu_help">Help</string>
<!-- label_lowerCase: capitalized words, no punctuation --> <!-- label_lowerCase: capitalized words, no punctuation -->
<string name="label_sign">Sign</string> <string name="label_sign">Sign</string>
@ -263,5 +265,14 @@
<string name="slow">slow</string> <string name="slow">slow</string>
<string name="very_slow">very slow</string> <string name="very_slow">very slow</string>
<!-- texts -->
<!-- "OI File Manager", "ASTRO", and "K-9 Mail" must not be translated in order for the links to the market to work. -->
<string name="text_help">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.
</string>
</resources> </resources>

View File

@ -24,6 +24,7 @@ public final class Constants {
} }
public static final class pref { 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 has_seen_change_log = "seenChangeLogDialog";
public static final String default_encryption_algorithm = "defaultEncryptionAlgorithm"; public static final String default_encryption_algorithm = "defaultEncryptionAlgorithm";
public static final String default_hash_algorithm = "defaultHashAlgorithm"; public static final String default_hash_algorithm = "defaultHashAlgorithm";

View File

@ -34,6 +34,7 @@ public final class Id {
public static final int export_keys = 0x21070007; public static final int export_keys = 0x21070007;
public static final int preferences = 0x21070008; public static final int preferences = 0x21070008;
public static final int search = 0x21070009; 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 output_filename = 0x21070011;
public static final int delete_file = 0x21070012; public static final int delete_file = 0x21070012;
public static final int deleting = 0x21070013; public static final int deleting = 0x21070013;
public static final int help = 0x21070014;
} }
public static final class task { public static final class task {

View File

@ -16,6 +16,9 @@
package org.thialfihar.android.apg; package org.thialfihar.android.apg;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.thialfihar.android.apg.provider.Accounts; import org.thialfihar.android.apg.provider.Accounts;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -28,6 +31,8 @@ import android.database.Cursor;
import android.database.SQLException; import android.database.SQLException;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.text.util.Linkify;
import android.text.util.Linkify.TransformFilter;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -117,6 +122,10 @@ public class MainActivity extends BaseActivity {
}); });
registerForContextMenu(mAccounts); registerForContextMenu(mAccounts);
if (!mPreferences.hasSeenHelp()) {
showDialog(Id.dialog.help);
}
if (!mPreferences.hasSeenChangeLog(Apg.getVersion(this))) { if (!mPreferences.hasSeenChangeLog(Apg.getVersion(this))) {
showDialog(Id.dialog.change_log); showDialog(Id.dialog.change_log);
} }
@ -189,20 +198,13 @@ public class MainActivity extends BaseActivity {
View layout = inflater.inflate(R.layout.info, null); View layout = inflater.inflate(R.layout.info, null);
TextView message = (TextView) layout.findViewById(R.id.message); TextView message = (TextView) layout.findViewById(R.id.message);
message.setText("Read the warnings!\n\n" + message.setText("Changes:\n" +
"Changes:\n" + "* \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" +
"\n" + "\n" +
"WARNING: be careful editing your existing keys, as they " + "WARNING: be careful editing your existing keys, as they " +
"WILL be stripped of certificates right now.\n" + "WILL be stripped of certificates right now.\n" +
"\n" + "\n" +
"WARNING: key creation/editing doesn't support all " + "Also: key cross-certification is NOT supported, so signing " +
"GPG features yet. In particular: " +
"key cross-certification is NOT supported, so signing " +
"with those keys will get a warning when the signature is " + "with those keys will get a warning when the signature is " +
"checked.\n" + "checked.\n" +
"\n" + "\n" +
@ -223,6 +225,48 @@ public class MainActivity extends BaseActivity {
return alert.create(); 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: { default: {
return super.onCreateDialog(id); return super.onCreateDialog(id);
} }
@ -241,6 +285,8 @@ public class MainActivity extends BaseActivity {
.setIcon(android.R.drawable.ic_menu_preferences); .setIcon(android.R.drawable.ic_menu_preferences);
menu.add(2, Id.menu.option.about, 4, R.string.menu_about) menu.add(2, Id.menu.option.about, 4, R.string.menu_about)
.setIcon(android.R.drawable.ic_menu_info_details); .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; return true;
} }
@ -262,6 +308,11 @@ public class MainActivity extends BaseActivity {
return true; return true;
} }
case Id.menu.option.help: {
showDialog(Id.dialog.help);
return true;
}
default: { default: {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

View File

@ -113,4 +113,14 @@ public class Preferences {
editor.putBoolean(Constants.pref.has_seen_change_log + version, value); editor.putBoolean(Constants.pref.has_seen_change_log + version, value);
editor.commit(); 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();
}
} }