From b1a90ffecc58862343c5a4ac6afa7efd11ad25d0 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Sun, 13 Feb 2011 00:45:29 -0600 Subject: [PATCH] Initial about screen; need to make the about links clickable --- astrid/res/values/strings-about.xml | 14 +++++ .../astrid/activity/AboutActivity.java | 55 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 astrid/res/values/strings-about.xml create mode 100644 astrid/src/com/todoroo/astrid/activity/AboutActivity.java diff --git a/astrid/res/values/strings-about.xml b/astrid/res/values/strings-about.xml new file mode 100644 index 000000000..f8dc01032 --- /dev/null +++ b/astrid/res/values/strings-about.xml @@ -0,0 +1,14 @@ + + +About Astrid +Astrid Tasks\n\n + +Current version: %s\n\n + +Astrid is open-source and proudly maintained by Todoroo, Inc.\n\n + +Source: http://github.com/todoroo/astrid\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! + diff --git a/astrid/src/com/todoroo/astrid/activity/AboutActivity.java b/astrid/src/com/todoroo/astrid/activity/AboutActivity.java new file mode 100644 index 000000000..1fb285454 --- /dev/null +++ b/astrid/src/com/todoroo/astrid/activity/AboutActivity.java @@ -0,0 +1,55 @@ +/* + * Copyright 2008 Google Inc. + * + * 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 com.todoroo.astrid.activity; + +import java.util.Formatter; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.res.Resources; + +import com.timsu.astrid.R; + +/** + * Displays an About ("End User License Agreement") that the user has to accept + * before using the application. Your application should call + * {@link About#showAbout(android.app.Activity)} in the onCreate() method of the + * first activity. If the user accepts the About, it will never be shown again. + * If the user refuses, {@link android.app.Activity#finish()} is invoked on your + * activity. + */ +class About { + private static final String PREFERENCES_ABOUT = "About"; //$NON-NLS-1$ + + /** + * Displays the About if necessary. This method should be called from the + * onCreate() method of your main Activity. + * + * @param activity + * The Activity to finish if the user rejects the About + */ + static void showAbout(final Activity activity, final Resources r, final String versionName) { + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setTitle(R.string.p_about); + builder.setCancelable(true); + builder.setMessage((new Formatter()).format(r.getString(R.string.p_about_text), versionName).toString()); + builder.show(); + } + + private About() { + // don't construct me + } +} \ No newline at end of file