1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Added about dialog.

This commit is contained in:
Bradley Young 2008-12-18 05:44:47 +00:00
parent abd81a81c1
commit b000da55d1
3 changed files with 70 additions and 4 deletions

View File

@ -17,6 +17,11 @@
android:title="@string/compose_action" android:title="@string/compose_action"
android:icon="@drawable/ic_menu_compose" android:icon="@drawable/ic_menu_compose"
/> />
<item
android:id="@+id/about"
android:title="@string/about_action"
android:icon="@drawable/ic_menu_preferences"
/>
<!-- <!--
<item android:id="@+id/search" <item android:id="@+id/search"
android:title="@string/search_action" /> android:title="@string/search_action" />

View File

@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">K-9</string> <string name="app_name">K-9</string>
<string name="app_authors">Google, The K-9 Krew, and a cast of thousands.</string>
<string name="app_authors_fmt">Authors: <xliff:g id="app_authors">%s</xliff:g></string>
<string name="app_revision_url">http://code.google.com/p/k9mail/wiki/ReleaseNotes</string>
<string name="app_revision_fmt">Revision Information: <xliff:g id="app_revision_url">%s</xliff:g></string>
<string name="app_webpage_url">http://code.google.com/p/k9mail/</string>
<string name="read_attachment_label">read Email attachments</string> <string name="read_attachment_label">read Email attachments</string>
<string name="read_attachment_desc">Allows this application to read your Email attachments.</string> <string name="read_attachment_desc">Allows this application to read your Email attachments.</string>
<string name="about_title_fmt">About <xliff:g id="app_name">%s</xliff:g></string>
<string name="accounts_title">Your accounts</string> <string name="accounts_title">Your accounts</string>
<string name="compose_title">Compose</string> <string name="compose_title">Compose</string>
<string name="debug_title">Debug</string> <string name="debug_title">Debug</string>
@ -44,6 +50,7 @@
<string name="add_attachment_action">Add attachment</string> <string name="add_attachment_action">Add attachment</string>
<string name="dump_settings_action">Dump settings</string> <string name="dump_settings_action">Dump settings</string>
<string name="empty_trash_action">Empty Trash</string> <string name="empty_trash_action">Empty Trash</string>
<string name="about_action">About</string>
<string name="accounts_context_menu_title">Account options</string> <string name="accounts_context_menu_title">Account options</string>
@ -133,6 +140,9 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="message_discarded_toast">Message discarded.</string> <string name="message_discarded_toast">Message discarded.</string>
<string name="message_saved_toast">Message saved as draft.</string> <string name="message_saved_toast">Message saved as draft.</string>
<string name="about_header">About <xliff:g id="app_name">%s</xliff:g></string>
<string name="about_version">Version: <xliff:g id="version">%s</xliff:g></string>
<string name="account_setup_basics_title">Set up email</string> <string name="account_setup_basics_title">Set up email</string>
<string name="account_setup_basics_instructions">Type your account email address:</string> <string name="account_setup_basics_instructions">Type your account email address:</string>
<string name="account_setup_basics_instructions2_fmt">(You may add <xliff:g id="number_accounts">%d</xliff:g> more accounts.)</string> <string name="account_setup_basics_instructions2_fmt">(You may add <xliff:g id="number_accounts">%d</xliff:g> more accounts.)</string>

View File

@ -8,6 +8,8 @@ import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -15,10 +17,13 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
@ -31,6 +36,7 @@ import com.fsck.k9.Preferences;
import com.fsck.k9.R; import com.fsck.k9.R;
import com.fsck.k9.activity.setup.AccountSettings; import com.fsck.k9.activity.setup.AccountSettings;
import com.fsck.k9.activity.setup.AccountSetupBasics; import com.fsck.k9.activity.setup.AccountSetupBasics;
import com.fsck.k9.activity.setup.AccountSetupCheckSettings;
import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Store; import com.fsck.k9.mail.Store;
import com.fsck.k9.mail.store.LocalStore; import com.fsck.k9.mail.store.LocalStore;
@ -198,12 +204,57 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
case R.id.compose: case R.id.compose:
onCompose(); onCompose();
break; break;
case R.id.about:
onAbout();
break;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
return true; return true;
} }
private void onAbout() {
String appName = getString(R.string.app_name);
WebView wv = new WebView(this);
String html = "<h1>" + String.format(getString(R.string.about_title_fmt).toString(),
"<a href=\"" + getString(R.string.app_webpage_url) + "\">" + appName + "</a>") + "</h1>" +
"<p>" + appName + " " +
String.format(getString(R.string.debug_version_fmt).toString(),
getVersionNumber()) + "</p>" +
"<p>" + String.format(getString(R.string.app_authors_fmt).toString(),
getString(R.string.app_authors)) + "</p>" +
"<p>" + String.format(getString(R.string.app_revision_fmt).toString(),
"<a href=\"" + getString(R.string.app_revision_url) + "\">" +
getString(R.string.app_revision_url) + "</a></p>");
wv.loadData(html, "text/html", "utf-8");
new AlertDialog.Builder(this)
.setView(wv)
.setCancelable(true)
.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener () {
public void onClick(DialogInterface d, int c) {
d.dismiss();
}
})
.show();
}
/**
* Get current version number.
*
* @return String version
*/
private String getVersionNumber() {
String version = "?";
try {
PackageInfo pi =
getPackageManager().getPackageInfo(getPackageName(), 0);
version = pi.versionName;
} catch (PackageManager.NameNotFoundException e) {
//Log.e(TAG, "Package name not found", e);
};
return version;
}
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
return true; return true;
} }