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 androidx.paging
18
19class StringPagedList constructor(leadingNulls: Int, trailingNulls: Int, vararg items: String)
20        : PagedList<String>(PagedStorage<String>(), TestExecutor(), TestExecutor(), null,
21                PagedList.Config.Builder().setPageSize(1).build()), PagedStorage.Callback {
22    init {
23        @Suppress("UNCHECKED_CAST")
24        val keyedStorage = mStorage as PagedStorage<String>
25        keyedStorage.init(leadingNulls,
26                items.toList(),
27                trailingNulls,
28                0,
29                this)
30    }
31
32    internal override fun isContiguous(): Boolean {
33        return true
34    }
35
36    override fun getLastKey(): Any? {
37        return null
38    }
39
40    override fun dispatchUpdatesSinceSnapshot(storageSnapshot: PagedList<String>,
41            callback: PagedList.Callback) {
42    }
43
44    override fun loadAroundInternal(index: Int) {}
45
46    override fun onInitialized(count: Int) {}
47
48    override fun onPagePrepended(leadingNulls: Int, changed: Int, added: Int) {}
49
50    override fun onPageAppended(endPosition: Int, changed: Int, added: Int) {}
51
52    override fun onPagePlaceholderInserted(pageIndex: Int) {}
53
54    override fun onPageInserted(start: Int, count: Int) {}
55
56    override fun getDataSource(): DataSource<*, String> {
57        throw UnsupportedOperationException()
58    }
59}
60