kopia lustrzana https://github.com/ge0rg/aprsdroid
rodzic
611223b065
commit
e3db643820
|
@ -1,8 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.duenndns.aprsdroid"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
android:versionCode="2"
|
||||
android:versionName="0.1">
|
||||
|
||||
<uses-permission android:name="android.permission.LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
|
||||
<application android:label="@string/app_name">
|
||||
<activity android:name=".APRSdroid"
|
||||
android:label="@string/app_name">
|
||||
|
|
|
@ -192,6 +192,7 @@
|
|||
destdir="${out-classes}">
|
||||
<classpath>
|
||||
<pathelement location="${android-jar}"/>
|
||||
<pathelement location="${out-classes}"/>
|
||||
<fileset dir="tools" includes="*.jar"/>
|
||||
</classpath>
|
||||
</scalac>
|
||||
|
|
|
@ -7,10 +7,14 @@ android:orientation="vertical"
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/widget29"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10pt"
|
||||
android:text="APRSdroid early beta"
|
||||
android:textSize="12pt"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center"
|
||||
>
|
||||
</TextView>
|
||||
<TextView
|
||||
|
@ -27,4 +31,46 @@ android:layout_height="wrap_content"
|
|||
android:text="lon"
|
||||
>
|
||||
</TextView>
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10pt"
|
||||
android:text="status"
|
||||
>
|
||||
</TextView>
|
||||
<RelativeLayout
|
||||
android:id="@+id/buttonlayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/startbtn"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Start"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
android:id="@+id/singlebtn"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Single Shot"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
android:id="@+id/stopbtn"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Stop"
|
||||
android:layout_below="@+id/startbtn"
|
||||
android:layout_alignParentLeft="true"
|
||||
>
|
||||
</Button>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">APRSdroid</string>
|
||||
<string name="singlelog">Single Shot</string>
|
||||
<string name="startlog">Start Logging</string>
|
||||
<string name="app_name">APRSdroid</string>
|
||||
<string name="stoplog">Stop Logging</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,19 +1,61 @@
|
|||
package de.duenndns.aprsdroid
|
||||
|
||||
import _root_.android.app.Activity
|
||||
import _root_.android.content.Context
|
||||
import _root_.android.location._
|
||||
import _root_.android.os.Bundle
|
||||
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
|
||||
|
||||
class APRSdroid extends Activity with LocationListener with OnClickListener {
|
||||
val UPDATE_TIME = 10000 // 10k ms = 10s
|
||||
val UPDATE_DIST = 10 // 10m
|
||||
var locMan : LocationManager = null
|
||||
var lat : TextView = null
|
||||
var lon : TextView = null
|
||||
var status : TextView = null
|
||||
|
||||
val TAG = "APRSdroid"
|
||||
|
||||
class APRSdroid extends Activity {
|
||||
override def onCreate(savedInstanceState: Bundle) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.main)
|
||||
setContentView(R.layout.main)
|
||||
locMan = getSystemService(Context.LOCATION_SERVICE).asInstanceOf[LocationManager]
|
||||
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,
|
||||
UPDATE_TIME, UPDATE_DIST, this)
|
||||
|
||||
lat = findViewById(R.id.lat).asInstanceOf[TextView]
|
||||
lon = findViewById(R.id.lon).asInstanceOf[TextView]
|
||||
status = findViewById(R.id.status).asInstanceOf[TextView]
|
||||
findViewById(R.id.startbtn).asInstanceOf[Button].setOnClickListener(this);
|
||||
findViewById(R.id.stopbtn).asInstanceOf[Button].setOnClickListener(this);
|
||||
findViewById(R.id.singlebtn).asInstanceOf[Button].setOnClickListener(this);
|
||||
}
|
||||
override def $tag() : Int = {
|
||||
try {
|
||||
return super.$tag();
|
||||
} catch {
|
||||
case e: Exception => throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
override def onLocationChanged(location : Location) {
|
||||
Log.d(TAG, "onLocationChanged: " + location)
|
||||
lat.setText("lat: " + location.getLatitude)
|
||||
lon.setText("lon: " + location.getLongitude)
|
||||
}
|
||||
override def onProviderDisabled(provider : String) {
|
||||
Log.d(TAG, "onProviderDisabled: " + provider)
|
||||
status.setText(provider + " disabled")
|
||||
}
|
||||
override def onProviderEnabled(provider : String) {
|
||||
Log.d(TAG, "onProviderEnabled: " + provider)
|
||||
status.setText(provider + " enabled")
|
||||
}
|
||||
override def onStatusChanged(provider : String, st: Int, extras : Bundle) {
|
||||
Log.d(TAG, "onStatusChanged: " + provider)
|
||||
status.setText("status: " + provider + "/" + st);
|
||||
}
|
||||
override def onClick(view : View) {
|
||||
Log.d(TAG, "onClick: " + view + "/" + view.getId)
|
||||
status.setText(view.asInstanceOf[Button].getText)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue