Merge branch '51-logout-implementation' into 'master'

Resolve "Logout implementation"

Closes #51

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!72
This commit is contained in:
Tobias Wieck 2020-05-26 09:19:17 +00:00
commit 5cd2defd3d
3 changed files with 20 additions and 25 deletions

View File

@ -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<ValuesUser>, response: Response<ValuesUser>) {
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()}")

View File

@ -9,6 +9,7 @@
tools:context=".activities.MainActivity">
<!-- TODO: Update blank fragment layout -->
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
@ -29,29 +30,27 @@
</com.google.android.material.appbar.AppBarLayout>
<TextView
android:id="@+id/hello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin16"
android:layout_marginTop="@dimen/margin16"
android:text="@string/hello"
android:textAppearance="@style/text_style"
android:textSize="24sp"
app:layout_constraintBottom_toTopOf="@+id/selected_acc"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/lbl_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginStart="@dimen/margin16"
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/margin16"
android:textAlignment="center"
android:textAppearance="@style/text_style"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="@+id/hello"
app:layout_constraintStart_toEndOf="@+id/hello" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout" />
<View
android:id="@+id/divider2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="@color/colorAccent"
app:layout_constraintTop_toBottomOf="@+id/lbl_username" />
<TextView
android:id="@+id/selected_acc"

View File

@ -19,7 +19,6 @@
style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:menu="@menu/menu"
app:navigationIcon="@drawable/abc_vector_test"
app:title="@string/app_name" />