package fsenablers.android.activity;

import fsenablers.android.BuildConfig;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebViewFragment;


public class MyWebViewFragment extends WebViewFragment {

	private static final String TAG = "MyFragment";
	
	// private WebView view;
	
	public void onCreate( Bundle savedInstanceState ) {
		super.onCreate( savedInstanceState );
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onCreate" );}
	}
	
	public void onAttach( Activity a ) {
		super.onAttach( a );
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onAttach" );}
	}
	
	
	public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		
		View v = super.onCreateView( inflater, container, savedInstanceState );
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onCreateView" );}
		
		// view = new WebView( getActivity() );
		
		/*
		if( savedInstanceState != null ) {
			
			System.out.println( savedInstanceState );
			Bundle wvState = (Bundle) savedInstanceState.getParcelable( "myWebViewState" );
			if( wvState != null ) {
				WebView wv = (WebView)v;
				wv.restoreState( wvState );
			}
			
			
			//wv.restorePicture( savedInstanceState, getPictureFile() );
		}
		*/
		return v;
	}
	
	public void onActivityCreated (Bundle savedInstanceState) {
		super.onActivityCreated( savedInstanceState );

		if( BuildConfig.DEBUG ) { Log.d( TAG, "onActivityCreated" );}
		
	}
	
	public void onDestroyView() {
		super.onDestroyView();
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onDestroyView" );}
	}
	
	
	
	public void onDetach() {
		super.onDetach();
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onDetach" );}
	}
	
	public void onStart() {
		super.onStart();
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onStart" );}
	}
	
	public void onStop() {
		super.onStop();
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onStop" );}
	}
	
	public void onPause() {
		super.onPause();
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onPause" );}
	}
	
	public void onResume() {
		super.onResume();
		if( BuildConfig.DEBUG ) { Log.d( TAG, "onResume" );}
	}

	public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        if( BuildConfig.DEBUG ) { Log.d( TAG, "onSaveInstanceState" );}
        /*
        WebView wv = getWebView();
        
        Bundle wvState = new Bundle();
        wv.saveState( wvState );
        
        outState.putParcelable( "myWebViewState", wvState );
        */
        
    }
}
