package io.github.hidroh.materialistic;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;


public class WebActivity extends ActionBarActivity {
    public static final String EXTRA_URL = WebActivity.class.getName() + ".EXTRA_URL";
    public static final String EXTRA_TITLE = WebActivity.class.getName() + ".EXTRA_TITLE";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web);
        final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress);
        final WebView webView = (WebView) findViewById(R.id.webView);
        webView.setWebViewClient(new WebViewClient());
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
                progressBar.setProgress(newProgress);
                if (newProgress == 100) {
                    progressBar.setVisibility(View.GONE);
                    webView.setVisibility(View.VISIBLE);
                }
            }
        });
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl(getIntent().getStringExtra(EXTRA_URL));
        setTitle(getIntent().getStringExtra(EXTRA_TITLE));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_web, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

@@ -34,16 +34,104 @@
 istic;%0A%0A
+import android.annotation.TargetApi;%0Aimport android.os.Build;%0Aimport android.os.Bundle;%0A
 import a
@@ -175,34 +175,8 @@
 ty;%0A
-import android.os.Bundle;%0A
 impo
@@ -284,32 +284,67 @@
 ebChromeClient;%0A
+import android.webkit.WebSettings;%0A
 import android.w
@@ -1517,19 +1517,18 @@
     
-w
+setW
 ebView
-.get
 Sett
@@ -1536,35 +1536,29 @@
 ngs(
-).setJavaScriptEnabled(true
+webView.getSettings()
 );%0A 
@@ -1616,24 +1616,24 @@
 XTRA_URL));%0A
-
         setT
@@ -1678,32 +1678,478 @@
 TITLE));%0A    %7D%0A%0A
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB)%0A    private void setWebViewSettings(WebSettings webSettings) %7B%0A        webSettings.setJavaScriptEnabled(true);%0A        webSettings.setLoadWithOverviewMode(true);%0A        webSettings.setUseWideViewPort(true);%0A        webSettings.setBuiltInZoomControls(true);%0A        if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.HONEYCOMB) %7B%0A            webSettings.setDisplayZoomControls(false);%0A        %7D%0A    %7D%0A%0A
     @Override%0A  

Enable web view zooming