Java Code Examples for android.widget.ZoomButtonsController#setZoomInEnabled()

The following examples show how to use android.widget.ZoomButtonsController#setZoomInEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AwZoomControls.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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);
    }
}
 
Example 2
Source File: AwZoomControls.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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);
    }
}
 
Example 3
Source File: ZoomButtonsActivity.java    From Rocko-Android-Demos with Apache License 2.0 5 votes vote down vote up
private void inti() {
    textView = (TextView) findViewById(R.id.textview);
    scrollView = (ScrollView) findViewById(R.id.scroll_view);

    zoomButtonsController = new ZoomButtonsController(scrollView);
    textView.setOnTouchListener(zoomButtonsController);
    //        zoomButtonsController.setAutoDismissed(false);
    zoomButtonsController.setZoomInEnabled(true);
    zoomButtonsController.setZoomOutEnabled(true);
    zoomButtonsController.setFocusable(true);
    zoomTextSize = textView.getTextSize();
    zoomButtonsController.setOnZoomListener(new ZoomButtonsController.OnZoomListener() {
        @Override
        public void onVisibilityChanged(boolean visible) {
        }

        @Override
        public void onZoom(boolean zoomIn) {
            if (zoomIn) {
                zoomTextSize = zoomTextSize + 1.0f;
            } else {
                zoomTextSize = zoomTextSize - 1.0f;
            }
            textView.setTextSize(zoomTextSize);
        }
    });
}