Commit c6dee54b authored by Wilko Manger's avatar Wilko Manger

Merge branch 'master' into 'master'

Implement back button in the toolbar of the ChatFragment

See merge request !6
parents 93fcef99 689e7141
Pipeline #258 passed with stage
in 2 minutes and 52 seconds
......@@ -25,6 +25,9 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.appcompat.app.ActionBar
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import im.pattle.app.R
import im.pattle.app.data.chat.event.model.ChatMessage
......@@ -126,4 +129,22 @@ class ChatFragment : BaseFragment<ChatViewModel>() {
activity?.window?.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val activity = this.activity as AppCompatActivity
activity.setSupportActionBar(toolbar)
val actionBar: ActionBar = activity.supportActionBar
?: throw NullPointerException("Actionbar is null.")
actionBar.setDisplayHomeAsUpEnabled(true)
actionBar.setDisplayShowHomeEnabled(true)
toolbar.setNavigationOnClickListener {
findNavController().navigateUp()
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment