-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new feed and subscriptions groups
- Introduce Groupie for easier lists implementations - Show the proper view count string ('watching' for live streams) - Introduce PrettyTime for time formatting - Use some of the new components of the Android Architecture - Add a bunch of icons for groups, using vectors, which still is compatible with older APIs through the compatibility layer
- Loading branch information
1 parent
056fed3
commit 2c88500
Showing
195 changed files
with
4,211 additions
and
1,432 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
72 changes: 0 additions & 72 deletions
72
app/src/main/java/org/schabi/newpipe/database/subscription/SubscriptionDAO.java
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
app/src/main/java/org/schabi/newpipe/database/subscription/SubscriptionDAO.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.schabi.newpipe.database.subscription | ||
|
||
import androidx.room.* | ||
import io.reactivex.Flowable | ||
import io.reactivex.Maybe | ||
import org.schabi.newpipe.database.BasicDAO | ||
|
||
@Dao | ||
abstract class SubscriptionDAO : BasicDAO<SubscriptionEntity> { | ||
@Query("SELECT COUNT(*) FROM subscriptions") | ||
abstract fun rowCount(): Flowable<Long> | ||
|
||
@Query("SELECT * FROM subscriptions WHERE service_id = :serviceId") | ||
abstract override fun listByService(serviceId: Int): Flowable<List<SubscriptionEntity>> | ||
|
||
@Query("SELECT * FROM subscriptions ORDER BY name COLLATE NOCASE ASC") | ||
abstract override fun getAll(): Flowable<List<SubscriptionEntity>> | ||
|
||
@Query("SELECT * FROM subscriptions WHERE url LIKE :url AND service_id = :serviceId") | ||
abstract fun getSubscriptionFlowable(serviceId: Int, url: String): Flowable<List<SubscriptionEntity>> | ||
|
||
@Query("SELECT * FROM subscriptions WHERE url LIKE :url AND service_id = :serviceId") | ||
abstract fun getSubscription(serviceId: Int, url: String): Maybe<SubscriptionEntity> | ||
|
||
@Query("DELETE FROM subscriptions") | ||
abstract override fun deleteAll(): Int | ||
|
||
@Query("DELETE FROM subscriptions WHERE url LIKE :url AND service_id = :serviceId") | ||
abstract fun deleteSubscription(serviceId: Int, url: String): Int | ||
|
||
@Query("SELECT uid FROM subscriptions WHERE url LIKE :url AND service_id = :serviceId") | ||
internal abstract fun getSubscriptionIdInternal(serviceId: Int, url: String): Long? | ||
|
||
@Insert(onConflict = OnConflictStrategy.IGNORE) | ||
internal abstract fun silentInsertAllInternal(entities: List<SubscriptionEntity>): List<Long> | ||
|
||
@Transaction | ||
open fun upsertAll(entities: List<SubscriptionEntity>): List<SubscriptionEntity> { | ||
val insertUidList = silentInsertAllInternal(entities) | ||
|
||
val entityIds = ArrayList<Long>(entities.size) | ||
for ((index, uid) in insertUidList.withIndex()) { | ||
val newerEntity = entities[index] | ||
if (uid != -1L) { | ||
entityIds.add(uid) | ||
newerEntity.uid = uid | ||
continue | ||
} | ||
|
||
entityIds.add(newerEntity.uid) | ||
} | ||
|
||
update(entities) | ||
return entities | ||
} | ||
} |
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
Oops, something went wrong.