package com.viaccessorca.voplayerdemo.utils;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.webkit.WebView;


/**
 * WebView extension used to render subtitle for QuickPlayer app
 * It prevents scrolling, does not capture touch events and allows JavaScript execution
 */
public class VORenderingWebView extends WebView {

    public VORenderingWebView(Context context) {
        super(context);
    }

    public VORenderingWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public VORenderingWebView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY,
                                int scrollRangeX, int scrollRangeY, int maxOverScrollX,
                                int maxOverScrollY, boolean isTouchEvent) {
        return false;
    }

    @Override
    public void scrollTo(int x, int y) {
        // Do nothing
    }

    @Override
    public void computeScroll() {
        // Do nothing
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return false;
    }

}
