kopia lustrzana https://github.com/ge0rg/aprsdroid
improved status message
rodzic
5c8bf4fb34
commit
43f90a61e4
|
@ -6,6 +6,11 @@
|
|||
<string name="singlelog">Single Shot</string>
|
||||
<string name="startlog">Start Logging</string>
|
||||
<string name="stoplog">Stop Logging</string>
|
||||
|
||||
<string name="service_once">APRS Service single shot.</string>
|
||||
<string name="service_start">APRS Service started. Updates every %d minutes, %d km.</string>
|
||||
<string name="service_stop">APRS Service stopped.</string>
|
||||
|
||||
<string name="preferences">Preferences</string>
|
||||
<string name="p__ham">Amateur Radio</string>
|
||||
<string name="p_callsign">Callsign</string>
|
||||
|
|
|
@ -5,12 +5,14 @@ import _root_.android.content._
|
|||
import _root_.android.location._
|
||||
import _root_.android.os.Bundle
|
||||
import _root_.android.preference.PreferenceManager
|
||||
import _root_.android.text.format.DateFormat
|
||||
import _root_.android.util.Log
|
||||
import _root_.android.view.View
|
||||
import _root_.android.view.View.OnClickListener
|
||||
import _root_.android.widget.Button
|
||||
import _root_.android.widget.TextView
|
||||
import _root_.android.widget.Toast
|
||||
import _root_.java.util.Date
|
||||
|
||||
class APRSdroid extends Activity with OnClickListener {
|
||||
val TAG = "APRSdroid"
|
||||
|
@ -32,7 +34,8 @@ class APRSdroid extends Activity with OnClickListener {
|
|||
onLocationChanged(l)
|
||||
val s = i.getStringExtra(AprsService.STATUS)
|
||||
if (s != null) {
|
||||
status.setText(s)
|
||||
val timestamp = DateFormat.format("hh:mm:ss", new Date())
|
||||
status.setText(timestamp + " " + s)
|
||||
}
|
||||
val p = i.getStringExtra(AprsService.PACKET)
|
||||
if (p != null) {
|
||||
|
|
|
@ -40,10 +40,9 @@ class AprsService extends Service with LocationListener {
|
|||
|
||||
if (i.getAction() == SERVICE_ONCE) {
|
||||
singleShot = true
|
||||
showToast("APRS Service single shot.")
|
||||
showToast(getString(R.string.service_once))
|
||||
} else
|
||||
showToast("APRS Service started. Updates every " + upd_int + " minutes, " + upd_dist + " km.")
|
||||
sendBroadcast(new Intent(UPDATE).putExtra(STATUS, "service started"))
|
||||
showToast(getString(R.string.service_start).format(upd_int, upd_dist))
|
||||
}
|
||||
|
||||
override def onBind(i : Intent) : IBinder = null
|
||||
|
@ -52,13 +51,13 @@ class AprsService extends Service with LocationListener {
|
|||
|
||||
def showToast(msg : String) {
|
||||
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
|
||||
sendBroadcast(new Intent(UPDATE).putExtra(STATUS, msg))
|
||||
}
|
||||
|
||||
override def onDestroy() {
|
||||
showToast("APRS Service stopped.")
|
||||
locMan.removeUpdates(this);
|
||||
running = false
|
||||
sendBroadcast(new Intent(UPDATE).putExtra(STATUS, "service stopped."))
|
||||
showToast(getString(R.string.service_stop))
|
||||
}
|
||||
|
||||
// LocationListener interface
|
||||
|
|
Ładowanie…
Reference in New Issue