13bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu/*
23bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * Copyright (C) 2017 The Android Open Source Project
33bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu *
43bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * Licensed under the Apache License, Version 2.0 (the "License");
53bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * you may not use this file except in compliance with the License.
63bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * You may obtain a copy of the License at
73bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu *
83bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu *      http://www.apache.org/licenses/LICENSE-2.0
93bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu *
103bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * Unless required by applicable law or agreed to in writing, software
113bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * distributed under the License is distributed on an "AS IS" BASIS,
123bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * See the License for the specific language governing permissions and
143bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu * limitations under the License.
153bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu */
163bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu
173bcad88cbf4488e747d84893c35f2351b8f84afeDake Gupackage android.support.v17.leanback.widget;
183bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu
193bcad88cbf4488e747d84893c35f2351b8f84afeDake Gupublic class PlaybackSeekProviderSample extends PlaybackSeekDataProvider {
203bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu
213bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    protected long[] mSeekPositions;
223bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu
233bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    public PlaybackSeekProviderSample(long duration, int numSeekPositions) {
243bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu        this(0, duration, numSeekPositions);
253bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    }
263bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu
273bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    public PlaybackSeekProviderSample(long first, long last, int numSeekPositions) {
283bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu        mSeekPositions = new long[numSeekPositions];
293bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu        for (int i = 0; i < mSeekPositions.length; i++) {
303bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu            mSeekPositions[i] = first + i * (last - first) / (numSeekPositions - 1);
313bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu        }
323bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    }
333bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu
343bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    @Override
353bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    public long[] getSeekPositions() {
363bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu        return mSeekPositions;
373bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu    }
383bcad88cbf4488e747d84893c35f2351b8f84afeDake Gu}
39