improved the appearance of the about page

pull/14/head
Tim Su 15 years ago
parent 12e8c23931
commit 08265c0f38

@ -430,17 +430,10 @@
<!-- Title of "About" option in settings --> <!-- Title of "About" option in settings -->
<string name="p_about">About Astrid</string> <string name="p_about">About Astrid</string>
<!-- About text --> <!-- About text (%s => current version)-->
<string name="p_about_text">Astrid Tasks\n\n <string name="p_about_text">Current version: %s\n\n
Current version: %s\n\n Astrid is open-source and proudly maintained by Todoroo, Inc.</string>
Astrid is open-source and proudly maintained by Todoroo, Inc.\n\n
Source: <a href="http://github.com/todoroo/astrid">http://github.com/todoroo/astrid</a>\n
Privacy Policy: http://www.todoroo.com/privacy\n
Terms of Use: http://www.todoroo.com/terms\n
Visit http://weloveastrid.com for more information, to add translations or help make Astrid better!</string>
<!-- ============================================================= Misc == --> <!-- ============================================================= Misc == -->

@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/EPr_title"> android:title="@string/EPr_title">
<PreferenceScreen android:title="" android:key="@string/p_about"></PreferenceScreen> <PreferenceScreen android:title="" android:key="@string/p_about" />
<PreferenceCategory <PreferenceCategory
android:title="@string/EPr_appearance_header"> android:title="@string/EPr_appearance_header">
<ListPreference <ListPreference

@ -15,13 +15,11 @@
*/ */
package com.todoroo.astrid.activity; package com.todoroo.astrid.activity;
import java.util.Formatter;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.res.Resources; import android.content.res.Resources;
import android.text.util.Linkify; import android.text.Html;
import android.widget.TextView; import android.text.Spanned;
import com.timsu.astrid.R; import com.timsu.astrid.R;
@ -34,12 +32,25 @@ class About {
* *
* @param activity For context. * @param activity For context.
*/ */
static void showAbout(final Activity activity, final Resources r, final String versionName) { @SuppressWarnings("nls")
public static void showAbout(final Activity activity, final String versionName) {
Resources r = activity.getResources();
StringBuilder aboutText = new StringBuilder();
aboutText.append("<b>").append(r.getString(R.string.app_name)).append("</b><br />").
append(r.getString(R.string.p_about_text, versionName).replace("\n", "<br />")).append("<br /><br />").
append("<a href='http://github.com/todoroo/astrid'>Source Code</a><br />").
append("<a href='http://www.todoroo.com/privacy'>Privacy Policy</a><br />").
append("<a href='http://www.todoroo.com/terms'>Terms of Use</a><br /><br />").
append("Visit <a href='http://www.weloveastrid.com'>weloveastrid</a> for more information, to add translations or help make Astrid better!");
final AlertDialog.Builder d = new AlertDialog.Builder(activity); final AlertDialog.Builder d = new AlertDialog.Builder(activity);
final TextView t = new TextView(activity);
t.setText((new Formatter()).format(r.getString(R.string.p_about_text), versionName).toString()); Spanned body = Html.fromHtml(aboutText.toString());
t.setAutoLinkMask(Linkify.ALL);
d.setView(t); d.setIcon(android.R.drawable.ic_dialog_info);
d.setMessage(body);
d.setTitle(r.getString(R.string.p_about)); d.setTitle(r.getString(R.string.p_about));
d.show(); d.show();
} }

@ -108,12 +108,15 @@ public class EditPreferences extends TodorooPreferences {
addPreferenceListeners(); addPreferenceListeners();
} }
private void showAbout () /** Show about dialog */
{ private void showAbout () {
String version = "unknown"; //$NON-NLS-1$
try { try {
About.showAbout(this, getResources(), getPackageManager().getPackageInfo("com.timsu.astrid", 0).versionName); version = getPackageManager().getPackageInfo(Constants.PACKAGE, 0).versionName;
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
// sadness
} }
About.showAbout(this, version);
} }
private void addPluginPreferences(PreferenceScreen screen) { private void addPluginPreferences(PreferenceScreen screen) {

Loading…
Cancel
Save