This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Show here your progress | |
SuperDigital.Builder(this) | |
.operation(OperationAuth("sds", "dsd", "1234")) | |
.enqueue(object : SuperdigitalCallback<ResponseDefault> { | |
override fun onSuccess(response: ResponseDefault) { | |
//Hide your progress | |
} | |
override fun onFailure(error: Error) { | |
//Hide your progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
//Show here your progress | |
SuperDigital.Builder(this) | |
.operation(OperationAuth("sds", "dsd", "1234")) | |
.enqueue(object : SuperdigitalCallback<ResponseDefault> { | |
... | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
SuperDigital.Builder(this) | |
.operation(...) | |
.enqueue(...) | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
setSupportActionBar(toolbar) | |
var db : AppDatabase = AppDatabase.getDatabaseBuilder(applicationContext) | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao | |
interface TeamDao{ | |
@Query("SELECT * FROM Team ORDER BY id ASC") | |
fun getAllTeams() : List<Team> | |
@Query("SELECT * FROM Team WHERE Team.id = :myId") | |
fun getTeam(myId: Long) : Team | |
@Insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity(tableName = "team") | |
class Team( | |
@PrimaryKey(autoGenerate = true) var id : Long?, | |
@ColumnInfo(name = "name") var name : String, | |
@ColumnInfo(name = "since") var since : String){ | |
constructor() : this(null, "", "") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Database(entities = arrayOf(Team::class, Player::class), version = 1) | |
abstract class AppDatabase : RoomDatabase() { | |
abstract fun teamDao() : TeamDao | |
abstract fun playerDao() : PlayerDao | |
companion object { | |
var INSTANCE : AppDatabase? = null | |
fun getDatabaseBuilder(context: Context) : AppDatabase{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Database(entities = arrayOf(Team::class, Player::class), version = 1) | |
abstract class AppDatabase : RoomDatabase() { | |
abstract fun teamDao() : TeamDao | |
abstract fun playerDao() : PlayerDao | |
companion object { | |
var MY_INSTANCE : AppDatabase? = null | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
collapsing_toolbar_layout.title = "Ronaldo Fenômeno" | |
collapsing_toolbar_layout.setExpandedTitleColor(resources.getColor(android.R.color.transparent)) | |
//Listener para escutar mudanças de estado da AppBarLayout | |
app_bar.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener{ | |
override fun onOffsetChanged(appBarLayout: AppBarLayout?, verticalOffset: Int) { | |
if (verticalOffset == 0) | |
tv_title_article.visibility = View.VISIBLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CollapseActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_collapse) | |
setSupportActionBar(toolbar) | |
//Seta o título na actionbar e depois muda a cor para transparente quando o AppBar estiver expandido | |
collapsing_toolbar_layout.title = "Ronaldo Fenômeno" | |
collapsing_toolbar_layout.setExpandedTitleColor(resources.getColor(android.R.color.transparent)) |
NewerOlder