kopia lustrzana https://github.com/ge0rg/aprsdroid
				
				
				
			reformatting
							rodzic
							
								
									7e5b5679f3
								
							
						
					
					
						commit
						5582b2077b
					
				| 
						 | 
				
			
			@ -11,19 +11,20 @@ import _root_.android.widget.Button
 | 
			
		|||
import _root_.android.widget.TextView
 | 
			
		||||
 | 
			
		||||
class APRSdroid extends Activity with LocationListener with OnClickListener {
 | 
			
		||||
	val TAG = "APRSdroid"
 | 
			
		||||
 | 
			
		||||
	val UPDATE_TIME = 10000 // 10k ms = 10s
 | 
			
		||||
	val UPDATE_DIST = 10 // 10m
 | 
			
		||||
	var locMan : LocationManager = null
 | 
			
		||||
        lazy val lat : TextView = findViewById(R.id.lat).asInstanceOf[TextView]
 | 
			
		||||
        lazy val lon : TextView = findViewById(R.id.lon).asInstanceOf[TextView]
 | 
			
		||||
        lazy val status : TextView = findViewById(R.id.status).asInstanceOf[TextView]
 | 
			
		||||
 | 
			
		||||
	val TAG = "APRSdroid"
 | 
			
		||||
	lazy val locMan = getSystemService(Context.LOCATION_SERVICE).asInstanceOf[LocationManager]
 | 
			
		||||
	lazy val lat = findViewById(R.id.lat).asInstanceOf[TextView]
 | 
			
		||||
	lazy val lon = findViewById(R.id.lon).asInstanceOf[TextView]
 | 
			
		||||
	lazy val status = findViewById(R.id.status).asInstanceOf[TextView]
 | 
			
		||||
 | 
			
		||||
	override def onCreate(savedInstanceState: Bundle) {
 | 
			
		||||
		super.onCreate(savedInstanceState)
 | 
			
		||||
		setContentView(R.layout.main)
 | 
			
		||||
		locMan = getSystemService(Context.LOCATION_SERVICE).asInstanceOf[LocationManager]
 | 
			
		||||
 | 
			
		||||
		locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,
 | 
			
		||||
			UPDATE_TIME, UPDATE_DIST, this)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,6 +33,10 @@ class APRSdroid extends Activity with LocationListener with OnClickListener {
 | 
			
		|||
		findViewById(R.id.singlebtn).asInstanceOf[Button].setOnClickListener(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	override def onDestroy() {
 | 
			
		||||
		locMan.removeUpdates(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	override def onLocationChanged(location : Location) {
 | 
			
		||||
		Log.d(TAG, "onLocationChanged: " + location)
 | 
			
		||||
		lat.setText("lat: " + location.getLatitude)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue