Java Code Examples for android.widget.ZoomButtonsController

The following are top voted examples for showing how to use android.widget.ZoomButtonsController. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OSchina_resources_android   File: UIHelper.java   View source code 6 votes vote down vote up
@SuppressLint({"JavascriptInterface", "SetJavaScriptEnabled"})
public static void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(14);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(false);
    settings.setBuiltInZoomControls(false);
    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }
    //webView.setWebViewClient(UiUtil.getWebViewClient());
}
 
Example 2
Project: CoreModule   File: BrowserFragment.java   View source code 6 votes vote down vote up
@SuppressLint({"SetJavaScriptEnabled"})
public static void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(15);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);

    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 19) {
        webView.getSettings().setLoadsImagesAutomatically(true);
    } else {
        webView.getSettings().setLoadsImagesAutomatically(false);
    }

    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }
    addWebImageShow(webView.getContext(), webView);
}
 
Example 3
Project: CoreModule   File: BrowserDelegateOption.java   View source code 6 votes vote down vote up
@SuppressLint({"SetJavaScriptEnabled"})
public static void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(15);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);

    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 19) {
        webView.getSettings().setLoadsImagesAutomatically(true);
    } else {
        webView.getSettings().setLoadsImagesAutomatically(false);
    }

    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }
    addWebImageShow(webView.getContext(), webView);
}
 
Example 4
Project: Cotable   File: BaseDetailFragment.java   View source code 6 votes vote down vote up
@SuppressLint({"SetJavaScriptEnabled", "JavascriptInterface"})
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(15);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);

    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }

}
 
Example 5
Project: TinyTravelTracker   File: ViewImage.java   View source code 6 votes vote down vote up
private void setupZoomButtonController(final View ownerView) {
    mZoomButtonsController = new ZoomButtonsController(ownerView);
    mZoomButtonsController.setAutoDismissed(false);
    mZoomButtonsController.setZoomSpeed(100);
    mZoomButtonsController.setOnZoomListener(
            new ZoomButtonsController.OnZoomListener() {
        public void onVisibilityChanged(boolean visible) {
            if (visible) {
                updateZoomButtonsEnabled();
            }
        }

        public void onZoom(boolean zoomIn) {
            if (zoomIn) {
                mImageView.zoomIn();
            } else {
                mImageView.zoomOut();
            }
            mZoomButtonsController.setVisible(true);
            updateZoomButtonsEnabled();
        }
    });
}
 
Example 6
Project: KJBlog   File: UIHelper.java   View source code 6 votes vote down vote up
@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" })
public static void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(15);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);
    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }
    webView.setWebViewClient(UIHelper.getWebViewClient());
}
 
Example 7
Project: Redpin   File: ZoomAndScrollImageView.java   View source code 6 votes vote down vote up
/**
 * Initializes the view
 *
 * @param context
 *            {@link Context}
 */
private void init(Context context) {
    setFocusable(true);
    scroller = new Scroller(context);
    gestureDetector = new GestureDetector(context, this);
    scaleGestureDetector = new ScaleGestureDetector(context, this);

    zoomController = new ZoomButtonsController(this);
    zoomController.setOnZoomListener(this);

    matrix = new Matrix();
    destination = new float[2];

    // setVerticalScrollBarEnabled(true);
    // setHorizontalScrollBarEnabled(true);

}
 
Example 8
Project: oschina-app   File: TweetDetailFragment.java   View source code 6 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void initWebView(WebView webView) {
	WebSettings settings = webView.getSettings();
	settings.setDefaultFontSize(20);
	settings.setJavaScriptEnabled(true);
	settings.setSupportZoom(true);
	settings.setBuiltInZoomControls(true);
	int sysVersion = Build.VERSION.SDK_INT;
	if (sysVersion >= 11) {
		settings.setDisplayZoomControls(false);
	} else {
		ZoomButtonsController zbc = new ZoomButtonsController(webView);
		zbc.getZoomControls().setVisibility(View.GONE);
	}
	UIHelper.addWebImageShow(getActivity(), webView);
}
 
