Browse Source

Documentation for HistoryModel

master
anthony restaino 8 years ago
parent
commit
916d9cc4ae
  1. 41
      app/src/main/java/acr/browser/lightning/database/history/HistoryModel.java

41
app/src/main/java/acr/browser/lightning/database/history/HistoryModel.java

@ -23,6 +23,11 @@ public final class HistoryModel { @@ -23,6 +23,11 @@ public final class HistoryModel {
private HistoryModel() {}
/**
* An observable that deletes browser history.
*
* @return a valid observable.
*/
@NonNull
public static Completable deleteHistory() {
return Completable.create(new CompletableAction() {
@ -37,6 +42,13 @@ public final class HistoryModel { @@ -37,6 +42,13 @@ public final class HistoryModel {
});
}
/**
* An observable that deletes the history
* entry with the specific URL.
*
* @param url the URL of the item to delete.
* @return a valid observable.
*/
@NonNull
public static Completable deleteHistoryItem(@NonNull final String url) {
return Completable.create(new CompletableAction() {
@ -51,6 +63,16 @@ public final class HistoryModel { @@ -51,6 +63,16 @@ public final class HistoryModel {
});
}
/**
* An observable that visits the URL by
* adding it to the database if it doesn't
* exist or updating the time visited if
* it does.
*
* @param url the URL of the item that was visited.
* @param title the title of the item that was visited.
* @return a valid observable.
*/
@NonNull
public static Completable visitHistoryItem(@NonNull final String url, @Nullable final String title) {
return Completable.create(new CompletableAction() {
@ -65,6 +87,18 @@ public final class HistoryModel { @@ -65,6 +87,18 @@ public final class HistoryModel {
});
}
/**
* An observable that finds all history items
* containing the given query. If the query
* is contained anywhere within the title or
* the URL of the history item, it will be
* returned. For the sake of performance, only
* the first five items will be emitted.
*
* @param query the query to search for.
* @return a valid observable that emits
* a list of history items.
*/
@NonNull
public static Single<List<HistoryItem>> findHistoryItemsContaining(@NonNull final String query) {
return Single.create(new SingleAction<List<HistoryItem>>() {
@ -79,6 +113,13 @@ public final class HistoryModel { @@ -79,6 +113,13 @@ public final class HistoryModel {
});
}
/**
* An observable that emits a list of the
* last 100 visited history items.
*
* @return a valid observable that emits
* a list of history items.
*/
@NonNull
public static Single<List<HistoryItem>> lastHundredVisitedHistoryItems() {
return Single.create(new SingleAction<List<HistoryItem>>() {

Loading…
Cancel
Save