mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-06-28 16:13:20 +00:00
![Cyril Müller](/assets/img/avatar_default.png)
Add search and watch history * Make MainActicity a single task * Remove some casting * SearchFragment: start searching when created with query * Handle settings change in onResume * History: Log pop up and background playback * History: Add swipe to remove functionallity * Enable history by default * Use stream item * Store more information about the stream * Integrate history database into AppDatabase * Remove redundant casts * Re-enable date converters * History: Use Rx Java and run DB in background * Also make HistoryDAO extend BasicDAO * History: RX-ify swipe to remove * Sort history entries by creation date * History: Set toolbar title * Don't repeat history entries * Introduced setters so we can update entries in the database * If the latest entry has the same (main) values, just update it
50 lines
1.2 KiB
Java
50 lines
1.2 KiB
Java
package org.schabi.newpipe.database;
|
|
|
|
import android.arch.persistence.room.Dao;
|
|
import android.arch.persistence.room.Delete;
|
|
import android.arch.persistence.room.Insert;
|
|
import android.arch.persistence.room.OnConflictStrategy;
|
|
import android.arch.persistence.room.Update;
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
import io.reactivex.Flowable;
|
|
|
|
@Dao
|
|
public interface BasicDAO<Entity> {
|
|
/* Inserts */
|
|
@Insert(onConflict = OnConflictStrategy.FAIL)
|
|
long insert(final Entity entity);
|
|
|
|
@Insert(onConflict = OnConflictStrategy.FAIL)
|
|
List<Long> insertAll(final Entity... entities);
|
|
|
|
@Insert(onConflict = OnConflictStrategy.FAIL)
|
|
List<Long> insertAll(final Collection<Entity> entities);
|
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
long upsert(final Entity entity);
|
|
|
|
/* Searches */
|
|
Flowable<List<Entity>> findAll();
|
|
|
|
Flowable<List<Entity>> listByService(int serviceId);
|
|
|
|
/* Deletes */
|
|
@Delete
|
|
int delete(final Entity entity);
|
|
|
|
@Delete
|
|
int delete(final Collection<Entity> entities);
|
|
|
|
int deleteAll();
|
|
|
|
/* Updates */
|
|
@Update
|
|
int update(final Entity entity);
|
|
|
|
@Update
|
|
int update(final Collection<Entity> entities);
|
|
}
|