Example 9
Project: oschina-app   File: BaseDetailFragment.java   View source code 6 votes vote down vote up
@SuppressLint({"SetJavaScriptEnabled", "JavascriptInterface"})
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(15);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);
    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }
    UIHelper.addWebImageShow(getActivity(), webView);
}
 
Example 10
Project: KJFrameForAndroid   File: UIHelper.java   View source code 6 votes vote down vote up
@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" })
public static void initWebView(WebView webView) {
    WebSettings settings = webView.getSettings();
    settings.setDefaultFontSize(15);
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);
    int sysVersion = Build.VERSION.SDK_INT;
    if (sysVersion >= 11) {
        settings.setDisplayZoomControls(false);
    } else {
        ZoomButtonsController zbc = new ZoomButtonsController(webView);
        zbc.getZoomControls().setVisibility(View.GONE);
    }
    webView.setWebViewClient(UIHelper.getWebViewClient());
}
 
Example 11
Project: yiim_v2   File: ViewImageDialog.java   View source code 6 votes vote down vote up
private void setupZoomButtonController(final View ownerView) {
	mZoomButtonsController = new ZoomButtonsController(ownerView);
	mZoomButtonsController.setAutoDismissed(false);
	mZoomButtonsController.setZoomSpeed(100);
	mZoomButtonsController
			.setOnZoomListener(new ZoomButtonsController.OnZoomListener() {
				public void onVisibilityChanged(boolean visible) {
					if (visible) {
						updateZoomButtonsEnabled();
					}
				}

				public void onZoom(boolean zoomIn) {
					if (zoomIn) {
						mImageView.zoomIn();
					} else {
						mImageView.zoomOut();
					}
					mZoomButtonsController.setVisible(true);
					updateZoomButtonsEnabled();
				}
			});
}
 
Example 12
Project: andRoc   File: ActLevel.java   View source code 6 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event) {
  if (m_RocrailService.Prefs.Zoom && levelView.zoomButtonsController == null) {
    levelView.zoomButtonsController = new ZoomButtonsController(getWindow().getDecorView());
    levelView.zoomButtonsController.setOnZoomListener(this);
    levelView.zoomButtonsController.setZoomInEnabled(m_RocrailService.Prefs.Size < 64 );
    levelView.zoomButtonsController.setZoomOutEnabled(m_RocrailService.Prefs.Size > 8 );
  }
  switch (event.getAction()) {
  case MotionEvent.ACTION_UP:
    System.out.println("uptime="+SystemClock.uptimeMillis()+" downtime="+event.getDownTime());
    if (m_RocrailService.Prefs.Zoom && (SystemClock.uptimeMillis() - event.getDownTime()) > 1000 && levelView.zoomButtonsController != null) {
      levelView.zoomButtonsController.setVisible(true);
      levelView.zoomButtonsController.setFocusable(true);
      levelView.zoomButtonsController.getZoomControls().setFocusable(true);
      levelView.zoomButtonsController.getZoomControls().setFocusableInTouchMode(true);
      levelView.zoomButtonsController.getZoomControls().requestFocus();
      return true;
    }
  }
  return levelView.onTouchEvent(event);
}
 
Example 13
Project: coolreader   File: NonLeakingWebView.java   View source code 6 votes vote down vote up
/**
 * Set option to display zoom control
 * http://stackoverflow.com/a/11901948
 * 
 * @param show
 */
@SuppressLint("NewApi")
public void setDisplayZoomControl(boolean show) {
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
		this.getSettings().setDisplayZoomControls(show);
	} else {
		// get the control
		try {
			Class webview = Class.forName("android.webkit.WebView");
			Method method = webview.getMethod("getZoomButtonsController");
			zoom_controll = (ZoomButtonsController) method.invoke(this, null);
			showZoom = show;
		} catch (Exception e) {
			Log.e(TAG, "Error when getting zoom control", e);
		}
	}
}
 
Example 14
Project: ima_intellj   File: TweetDetailFragment.java   View source code 6 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void initWebView(WebView webView) {
	WebSettings settings = webView.getSettings();
	settings.setDefaultFontSize(20);
	settings.setJavaScriptEnabled(true);
	settings.setSupportZoom(true);
	settings.setBuiltInZoomControls(true);
	int sysVersion = Build.VERSION.SDK_INT;
	if (sysVersion >= 11) {
		settings.setDisplayZoomControls(false);
	} else {
		ZoomButtonsController zbc = new ZoomButtonsController(webView);
		zbc.getZoomControls().setVisibility(View.GONE);
	}
	UIHelper.addWebImageShow(getActivity(), webView);
}
 
