package com.camera.simplemjpeg;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebSettings.ZoomDensity;
import android.widget.TextView;
 
public class fragment_webview extends Fragment 
{
 
    WebView browser; 
    String url;
    TextView msg;
    ViewPager toto;
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
 
        View view=inflater.inflate(R.layout.gallery_fragment_webview, container, false);
   
        browser=(WebView)view.findViewById(R.id.my_browser);
        browser.setWebViewClient(new WebViewClient());
                
        browser.getSettings().setBuiltInZoomControls(true);
       // browser.getSettings().setDisplayZoomControls(true); // try
        browser.getSettings().setSupportZoom(true);  // try
        browser.getSettings().setLoadWithOverviewMode(true); //try
        
        
        browser.getSettings().setUseWideViewPort(true);
        browser.getSettings().setLoadWithOverviewMode(true);
        browser.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        //browser.setInitialScale(0);
        browser.getSettings().setDefaultZoom(ZoomDensity.FAR);
        
        
        //setDisplayZoomControls(!supportsMultiTouch)
        
        //msg=(TextView)view.findViewById(R.id.infos);
        //msg.setText(url);
        //<TextView
        //android:id="@+id/infos"
        //android:layout_width="wrap_content"
        //android:layout_height="wrap_content"
        //android:text="TextView" />
 
        
        //View aaaview=inflater.inflate(R.layout.activity_main, container, false);
        //toto=(ViewPager)view.findViewById(R.id.my_pager);
       // toto.getCurrentItem();  ne marche pas !!!
        
        browser.loadUrl(url); 
        
        return view;
    }
  
    // This is the method the pager adapter will use
    // to create a new fragment
    public static Fragment newInstance(String url)
    {
    	fragment_webview f=new fragment_webview();
        f.url=url;
        return f;
    }
  
}
