Skip to content

Instantly share code, notes, and snippets.

View manuelernesto's full-sized avatar
🟣

Manuel Ernesto manuelernesto

🟣
View GitHub Profile
Text(modifier = Modifier.tag("TxtColor"),text = "Color")
val txtColor = tag("TxtColor").apply {
top constrainTo parent.top
left constrainTo parent.left
right constrainTo parent.right
bottom constrainTo parent.bottom
}
ConstraintLayout(
constraintSet = ConstraintSet {
// We will add the constraints here.
}) {
// We will declare our composable components here.
// And they will be constrained by the constraints created in the ConstraintSet.
}
arguments?.let {
mPalestrante = SpeakersFragmentArgs.fromBundle(it).palestrante
room_et_nome.setText(mPalestrante?.palestrante)
room_et_tecnologia.setText(mPalestrante?.tecnologia)
room_et_topico.setText(mPalestrante?.topico)
}
@Dao
interface DAO {
@Insert
suspend fun salvar(user: Utilizador)
@Query("SELECT * FROM db.user")
suspend fun buscarTodos(): List<Utilizador>
@Update
suspend fun actualizar(user: Utilizador)
@Entity(tableName = "db.palestrante")
data class Palestrante(
@PrimaryKey(autoGenerate = true)
var id: Int,
@ColumnInfo(name = "nome_palestrante")
val nome: String
)
@Database(entities = [Palestrante::class], version = 1)
abstract class PalestranteDB: RoomDatabase() {
abstract fun dao(): PalestranteDA
}
apply plugin: "androidx.navigation.safeargs"
buildscript {
ext.kotlin_version = "1.4.0"
repositories {
google()
jcenter()
}
dependencies {
...
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"
}
if (mPalestrante != null) {
room_btn_apagar.visibility = View.VISIBLE
room_btn_apagar.setOnClickListener {
apagarPalestrante()
}
}