Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
283 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
app/src/main/java/net/measurementlab/ndt7/android/MainActivity.java
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
app/src/main/java/net/measurementlab/ndt7/android/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package net.measurementlab.ndt7.android | ||
|
||
import android.os.Handler | ||
import android.os.Looper | ||
import android.support.v7.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.util.Log | ||
import android.widget.Toast | ||
|
||
private const val TAG = "MainActivity" | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
val settings = Settings() | ||
settings.hostname = "35.235.104.27" | ||
settings.port = 443 | ||
settings.skipTlsCertificateVerification = true | ||
val client = MyClient(settings) | ||
|
||
if (!client.runDownload()) { | ||
Toast.makeText(this, "runDownload failed", Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
|
||
private inner class MyClient constructor(settings: Settings) : Client(settings) { | ||
|
||
override fun onLogInfo(message: String?) { | ||
Log.i(TAG, "onLogInfo: $message") | ||
} | ||
|
||
override fun onError(error: String?) { | ||
Log.e(TAG, "onError: $error") | ||
|
||
Handler(Looper.getMainLooper()).post { Toast.makeText(this@MainActivity, error, Toast.LENGTH_SHORT).show() } | ||
} | ||
|
||
override fun onServerDownloadMeasurement(measurement: Measurement) { | ||
Log.d(TAG, "server measurement: $measurement") | ||
} | ||
|
||
override fun onClientDownloadMeasurement(measurement: Measurement) { | ||
Log.d(TAG, "client measurement: $measurement") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.