1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.example.android.support.content.demos;
18
19import android.content.ContentProvider;
20import android.content.ContentValues;
21import android.database.Cursor;
22import android.database.MatrixCursor;
23import android.net.Uri;
24
25/**
26 * Provides test data for Content Pager Demo app.
27 */
28public class UnpagedDemoDataProvider extends ContentProvider {
29
30    public static final Uri URI =
31            Uri.parse("content://com.example.androidx.contentpager.content.demos/poodles");
32
33    static final int TOTAL_SIZE = 100;
34    private static final String[] COLUMNS = new String[] {
35            "id",
36            "name",
37            "time"
38    };
39
40    @Override
41    public boolean onCreate() {
42        return true;
43    }
44
45    @Override
46    public Cursor query(Uri uri, String[] projection, String selection,
47            String[] selectionArgs, String sortOrder) {
48        MatrixCursor cursor = new MatrixCursor(COLUMNS);
49        Object[] values = new Object[3];
50
51        for (int i = 0; i < TOTAL_SIZE; i++) {
52            values[0] = i;
53            values[1] = "I'm row number " + i;
54            values[2] = System.currentTimeMillis();
55            cursor.addRow(values);
56        }
57
58        return cursor;
59    }
60
61    @Override
62    public int delete(Uri uri, String selection, String[] selectionArgs) {
63        throw new UnsupportedOperationException("Not yet implemented");
64    }
65
66    @Override
67    public String getType(Uri uri) {
68        throw new UnsupportedOperationException("Not yet implemented");
69    }
70
71    @Override
72    public Uri insert(Uri uri, ContentValues values) {
73        throw new UnsupportedOperationException("Not yet implemented");
74    }
75
76    @Override
77    public int update(Uri uri, ContentValues values, String selection,
78            String[] selectionArgs) {
79        throw new UnsupportedOperationException("Not yet implemented");
80    }
81}
82