mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
bug fixes
This commit is contained in:
parent
1268dce7bd
commit
17626419a2
@ -4,6 +4,7 @@ plugins {
|
||||
id 'com.android.application'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
}
|
||||
|
||||
android {
|
||||
@ -74,6 +75,8 @@ android {
|
||||
dependencies {
|
||||
//debugImplementation libs.square.leakcanary
|
||||
|
||||
kapt "androidx.room:room-compiler:2.4.3"
|
||||
|
||||
implementation libs.androidx.appcompat
|
||||
implementation libs.androidx.constraintlayout
|
||||
implementation libs.androidx.legacySupport
|
||||
|
@ -16,6 +16,8 @@ object DatabaseHelper {
|
||||
streams.thumbnailUrl,
|
||||
streams.duration
|
||||
)
|
||||
DatabaseHolder.database.watchHistoryDao().insertAll(watchHistoryItem)
|
||||
Thread {
|
||||
DatabaseHolder.database.watchHistoryDao().insertAll(watchHistoryItem)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ import com.github.libretube.adapters.WatchHistoryAdapter
|
||||
import com.github.libretube.database.DatabaseHolder
|
||||
import com.github.libretube.databinding.FragmentWatchHistoryBinding
|
||||
import com.github.libretube.extensions.BaseFragment
|
||||
import com.github.libretube.obj.WatchHistoryItem
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
class WatchHistoryFragment : BaseFragment() {
|
||||
private val TAG = "WatchHistoryFragment"
|
||||
@ -28,7 +30,13 @@ class WatchHistoryFragment : BaseFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val watchHistory = DatabaseHolder.database.watchHistoryDao().getAll()
|
||||
var watchHistory = listOf<WatchHistoryItem>()
|
||||
|
||||
val thread = Thread {
|
||||
watchHistory = DatabaseHolder.database.watchHistoryDao().getAll()
|
||||
}
|
||||
thread.start()
|
||||
thread.join()
|
||||
|
||||
if (watchHistory.isEmpty()) return
|
||||
|
||||
|
@ -6,7 +6,7 @@ import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "watchHistoryItem")
|
||||
data class WatchHistoryItem(
|
||||
@PrimaryKey val videoId: String? = null,
|
||||
@PrimaryKey val videoId: String = "",
|
||||
@ColumnInfo val title: String? = null,
|
||||
@ColumnInfo val uploadDate: String? = null,
|
||||
@ColumnInfo val uploader: String? = null,
|
||||
|
Loading…
Reference in New Issue
Block a user