Skip to content

Commit

Permalink
settings: smoother initialization (fixes #2031) (#2040)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <dogi@users.noreply.github.com>
Okuro3499 and dogi authored Jun 7, 2024
1 parent d9f2712 commit 745f082
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -16,13 +16,15 @@ import io.treehouses.remote.utils.DialogUtils

open class BaseFragment : Fragment() {
var lastMessage = " "
open lateinit var mChatService: BluetoothChatService
lateinit var mChatService: BluetoothChatService
var mBluetoothAdapter: BluetoothAdapter? = null
lateinit var listener: HomeInteractListener
override fun onAttach(context: Context) {
super.onAttach(context)
listener = if (context is HomeInteractListener) context else throw RuntimeException("Implement interface first")
mChatService = listener.getChatService()
if (this::mChatService.isInitialized) {
mChatService = listener.getChatService()
}
mBluetoothAdapter = (context.getSystemService(Context.BLUETOOTH_SERVICE) as? BluetoothManager)?.adapter
}

0 comments on commit 745f082

Please sign in to comment.