<commit_before>package io.github.hidroh.materialistic.data;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.provider.BaseColumns;
import android.support.annotation.NonNull;
import android.text.TextUtils;

public class MaterialisticProvider extends ContentProvider {
    private static final String PROVIDER_AUTHORITY = "io.github.hidroh.materialistic.provider";
    private static final Uri BASE_URI = Uri.parse("content://" + PROVIDER_AUTHORITY);
    public static final Uri URI_FAVORITE = BASE_URI.buildUpon().appendPath(FavoriteEntry.TABLE_NAME).build();
    public static final Uri URI_VIEWED = BASE_URI.buildUpon().appendPath(ViewedEntry.TABLE_NAME).build();
    private DbHelper mDbHelper;

    @Override
    public boolean onCreate() {
        mDbHelper = new DbHelper(getContext());
        return true;
    }

    @Override
    public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        SQLiteDatabase db = mDbHelper.getReadableDatabase();
        if (URI_FAVORITE.equals(uri)) {
            return db.query(FavoriteEntry.TABLE_NAME, projection,
                    selection, selectionArgs,
                    null, null,
                    FavoriteEntry.COLUMN_NAME_ITEM_ID + DbHelper.ORDER_DESC);
        } else if (URI_VIEWED.equals(uri)) {
            return db.query(ViewedEntry.TABLE_NAME, projection,<commit_msg>Order saved items by time desc<commit_after>package io.github.hidroh.materialistic.data;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.provider.BaseColumns;
import android.support.annotation.NonNull;
import android.text.TextUtils;

public class MaterialisticProvider extends ContentProvider {
    private static final String PROVIDER_AUTHORITY = "io.github.hidroh.materialistic.provider";
    private static final Uri BASE_URI = Uri.parse("content://" + PROVIDER_AUTHORITY);
    public static final Uri URI_FAVORITE = BASE_URI.buildUpon().appendPath(FavoriteEntry.TABLE_NAME).build();
    public static final Uri URI_VIEWED = BASE_URI.buildUpon().appendPath(ViewedEntry.TABLE_NAME).build();
    private DbHelper mDbHelper;

    @Override
    public boolean onCreate() {
        mDbHelper = new DbHelper(getContext());
        return true;
    }

    @Override
    public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        SQLiteDatabase db = mDbHelper.getReadableDatabase();
        if (URI_FAVORITE.equals(uri)) {
            return db.query(FavoriteEntry.TABLE_NAME, projection,
                    selection, selectionArgs,
                    null, null,
                    FavoriteEntry.COLUMN_NAME_TIME + DbHelper.ORDER_DESC);
        } else if (URI_VIEWED.equals(uri)) {
            return db.query(ViewedEntry.TABLE_NAME, projection,
{'fraction_non_alphanumeric': 0.09020310633213859, 'fraction_numerical': 0.0, 'mean_word_length': 3.9541420118343193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5631830', 'n_tokens_mistral': 934, 'n_tokens_neox': 913, 'n_words': 204}