kopia lustrzana https://github.com/ge0rg/aprsdroid
remove more elements from gui
rodzic
1c5902d4b0
commit
b416512eee
|
@ -1,23 +1,4 @@
|
|||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<TextView
|
||||
android:id="@+id/latlon"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="Coordinates"
|
||||
android:textSize="22dp"
|
||||
android:gravity="center"
|
||||
>
|
||||
</TextView>
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="status"
|
||||
android:textSize="18dp"
|
||||
>
|
||||
</TextView>
|
||||
<ListView
|
||||
android:id="@+id/postlist"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -25,8 +25,6 @@ class APRSdroid extends Activity with OnClickListener
|
|||
lazy val storage = StorageDatabase.open(this)
|
||||
lazy val postcursor = storage.getPosts("10")
|
||||
|
||||
lazy val latlon = findViewById(R.id.latlon).asInstanceOf[TextView]
|
||||
lazy val status = findViewById(R.id.status).asInstanceOf[TextView]
|
||||
lazy val postlist = findViewById(R.id.postlist).asInstanceOf[ListView]
|
||||
|
||||
lazy val singleBtn = findViewById(R.id.singlebtn).asInstanceOf[Button]
|
||||
|
@ -35,21 +33,8 @@ class APRSdroid extends Activity with OnClickListener
|
|||
lazy val locReceiver = new BroadcastReceiver() {
|
||||
override def onReceive(ctx : Context, i : Intent) {
|
||||
val l = i.getParcelableExtra(AprsService.LOCATION).asInstanceOf[Location]
|
||||
if (l != null)
|
||||
onLocationChanged(l)
|
||||
val s = i.getStringExtra(AprsService.STATUS)
|
||||
if (s != null) {
|
||||
val timestamp = new SimpleDateFormat("HH:mm:ss").format(new Date())
|
||||
lastPost.status = timestamp + " " + s
|
||||
status.setText(lastPost.status)
|
||||
}
|
||||
val p = i.getStringExtra(AprsService.PACKET)
|
||||
if (p != null) {
|
||||
Log.d(TAG, "received " + p)
|
||||
lastPost.packet = p
|
||||
postcursor.requery()
|
||||
postlist.setSelection(0)
|
||||
}
|
||||
postcursor.requery()
|
||||
postlist.setSelection(0)
|
||||
setupButtons(AprsService.running)
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +53,7 @@ class APRSdroid extends Activity with OnClickListener
|
|||
postcursor,
|
||||
Array("TSS", StorageDatabase.Post.STATUS, StorageDatabase.Post.MESSAGE),
|
||||
Array(R.id.listts, R.id.liststatus, R.id.listmessage))
|
||||
la.setViewBinder(new PostViewBinder())
|
||||
postlist.setAdapter(la)
|
||||
}
|
||||
|
||||
|
@ -87,8 +73,6 @@ class APRSdroid extends Activity with OnClickListener
|
|||
val callsign = prefs.getString("callsign", "")
|
||||
val callssid = AprsPacket.formatCallSsid(callsign, prefs.getString("ssid", ""))
|
||||
setTitle(getString(R.string.app_name) + ": " + callssid)
|
||||
latlon.setText(lastPost.latlon)
|
||||
status.setText(lastPost.status)
|
||||
setupButtons(AprsService.running)
|
||||
}
|
||||
|
||||
|
@ -97,11 +81,6 @@ class APRSdroid extends Activity with OnClickListener
|
|||
unregisterReceiver(locReceiver)
|
||||
}
|
||||
|
||||
def onLocationChanged(location : Location) {
|
||||
lastPost.latlon = getString(R.string.latlon_format).format(location.getLatitude,
|
||||
location.getLongitude, location.getAccuracy.asInstanceOf[Int])
|
||||
latlon.setText(lastPost.latlon)
|
||||
}
|
||||
def serviceIntent(action : String) : Intent = {
|
||||
new Intent(action, null, this, classOf[AprsService])
|
||||
}
|
||||
|
@ -198,15 +177,9 @@ class APRSdroid extends Activity with OnClickListener
|
|||
}
|
||||
setupButtons(!is_running)
|
||||
case _ =>
|
||||
status.setText(view.asInstanceOf[Button].getText)
|
||||
//status.setText(view.asInstanceOf[Button].getText)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object lastPost {
|
||||
var latlon = "<Coordinates>"
|
||||
var status = "No events in the log"
|
||||
var packet = ""
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue