Code example for View

Methods: getTagsetTaggetSettingssetBackgroundColor, getContext, getWidth, setDrawingCacheEnabled

0
	 
	 
	 
	public void load(){ 
		 
		if(url.equals(wv.getTag(AQuery.TAG_URL))){
    		return; 
    	} 
		 
    	wv.setTag(AQuery.TAG_URL, url);
    	 
    	if(android.os.Build.VERSION.SDK_INT <= 10){
    		wv.setDrawingCacheEnabled(true);
    	} 
    	 
    	fixWebviewTip(wv.getContext());
		 
    	 
    	WebSettings ws = wv.getSettings();
    	ws.setSupportZoom(zoom);
    	ws.setBuiltInZoomControls(zoom);
    	 
    	if(!control){
    		disableZoomControl(wv);
    	} 
    	 
    	ws.setJavaScriptEnabled(true);
    	wv.setBackgroundColor(color);
    	 
    	if(progress != null){
    		//progress.setVisibility(View.VISIBLE); 
    		Common.showProgress(progress, url, true);
    	} 
    	 
		if(wv.getWidth() > 0){
			setup(); 
		}else{ 
			delaySetup(); 
		} 
		 
		 
		 
	} 
	 
	private void delaySetup(){ 
		 
		wv.setPictureListener(new PictureListener() {
			 
 
			@Override 
			public void onNewPicture(WebView view, Picture picture) {
				wv.setPictureListener(null);
				setup(); 
			} 
			 
			 
		}); 
		 
		//wv.setInitialScale(100); 
		wv.loadData("<html></html>", "text/html", "utf-8");
		wv.setBackgroundColor(color);
		 
	} 
	 
	 
    private void setup(){ 
    	 
    	String source = getSource(wv.getContext());
    	String html = source.replace("@src", url).replace("@color", Integer.toHexString(color));
    	 
    	wv.setWebViewClient(this);
    	 
    	//wv.setInitialScale(100); 
    	wv.loadDataWithBaseURL(null, html, "text/html", "utf-8", null);
    	wv.setBackgroundColor(color);
    	 
    } 
	 
    private void done(WebView view){
    	if(progress != null){
			//progress.setVisibility(View.GONE); 
			view.setVisibility(View.VISIBLE);
    		Common.showProgress(progress, url, false);
		} 
		view.setWebViewClient(null);
    } 
     
    @Override 
	public void onPageFinished(WebView view, String url) {
    	done(view);
	} 
	 
	@Override 
	public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
		done(view);
	} 
	 
	@Override 
	public void onScaleChanged(WebView view, float oldScale, float newScale) {
		//AQUtility.debug("onScaleChanged", oldScale + ":" + newScale); 
	} 
	 
	private static void disableZoomControl(WebView wv){
		 
		if(android.os.Build.VERSION.SDK_INT < 11) return;
		 
		WebSettings ws = wv.getSettings();		
		AQUtility.invokeHandler(ws, "setDisplayZoomControls", false, false, new Class[]{boolean.class}, false);
		 
	} 
	 
	/* 
Connect your IDE to all the code out there  Get Codota for Java