map view: add qrz.com button

storage_ts_index
Georg Lukas 2010-12-22 01:56:40 +01:00
rodzic a9e124b37d
commit 97f82ec4cd
3 zmienionych plików z 29 dodań i 10 usunięć

Wyświetl plik

@ -144,17 +144,10 @@ class APRSdroid extends Activity with OnClickListener
.setView(aboutview)
.setIcon(android.R.drawable.ic_dialog_info)
.setPositiveButton(android.R.string.ok, null)
.setNeutralButton(R.string.ad_homepage, new HomePageOpener())
.setNeutralButton(R.string.ad_homepage, new UrlOpener(this, "http://aprsdroid.org/"))
.create.show
}
class HomePageOpener extends DialogInterface.OnClickListener {
override def onClick(d : DialogInterface, which : Int) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://aprsdroid.org/")))
}
}
override def onOptionsItemSelected(mi : MenuItem) : Boolean = {
mi.getItemId match {
case R.id.preferences =>
@ -205,3 +198,10 @@ class APRSdroid extends Activity with OnClickListener
}
class UrlOpener(ctx : Context, url : String) extends DialogInterface.OnClickListener {
override def onClick(d : DialogInterface, which : Int) {
ctx.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(url)))
}
}

Wyświetl plik

@ -240,7 +240,7 @@ class StationOverlay(icons : Drawable, context : Context, db : StorageDatabase)
Log.d(TAG, "user clicked on " + s.call)
// extract stations last report from database
val cur = db.getPosts("MESSAGE like ?", Array("%s%%".format(s.call)), "1")
var cur = db.getPosts("MESSAGE like ?", Array("%s%%".format(s.call)), "1")
cur.moveToFirst()
val message = if (!cur.isAfterLast()) {
"%s %s".format(cur.getString(cur.getColumnIndexOrThrow("TSS")),
@ -252,9 +252,22 @@ class StationOverlay(icons : Drawable, context : Context, db : StorageDatabase)
cur.close()
// display a dialog with last report
val title = context.getString(R.string.sta_lastreport, s.call)
val ssidlist = new scala.collection.mutable.ArrayBuffer[CharSequence]()
cur = db.getAllSsids(s.call)
cur.moveToFirst()
while (!cur.isAfterLast()) {
ssidlist += cur.getString(StorageDatabase.Position.COLUMN_CALL)
Log.d(TAG, "%s has %s".format(s.call, cur.getString(StorageDatabase.Position.COLUMN_CALL)))
cur.moveToNext()
}
cur.close()
val qrzurl = "http://qrz.com/db/%s".format(s.call.split("-")(0))
new AlertDialog.Builder(context).setTitle(title)
.setMessage(message)
.setPositiveButton(android.R.string.ok, null)
//.setItems(ssidlist.toArray, null)
.setPositiveButton("QRZ.com", new UrlOpener(context, qrzurl))
.setNegativeButton(android.R.string.ok, null)
.create.show
true

Wyświetl plik

@ -158,6 +158,12 @@ class StorageDatabase(context : Context) extends
"call LIKE ? AND TS > ?", Array(call, limit),
null, null, "_ID DESC", null)
}
def getAllSsids(call : String) : Cursor = {
val querycall = call.split("-")(0) + "%"
getReadableDatabase().query(Position.TABLE, Position.COLUMNS,
"call LIKE ?", Array(querycall),
"call", null, null, null)
}
def addPost(ts : Long, posttype : Int, status : String, message : String) {
val cv = new ContentValues()