Example 15
Project: ima_intellj   File: BaseDetailFragment.java   View source code 6 votes vote down vote up
@SuppressLint({ "SetJavaScriptEnabled", "JavascriptInterface" })
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void initWebView(WebView webView) {
	WebSettings settings = webView.getSettings();
	settings.setDefaultFontSize(15);
	settings.setJavaScriptEnabled(true);
	settings.setSupportZoom(true);
	settings.setBuiltInZoomControls(true);
	int sysVersion = Build.VERSION.SDK_INT;
	if (sysVersion >= 11) {
		settings.setDisplayZoomControls(false);
	} else {
		ZoomButtonsController zbc = new ZoomButtonsController(webView);
		zbc.getZoomControls().setVisibility(View.GONE);
	}
	UIHelper.addWebImageShow(getActivity(), webView);
}
 
Example 16
Project: indoorlib   File: MapScrollView.java   View source code 6 votes vote down vote up
/**
 * @param context
 * @param zoomController
 */
private void makeZoomLabel(Context context, ZoomButtonsController zoomController) {
	ViewGroup container = zoomController.getContainer();
	View controls = zoomController.getZoomControls();
	LayoutParams p0 = controls.getLayoutParams();
	container.removeView(controls);
	LinearLayout layout = new LinearLayout(context);
	layout.setOrientation(LinearLayout.VERTICAL);
	mZoomLabel = new TextView(context);
	mZoomLabel.setPadding(12, 0, 12, 0);
	mZoomLabel.setTypeface(Typeface.DEFAULT_BOLD);
	mZoomLabel.setTextColor(0xff000000);
	PaintDrawable d = new PaintDrawable(0xeeffffff);
	d.setCornerRadius(6);
	mZoomLabel.setBackgroundDrawable(d);
	mZoomLabel.setTextSize(20);
	mZoomLabel.setGravity(Gravity.CENTER_HORIZONTAL);
	LinearLayout.LayoutParams p1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	p1.gravity = Gravity.CENTER_HORIZONTAL;
	layout.addView(mZoomLabel, p1);
	layout.addView(controls);
	container.addView(layout, p0);
}
 
Example 17
Project: chromium_webview   File: AwZoomControls.java   View source code 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 18
Project: UPMCarte   File: ZoomAndScrollImageView.java   View source code 6 votes vote down vote up
/**
 * Initializes the view
 * 
 * @param context
 *            {@link Context}
 */
private void init(Context context) {
	setFocusable(true);
	scroller = new Scroller(context);
	gestureDetector = new GestureDetector(context, this);
	scaleGestureDetector = new ScaleGestureDetector(context, this);

	zoomController = new ZoomButtonsController(this);
	zoomController.setOnZoomListener(this);

	matrix = new Matrix();
	destination = new float[2];

	// setVerticalScrollBarEnabled(true);
	// setHorizontalScrollBarEnabled(true);

}
 
