Xmls:

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">
 
    <EditText
        android:id="@+id/editEmail" />
 
    <EditText
        android:id="@+id/editPassword"/>
 
    <Button
        android:id="@+id/buttonEntrar"/>
</LinearLayout>
.kts

MainActivity
 
class MainActivity : AppCompatActivity() {
 
    private val binding by lazy { ActivityMainBinding.inflate(layoutInflater) }
    private val viewModel by lazy { ViewModelProvider(this)[MainViewModel::class.java] }
    private val adapter = UserAdapter()
    private var id = -1
 
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(binding.root)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
 
        binding.recyclerUsers.layoutManager = LinearLayoutManager(applicationContext)
        binding.recyclerUsers.adapter = adapter
 
        val listener = object : UserAdapter.OnUserListener {
            override fun OnClick(id: Int) {
                Toast.makeText(applicationContext, "Clicado ${id.toString()}", Toast.LENGTH_SHORT)
                    .show()
                viewModel.get(id)
            }
        }
        adapter.attachListener(listener)
 
        observe()
        loadData()
 
        binding.buttonInsert.setOnClickListener {
            val username = binding.editUsername.text.toString()
            val password = binding.editPassword.text.toString()
 
            viewModel.insert(username, password)
        }
        binding.buttonUpdate.setOnClickListener {
            val username = binding.editUsername.text.toString()
            val password = binding.editPassword.text.toString()
 
            viewModel.update(id, username, password)
        }
        binding.buttonDelete.setOnClickListener {
            viewModel.delete(id)
        }
    }
 
    private fun observe() {
        viewModel.users.observe(this) {
            adapter.updateUsers(it)
        }
        viewModel.user.observe(this) {
            id = it.id
            binding.textID.text = "ID: ${it.id}"
            binding.editUsername.setText(it.username)
            binding.editPassword.setText(it.password)
        }
        viewModel.newChange.observe(this) {
            loadData()
        }
    }
 
    private fun loadData() {
        viewModel.getAll()
    }
}
UserAdapter
 
class UserAdapter : RecyclerView.Adapter<UserAdapter.UserViewHolder>() {
 
    private var userList: List<UserModel> = listOf()
    private lateinit var listener: OnUserListener
 
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UserViewHolder {
        val item = RowUserBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        return UserViewHolder(item, listener)
    }
 
    override fun getItemCount(): Int {
        return userList.size
    }
 
    override fun onBindViewHolder(holder: UserViewHolder, position: Int) {
        holder.bind(userList[position])
    }
 
    fun updateUsers(list: List<UserModel>) {
        userList = list
        notifyDataSetChanged()
    }
 
    fun attachListener(userListener: OnUserListener) {
        listener = userListener
    }
 
    interface OnUserListener {
        fun OnClick(id: Int)
    }
 
    class UserViewHolder(private val bind: RowUserBinding, private val listener: OnUserListener) :
        RecyclerView.ViewHolder(bind.root) {
 
        fun bind(user: UserModel) {
            bind.textUsername.text = user.username
 
            bind.textUsername.setOnClickListener {
                listener.OnClick(user.id)
            }
        }
    }
}
UserDAO
 
@Dao
interface UserDAO {
 
    @Insert
    fun insert(user: UserModel): Long
 
    @Update
    fun update(user: UserModel): Int
 
    @Delete
    fun delete(user: UserModel): Int
 
    @Query("SELECT * FROM User WHERE id = :id")
    fun get(id: Int): UserModel
 
    @Query("SELECT * FROM User")
    fun getAll(): List<UserModel>
}
MainViewModel
class MainViewModel(application: Application) : AndroidViewModel(application) {
 
    private val repository = UserRepository(application.applicationContext)
 
    private val listUsers = MutableLiveData<List<UserModel>>()
    val users: LiveData<List<UserModel>> = listUsers
 
    private val userModel = MutableLiveData<UserModel>()
    val user: LiveData<UserModel> = userModel
 
    private val changes = MutableLiveData<Long>()
    val newChange: LiveData<Long> = changes
 
    fun getAll() {
        listUsers.value = repository.getAll()
    }
 
    fun get(id: Int) {
        userModel.value = repository.get(id)
    }
 
    fun insert(username: String, password: String) {
        val model = UserModel().apply {
            this.username = username
            this.password = password
        }
        changes.value = repository.insert(model)
    }
 
    fun update(id: Int, username: String, password: String) {
        val model = UserModel().apply {
            this.id = id
            this.username = username
            this.password = password
        }
        changes.value = repository.update(model).toLong()
    }
 
    fun delete(id: Int) {
        val model = UserModel().apply {
            this.id = id
        }
        changes.value = repository.delete(model).toLong()
    }
 
}
UserDatabase 
@Database(entities = [UserModel::class], version = 1)
abstract class UserDatabase : RoomDatabase() {
 
    abstract fun userDAO(): UserDAO
 
    companion object {
        private lateinit var INSTANCE: UserDatabase
 
        fun getDatabase(context: Context): UserDatabase {
            if (!::INSTANCE.isInitialized) {
                synchronized(UserDatabase::class.java) {
                    INSTANCE = Room.databaseBuilder(context, UserDatabase::class.java, "userDB")
                        //.addMigrations(MIGRATION_1_2)
                        .allowMainThreadQueries()
                        .build()
                }
            }
            return INSTANCE
        }
 
        private val MIGRATION_1_2: Migration = object :Migration(1,2) {
            override fun migrate(db: SupportSQLiteDatabase) {
                //IMPLEMENTAR
            }
        }
    }
}
UserModel.kt
@Entity(tableName = "User")
class UserModel {
 
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id")
    var id: Int = 0
 
    @ColumnInfo(name = "username")
    var username: String = ""
 
    @ColumnInfo(name = "password")
    var password: String = ""
 
}
UserRepository
 
class UserRepository(context: Context) {
    private val userDatabase = UserDatabase.getDatabase(context).userDAO()
 
    fun insert(user: UserModel): Long {
        return userDatabase.insert(user)
    }
 
    fun update(user: UserModel): Int {
        return userDatabase.update(user)
    }
 
    fun delete(user: UserModel): Int {
        return userDatabase.delete(user)
    }
 
    fun get(id: Int): UserModel {
        return userDatabase.get(id)
    }
 
    fun getAll(): List<UserModel> {
        return userDatabase.getAll()
    }
}

Em cima estão os ficheiros xmls e kt da app em kotin A. Studio, faz-me um algoritmo, organiza por cabeçalhos de cada ficheiro, esquece os imports, no xml mostra só o nome dos componentes