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
override suspend fun getVideos(): List<Video> = withContext(ioDispatcher) { | |
val videos = mutableListOf<Video>() | |
val uri: Uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI | |
// Display videos in alphabetical order based on their display name. | |
val sortOrder = "${MediaStore.Video.Media.DISPLAY_NAME} ASC" | |
val cursor: Cursor? = contentResolver.query(uri, null, null, null, sortOrder) |
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
package com.unravelled.sm.viewmodel | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.ViewModelProvider | |
import com.unravelled.sm.data.model.item.ItemDao | |
class ItemListViewModelFactory( | |
private val dataSource: ItemDao | |
) : ViewModelProvider.Factory { | |
@Suppress("unchecked_cast") |
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
package com.unravelled.sm.viewmodel | |
import androidx.lifecycle.* | |
import com.unravelled.sm.data.model.item.ItemDao | |
import com.unravelled.sm.data.model.item.ItemRepository | |
import com.unravelled.sm.domain.model.Item | |
class ItemListViewModel( | |
dataSource: ItemDao) :ViewModel() { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<com.google.android.material.appbar.AppBarLayout | |
android:layout_width="match_parent" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.drawerlayout.widget.DrawerLayout 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/drawer_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
tools:openDrawer="start"> | |
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
package com.unravelled.sm | |
import android.content.Intent | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import androidx.navigation.findNavController | |
import androidx.navigation.ui.AppBarConfiguration | |
import androidx.navigation.ui.navigateUp | |
import androidx.navigation.ui.setupActionBarWithNavController | |
import androidx.navigation.ui.setupWithNavController |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
tools:context="com.unravelled.sm.MainActivity" | |
tools:showIn="@layout/activity_main"> |
NewerOlder