package com.example.nuria.fesp_cyl.FragmentStatic;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.example.nuria.fesp_cyl.R;


public class AfiliateFragment extends Fragment {

    protected WebView pdf;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View v = inflater.inflate(R.layout.fragment_afiliate, container, false);
        pdf = (WebView) v.findViewById(R.id.pdfAfiliate);



        String webpdf = "http://castillayleon.fespugt.es/images/Afiliate/Afiliacion.pdf";
        String url = "http://drive.google.com/viewerng/viewer?embedded=true&url=" + webpdf ;

        pdf.loadUrl(url);
        // Enable Javascript
        WebSettings webSettings = pdf.getSettings();
        webSettings.setJavaScriptEnabled(true);

        // Force links and redirects to open in the WebView instead of in a browser
        pdf.setWebViewClient(new WebViewClient());

        return v;
    }


    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        //you can set the title for your toolbar here for different fragments different titles
        getActivity().setTitle("FeSP_CyL: Afiliate");

    }
}