Example 19
Project: cordova-android-chromium   File: AwZoomControls.java   View source code 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 20
Project: WhiteRead   File: MMWebView.java   View source code 5 votes vote down vote up
private void getController(boolean tag) {
    try {
        Class webView = Class.forName("android.webkit.WebView");
        Method method = webView.getMethod("getZoomButtonsController");
        ZoomButtonsController zoomController = (ZoomButtonsController) method.invoke(this, new Object[]{});
        if (zoomController != null) {
            zoomController.setVisible(tag);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 21
Project: AndroidBase   File: CustWebView.java   View source code 5 votes vote down vote up
private void getControlls() {
    try {
        Class<?> webview = Class.forName("android.webkit.WebView");
        Method method = webview.getMethod("getZoomButtonsController");
        ZoomButtonsController zoomController = (ZoomButtonsController) method.invoke(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 22
Project: Rocko-Android-Demos   File: ZoomButtonsActivity.java   View source code 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);
        }
    });
}
 
Example 23
Project: SimpleKiwixWikivoyage   File: KiwixWebView.java   View source code 5 votes vote down vote up
private void getZoomControlls() {
    try {
        Class webview = Class.forName("android.webkit.WebView");
        Method method = webview.getMethod("getZoomButtonsController");
        zoomControll = (ZoomButtonsController) method.invoke(this, null);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 24
Project: indoorlib   File: MapScrollView.java   View source code 5 votes vote down vote up
/**
 * @param context
 * @param attrs
 */
public MapScrollView(Context context, AttributeSet attrs) {
	super(context, attrs);
	mScroller = new Scroller(context);
	mGestureDetector = new GestureDetector(this);
	mScale = 1;
	mZoomButtonsController = new ZoomButtonsController(this);
	mZoomButtonsController.setAutoDismissed(true);
	mZoomButtonsController.setOnZoomListener(this);
	mZoomButtonsController.setZoomSpeed(25);
	mZoomButtonsController.setZoomInEnabled(mScale < MAX_ZOOM);
	mZoomButtonsController.setZoomOutEnabled(mScale > MIN_ZOOM);
	makeZoomLabel(context, mZoomButtonsController);
	
	mZoomFormat = NumberFormat.getPercentInstance();
	mZoomLabel.setText("Zoom: " + mZoomFormat.format(mScale));
	
	setVerticalScrollBarEnabled(true);
	setHorizontalScrollBarEnabled(true);
	TypedArray a = context.obtainStyledAttributes(R.styleable.Scroll);
	initializeScrollbars(a);
	a.recycle();
	mMatrix = new Matrix();
	mDst = new float[2];
	mZoomAnimation = new ZoomAnimation();
	mPaths = new Path[2];
	mPathPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
	mPathPaint.setStyle(Style.STROKE);
       mPathPaint.setStrokeCap(Cap.SQUARE);
       
    
}
 
Example 25
Project: chromium_webview   File: AwZoomControls.java   View source code 5 votes vote down vote up
@Override
public void invokeZoomPicker() {
    ZoomButtonsController zoomController = getZoomController();
    if (zoomController != null) {
        zoomController.setVisible(true);
    }
}
 
Example 26
Project: chromium_webview   File: AwZoomControls.java   View source code 5 votes vote down vote up
@Override
public void dismissZoomPicker() {
    ZoomButtonsController zoomController = getZoomController();
    if (zoomController != null) {
        zoomController.setVisible(false);
    }
}
 
Example 27
Project: pickncrop   File: MainActivity.java   View source code 5 votes vote down vote up
public void createZoomControls() {
	ZoomButtonsController zoomButtonsController = new ZoomButtonsController(
			imageView);
	zoomButtonsController.setVisible(true);
	zoomButtonsController.setAutoDismissed(false);
	zoomButtonsController.setOnZoomListener(new OnZoomListener() {

		public void onZoom(boolean zoomIn) {
			matrix = imageView.getImageMatrix();
			if (zoomIn) {
				matrix.postScale(1.05f, 1.05f, 0.5f * size, 0.5f * size);
				imageView.setImageMatrix(matrix);
			} else {
				matrix.postScale(0.95f, 0.95f, 0.5f * size, 0.5f * size);
				imageView.setImageMatrix(matrix);
			}
			imageView.invalidate();
		}

		public void onVisibilityChanged(boolean visible) {
		}
	});
	RelativeLayout.LayoutParams zoomLayoutParams = new RelativeLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	zoomLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
	zoomLayoutParams.addRule(RelativeLayout.BELOW, R.id.imageViewCrop);
	viewManager.addView(zoomButtonsController.getContainer(),
			zoomLayoutParams);
}
 
Example 28
Project: cordova-android-chromium   File: AwZoomControls.java   View source code 5 votes vote down vote up
@Override
public void invokeZoomPicker() {
    ZoomButtonsController zoomController = getZoomController();
    if (zoomController != null) {
        zoomController.setVisible(true);
    }
}
 
Example 29
Project: cordova-android-chromium   File: AwZoomControls.java   View source code 5 votes vote down vote up
@Override
public void dismissZoomPicker() {
    ZoomButtonsController zoomController = getZoomController();
    if (zoomController != null) {
        zoomController.setVisible(false);
    }
}
 
Example 30
Project: letv   File: AppbarActivity.java   View source code 4 votes vote down vote up
private void initViews() {
    Method method;
    WebSettings settings = this.mWebView.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setUserAgentString(settings.getUserAgentString() + "/" + UA_PREFIX + this.jsBridge.getVersion() + "/sdk");
    settings.setJavaScriptEnabled(true);
    Class cls = settings.getClass();
    try {
        method = cls.getMethod("setPluginsEnabled", new Class[]{Boolean.TYPE});
        if (method != null) {
            method.invoke(settings, new Object[]{Boolean.valueOf(true)});
        }
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (Throwable th) {
        th.printStackTrace();
    }
    try {
        method = cls.getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
        if (method != null) {
            method.invoke(settings, new Object[]{Boolean.valueOf(true)});
        }
    } catch (SecurityException e2) {
        e2.printStackTrace();
    } catch (NoSuchMethodException e3) {
    } catch (IllegalArgumentException e4) {
    } catch (IllegalAccessException e5) {
    } catch (InvocationTargetException e6) {
    }
    settings.setAppCachePath(getWebViewCacheDir());
    settings.setDatabasePath(getWebViewCacheDir());
    settings.setDatabaseEnabled(true);
    settings.setAppCacheEnabled(true);
    if (supportWebViewFullScreen()) {
        settings.setUseWideViewPort(true);
        if (VERSION.SDK_INT >= 7) {
            try {
                cls.getMethod("setLoadWithOverviewMode", new Class[]{Boolean.TYPE}).invoke(settings, new Object[]{Boolean.valueOf(true)});
            } catch (Exception e7) {
            }
        }
        if (SystemUtils.isSupportMultiTouch()) {
            if (SystemUtils.getAndroidSDKVersion() < 11) {
                try {
                    Field declaredField = WebView.class.getDeclaredField("mZoomButtonsController");
                    declaredField.setAccessible(true);
                    ZoomButtonsController zoomButtonsController = new ZoomButtonsController(this.mWebView);
                    zoomButtonsController.getZoomControls().setVisibility(8);
                    declaredField.set(this.mWebView, zoomButtonsController);
                } catch (Exception e8) {
                }
            } else {
                try {
                    this.mWebView.getSettings().getClass().getMethod("setDisplayZoomControls", new Class[]{Boolean.TYPE}).invoke(this.mWebView.getSettings(), new Object[]{Boolean.valueOf(false)});
                } catch (Exception e9) {
                }
            }
        }
    }
    this.mWebView.setWebViewClient(new d());
    this.mWebView.setWebChromeClient(new c());
    this.mWebView.setDownloadListener(this.mDownloadListener);
    this.mWebView.loadUrl(this.url);
}
 
Example 31
Project: FullRobolectricTestSample   File: ShadowMapView.java   View source code 4 votes vote down vote up
public ShadowMapView(MapView mapView) {
  realMapView = mapView;
  zoomButtonsController = new ZoomButtonsController(mapView);
}
 
Example 32
Project: FullRobolectricTestSample   File: ShadowMapView.java   View source code 4 votes vote down vote up
@Implementation
public ZoomButtonsController getZoomButtonsController() {
  return zoomButtonsController;
}
 
Example 33
Project: FullRobolectricTestSample   File: ShadowZoomButtonsController.java   View source code 4 votes vote down vote up
@Implementation
public void setOnZoomListener(ZoomButtonsController.OnZoomListener listener) {
  this.listener = listener;
}
 
Example 34
Project: FullRobolectricTestSample   File: Robolectric.java   View source code 4 votes vote down vote up
public static ShadowZoomButtonsController shadowOf(ZoomButtonsController instance) {
  return (ShadowZoomButtonsController) shadowOf_(instance);
}
 
Example 35
Project: android_frameworks_mapsv1   File: MapView.java   View source code 4 votes vote down vote up
@OriginalApi
public ZoomButtonsController getZoomButtonsController() {
    return zoomButtonsController;
}