From 5514ca65b3849b407cb8e9e7adb5334ee9a608bc Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Mon, 8 Feb 2010 01:35:33 +0100 Subject: [PATCH] added About dialog --- res/menu/options.xml | 5 ++++- res/values/strings.xml | 23 +++++++++++++++++++++++ src/APRSdroid.scala | 14 ++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/res/menu/options.xml b/res/menu/options.xml index 91bdd28..bf54e7f 100644 --- a/res/menu/options.xml +++ b/res/menu/options.xml @@ -2,7 +2,10 @@ + diff --git a/res/values/strings.xml b/res/values/strings.xml index 9ff8fef..ca305ed 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -21,6 +21,29 @@ operators!\n\n If you operate without a license, you might be criminally prosecuted! +About APRSdroid v%s +Copyright © 2009-2010 Georg Lukas (DO1GL)\n + http://op-co.de/ <georg@op-co.de> + \n\n + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + \n\n + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + \n\n + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + \n\n + http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + + +About +Quit Preferences Amateur Radio Callsign diff --git a/src/APRSdroid.scala b/src/APRSdroid.scala index dc26766..bf5b069 100644 --- a/src/APRSdroid.scala +++ b/src/APRSdroid.scala @@ -3,6 +3,7 @@ package de.duenndns.aprsdroid import _root_.android.app.Activity import _root_.android.app.AlertDialog import _root_.android.content._ +import _root_.android.content.pm.PackageInfo; import _root_.android.location._ import _root_.android.os.Bundle import _root_.android.preference.PreferenceManager @@ -126,11 +127,24 @@ class APRSdroid extends Activity with OnClickListener } } + def aboutDialog() { + val pi = getPackageManager().getPackageInfo(getPackageName(), 0) + val title = getString(R.string.ad_title, pi.versionName); + new AlertDialog.Builder(this).setTitle(title) + .setMessage(getString(R.string.ad_text)) + .setIcon(android.R.drawable.ic_dialog_info) + .setPositiveButton(android.R.string.ok, null) + .create.show + } + override def onOptionsItemSelected(mi : MenuItem) : Boolean = { mi.getItemId match { case R.id.preferences => startActivity(new Intent(this, classOf[PrefsAct])); true + case R.id.about => + aboutDialog() + true case R.id.quit => stopService(serviceIntent(AprsService.SERVICE)) finish();