Search in sources :

Example 6 with ZoomButtonsController

use of android.widget.ZoomButtonsController in project chromeview by pwnall.

the class AwZoomControls method updateZoomControls.

@Override
public void updateZoomControls() {
    ZoomButtonsController zoomController = getZoomController();
    if (zoomController == null) {
        return;
    }
    boolean canZoomIn = mAwContents.canZoomIn();
    boolean canZoomOut = mAwContents.canZoomOut();
    if (!canZoomIn && !canZoomOut) {
        // Hide the zoom in and out buttons if the page cannot zoom
        zoomController.getZoomControls().setVisibility(View.GONE);
    } else {
        // Set each one individually, as a page may be able to zoom in or out
        zoomController.setZoomInEnabled(canZoomIn);
        zoomController.setZoomOutEnabled(canZoomOut);
    }
}
Also used : ZoomButtonsController(android.widget.ZoomButtonsController)

Example 7 with ZoomButtonsController

use of android.widget.ZoomButtonsController in project chromeview by pwnall.

the class AwZoomControls method getZoomController.

private ZoomButtonsController getZoomController() {
    if (mZoomButtonsController == null && mAwContents.getSettings().shouldDisplayZoomControls()) {
        mZoomButtonsController = new ZoomButtonsController(mAwContents.getContentViewCore().getContainerView());
        mZoomButtonsController.setOnZoomListener(new ZoomListener());
        // ZoomButtonsController positions the buttons at the bottom, but in
        // the middle. Change their layout parameters so they appear on the
        // right.
        View controls = mZoomButtonsController.getZoomControls();
        ViewGroup.LayoutParams params = controls.getLayoutParams();
        if (params instanceof FrameLayout.LayoutParams) {
            ((FrameLayout.LayoutParams) params).gravity = Gravity.RIGHT;
        }
    }
    return mZoomButtonsController;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) ZoomButtonsController(android.widget.ZoomButtonsController) View(android.view.View)

Example 8 with ZoomButtonsController

use of android.widget.ZoomButtonsController in project XobotOS by xamarin.

the class ZoomControlEmbedded method getControls.

private ZoomButtonsController getControls() {
    if (mZoomButtonsController == null) {
        mZoomButtonsController = new ZoomButtonsController(mWebView);
        mZoomButtonsController.setOnZoomListener(new ZoomListener());
        // ZoomButtonsController positions the buttons at the bottom, but in
        // the middle. Change their layout parameters so they appear on the
        // right.
        View controls = mZoomButtonsController.getZoomControls();
        ViewGroup.LayoutParams params = controls.getLayoutParams();
        if (params instanceof FrameLayout.LayoutParams) {
            ((FrameLayout.LayoutParams) params).gravity = Gravity.RIGHT;
        }
    }
    return mZoomButtonsController;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) ZoomButtonsController(android.widget.ZoomButtonsController) View(android.view.View)

Aggregations

ZoomButtonsController (android.widget.ZoomButtonsController)8 View (android.view.View)3 ViewGroup (android.view.ViewGroup)3 FrameLayout (android.widget.FrameLayout)3 Context (android.content.Context)2 AttributeSet (android.util.AttributeSet)2 SuppressLint (android.annotation.SuppressLint)1 WebSettings (android.webkit.WebSettings)1 Method (java.lang.reflect.Method)1