Search in sources :

Example 6 with DatabaseHelper

use of com.odysee.app.data.DatabaseHelper in project odysee-android by OdyseeTeam.

the class Helper method saveViewHistory.

public static void saveViewHistory(String url, Claim claim) {
    DatabaseHelper dbHelper = DatabaseHelper.getInstance();
    if (dbHelper != null) {
        ViewHistory viewHistory = ViewHistory.fromClaimWithUrlAndDeviceName(claim, url, getDeviceName());
        new SaveViewHistoryTask(viewHistory, dbHelper, null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }
}
Also used : SaveViewHistoryTask(com.odysee.app.tasks.localdata.SaveViewHistoryTask) DatabaseHelper(com.odysee.app.data.DatabaseHelper) ViewHistory(com.odysee.app.model.ViewHistory)

Example 7 with DatabaseHelper

use of com.odysee.app.data.DatabaseHelper in project odysee-android by OdyseeTeam.

the class LibraryFragment method loadRecent.

private void loadRecent() {
    contentListLoading = true;
    Helper.setViewVisibility(layoutListEmpty, View.GONE);
    DatabaseHelper dbHelper = DatabaseHelper.getInstance();
    if (dbHelper != null) {
        FetchViewHistoryTask task = new FetchViewHistoryTask(lastDate, PAGE_SIZE, dbHelper, new FetchViewHistoryTask.FetchViewHistoryHandler() {

            @Override
            public void onSuccess(List<ViewHistory> history, boolean hasReachedEnd) {
                listReachedEnd = hasReachedEnd;
                if (history.size() > 0) {
                    lastDate = history.get(history.size() - 1).getTimestamp();
                }
                List<Claim> claims = Helper.claimsFromViewHistory(history);
                if (contentListAdapter == null) {
                    initRecentAdapter(claims);
                }
                if (contentListAdapter != null && recentList.getAdapter() == null) {
                    recentList.setAdapter(contentListAdapter);
                }
                checkListEmpty();
                contentListLoading = false;
            }
        });
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {
        checkListEmpty();
        contentListLoading = false;
    }
}
Also used : FetchViewHistoryTask(com.odysee.app.tasks.localdata.FetchViewHistoryTask) DatabaseHelper(com.odysee.app.data.DatabaseHelper) ViewHistory(com.odysee.app.model.ViewHistory) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

DatabaseHelper (com.odysee.app.data.DatabaseHelper)7 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)4 PendingIntent (android.app.PendingIntent)2 Intent (android.content.Intent)2 ViewHistory (com.odysee.app.model.ViewHistory)2 LbryNotification (com.odysee.app.model.lbryinc.LbryNotification)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 SuppressLint (android.annotation.SuppressLint)1 NotificationChannel (android.app.NotificationChannel)1 NotificationManager (android.app.NotificationManager)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 SharedPreferences (android.content.SharedPreferences)1 SQLiteException (android.database.sqlite.SQLiteException)1 Bundle (android.os.Bundle)1 Editable (android.text.Editable)1 SpannableString (android.text.SpannableString)1 TextWatcher (android.text.TextWatcher)1 KeyEvent (android.view.KeyEvent)1