kopia lustrzana https://github.com/ge0rg/aprsdroid
added About dialog
rodzic
9bcbeb6bb2
commit
5514ca65b3
|
@ -2,7 +2,10 @@
|
|||
<item android:id="@+id/preferences"
|
||||
android:title="@string/preferences"
|
||||
android:icon="@android:drawable/ic_menu_preferences" />
|
||||
<item android:id="@+id/about"
|
||||
android:title="@string/about"
|
||||
android:icon="@android:drawable/ic_menu_info_details" />
|
||||
<item android:id="@+id/quit"
|
||||
android:title="Quit"
|
||||
android:title="@string/quit"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
</menu>
|
||||
|
|
|
@ -21,6 +21,29 @@
|
|||
operators!\n\n
|
||||
If you operate without a license, you might be criminally prosecuted!</string>
|
||||
|
||||
<string name="ad_title">About APRSdroid v%s</string>
|
||||
<string name="ad_text">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
|
||||
</string>
|
||||
|
||||
<string name="about">About</string>
|
||||
<string name="quit">Quit</string>
|
||||
<string name="preferences">Preferences</string>
|
||||
<string name="p__ham">Amateur Radio</string>
|
||||
<string name="p_callsign">Callsign</string>
|
||||
|
|
|
@ -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();
|
||||
|
|
Ładowanie…
Reference in New Issue