kopia lustrzana https://github.com/ge0rg/aprsdroid
use origin/object syntax in intents
rodzic
a903daf0a4
commit
3983580797
|
@ -36,8 +36,7 @@ class HubActivity extends MainListActivity("hub", R.id.hub) {
|
|||
override def onListItemClick(l : ListView, v : View, position : Int, id : Long) {
|
||||
//super.onListItemClick(l, v, position, id)
|
||||
val c = getListView().getItemAtPosition(position).asInstanceOf[Cursor]
|
||||
val call = c.getString(StorageDatabase.Station.COLUMN_CALL)
|
||||
openDetails(call)
|
||||
openDetails(StorageDatabase.cursor2call(c))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import _root_.android.widget.{ListView,SimpleCursorAdapter}
|
|||
|
||||
class StationActivity extends LoadingListActivity
|
||||
with OnClickListener {
|
||||
lazy val targetcall = getIntent().getDataString()
|
||||
lazy val (origin, targetcall) = demuxCall(getIntent().getDataString())
|
||||
|
||||
lazy val storage = StorageDatabase.open(this)
|
||||
lazy val postlist = findViewById(R.id.postlist).asInstanceOf[ListView]
|
||||
|
@ -38,7 +38,7 @@ class StationActivity extends LoadingListActivity
|
|||
findViewById(id).setOnClickListener(this)
|
||||
})
|
||||
|
||||
setTitle(getString(R.string.app_sta) + ": " + targetcall)
|
||||
setTitle(getString(R.string.app_sta) + ": " + getIntent.getDataString())
|
||||
}
|
||||
|
||||
override def onDestroy() {
|
||||
|
@ -87,4 +87,12 @@ class StationActivity extends LoadingListActivity
|
|||
c.close()
|
||||
}
|
||||
|
||||
|
||||
def demuxCall(origincall : String) = {
|
||||
val oc = origincall.split("/", 2)
|
||||
if (oc.length == 2)
|
||||
(oc(0), oc(1))
|
||||
else
|
||||
(oc(0), oc(0))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,14 +159,22 @@ object StorageDatabase {
|
|||
def cursor2call(c : Cursor) : String = {
|
||||
val msgidx = c.getColumnIndex(Post.MESSAGE)
|
||||
val callidx = c.getColumnIndex(Station.CALL)
|
||||
val originidx = c.getColumnIndex(Station.ORIGIN)
|
||||
if (msgidx != -1 && callidx == -1) { // Post table
|
||||
val t = c.getInt(Post.COLUMN_TYPE)
|
||||
if (t == Post.TYPE_POST || t == Post.TYPE_INCMG)
|
||||
c.getString(msgidx).split(">")(0)
|
||||
else
|
||||
null
|
||||
} else
|
||||
} else if (callidx != -1 && originidx == -1) { // Message table
|
||||
c.getString(callidx)
|
||||
} else { // Station table
|
||||
val origin = c.getString(Station.COLUMN_ORIGIN)
|
||||
if (origin != null)
|
||||
"%s/%s".format(origin, c.getString(callidx))
|
||||
else
|
||||
c.getString(callidx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue