diff --git a/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt b/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt index 9e924f2..1315dd7 100644 --- a/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt +++ b/android/app/src/main/java/de/hft/geotracker/activities/MainActivity.kt @@ -115,18 +115,16 @@ class MainActivity : AppCompatActivity() { actionButton.setOnClickListener { callStartStop() } - my_toolbar.setNavigationOnClickListener { - altitude.text = "Pressed" - } + my_toolbar.setOnMenuItemClickListener { menuItem -> when (menuItem.itemId) { R.id.settings -> { - val intent = Intent(this, Settings::class.java) - startActivity(intent) + startActivity(Intent(this, Settings::class.java)) println("Settings pressed") true } R.id.logout -> { + startActivity(Intent(this, Login::class.java)) println("Logout pressed") true } @@ -136,7 +134,6 @@ class MainActivity : AppCompatActivity() { } private fun callStartStop() { - running = !running println("StartStop pressed: $running") //ToDO call /track Endpoint @@ -148,7 +145,7 @@ class MainActivity : AppCompatActivity() { override fun onResponse(call: Call, response: Response) { if (response.isSuccessful) { val firstname = response.body()?.firstname - lbl_username.text = firstname + lbl_username.text = "Hello " + firstname println("Body: " + firstname) } else { println("Response not successful: ${response.code()}") diff --git a/android/app/src/main/res/layout/activity_home.xml b/android/app/src/main/res/layout/activity_home.xml index 12a8837..c9bb8af 100644 --- a/android/app/src/main/res/layout/activity_home.xml +++ b/android/app/src/main/res/layout/activity_home.xml @@ -9,6 +9,7 @@ tools:context=".activities.MainActivity"> + - - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/appBarLayout" /> + +