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
data class StaffMember(val name: String, val position: String) | |
interface StaffLister { | |
fun findAllStaffMembers(): List<StaffMember> | |
} | |
class StaffListerImpl : StaffLister { | |
override fun findAllStaffMembers(): List<StaffMember> { | |
return listOf( | |
StaffMember( |
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
abstract class NetworkBoundResource<ResultType, RequestType> (private val appExecutors: AppExecutors) { | |
//LiveData that represents the resource, implemented in the base class | |
val result: MutableLiveData<Resource<ResultType>> = MutableLiveData() | |
//Called to get the cached data from the database | |
@WorkerThread | |
abstract fun loadFromDb(): ResultType? | |
//Called with the data in the database to determine when it was fetched | |
//from the network |
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
Text(text = "The Fellowship of the Ring", style = MaterialTheme.typography.h1, modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) |
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
Text(text = "The Two Towers", style = MaterialTheme.typography.h1, modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp)) |
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
@Composable | |
fun NetflixClone(movie: Movie){ | |
... | |
} |
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
ViewCompat.setAccessibilityDelegate( | |
fab, object : AccessibilityDelegateCompat() { | |
override fun onInitializeAccessibilityNodeInfo( | |
host: View, | |
info: AccessibilityNodeInfoCompat | |
) { | |
super.onInitializeAccessibilityNodeInfo(host, info) | |
info.addAction(AccessibilityActionCompat( | |
ACTION_CLICK, | |
"add new SparkCat”) |
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
findViewById<FloatingActionButton>(R.id.fab).setOnClickListener { | |
view -> | |
addNewFavourite() | |
view.announceForAccessibility("Added new favourite") | |
} |
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
<androidx.constraintlayout.widget.ConstraintLayout> | |
<ImageView | |
android:contentDescription="Eliza: Beautiful long-haired grey" | |
app:srcCompat="@drawable/eliza" /> | |
<ImageView | |
android:contentDescription="Alexander: Cute tortoiseshell" | |
app:srcCompat="@drawable/alexander" /> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
<com.google.android.material.floatingactionbutton.FloatingActionButton |
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
<androidx.constraintlayout.widget.ConstraintLayout> | |
<ImageView | |
android:contentDescription="Eliza: Beautiful long-haired grey" | |
app:srcCompat="@drawable/eliza" /> | |
<ImageView | |
android:contentDescription="Alexander: Cute tortoiseshell" | |
app:srcCompat="@drawable/alexander" /> | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
<com.google.android.material.floatingactionbutton.FloatingActionButton |
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
<TextView | |
android:id="@+id/name_label" | |
android:text="Name:" | |
android:labelFor="@id/cat_name" /> | |
<TextView | |
android:id="@+id/cat_name" | |
android:text="Eliza" /> |