57 lines
1.7 KiB
Java
57 lines
1.7 KiB
Java
|
/*
|
||
|
* Copyright 2014 Soichiro Kashima
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
package com.github.ksoichiro.android.observablescrollview;
|
||
|
|
||
|
import android.view.ViewGroup;
|
||
|
|
||
|
/**
|
||
|
* Provides common API for observable and scrollable widgets.
|
||
|
*/
|
||
|
public interface Scrollable {
|
||
|
/**
|
||
|
* Sets a callback listener.
|
||
|
*
|
||
|
* @param listener listener to set
|
||
|
*/
|
||
|
void setScrollViewCallbacks(ObservableScrollViewCallbacks listener);
|
||
|
|
||
|
/**
|
||
|
* Scrolls vertically to the absolute Y.
|
||
|
* Implemented classes are expected to scroll to the exact Y pixels from the top,
|
||
|
* but it depends on the type of the widget.
|
||
|
*
|
||
|
* @param y vertical position to scroll to
|
||
|
*/
|
||
|
void scrollVerticallyTo(int y);
|
||
|
|
||
|
/**
|
||
|
* Returns the current Y of the scrollable view.
|
||
|
*
|
||
|
* @return current Y pixel
|
||
|
*/
|
||
|
int getCurrentScrollY();
|
||
|
|
||
|
/**
|
||
|
* Sets a touch motion event delegation ViewGroup.
|
||
|
* This is used to pass motion events back to parent view.
|
||
|
* It's up to the implementation classes whether or not it works.
|
||
|
*
|
||
|
* @param viewGroup ViewGroup object to dispatch motion events
|
||
|
*/
|
||
|
void setTouchInterceptionViewGroup(ViewGroup viewGroup);
|
||
|
}
|