package leo.findyourfate.com;
 
import android.os.Bundle;

import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

public class signs extends Fragment {
	WebView web;
	ImageView ariessign,othersign;
	TextView signtext;
	Button back;
	int fsize=0;
	 String  signs;
	 
	    @Override
	   public View onCreateView(LayoutInflater inflater, ViewGroup container,
		        Bundle savedInstanceState) 
	   			{
	    	
		    	View rootView = inflater.inflate(R.layout.sign, container, false);
               Bundle bundle=getArguments(); 
          	 
		 	  signs=bundle.getString("signs");	
		 	  String userAgent = new WebView(getActivity()).getSettings().getUserAgentString();
		 	 
				if (userAgent.contains("Mobile"))
				{
				 	rootView = inflater.inflate(R.layout.sign, container, false);
				 	fsize=17;
		 	 	}
			 	else 
				{
					rootView = inflater.inflate(R.layout.signtablet, container, false);
					fsize=21;
				}
		       web=(WebView) rootView.findViewById(R.id.webView1);
               web.setBackgroundColor(0);
               ariessign=(ImageView) rootView.findViewById(R.id.ariesview);
			   othersign=(ImageView) rootView.findViewById(R.id.signview);
			   signtext=(TextView) rootView.findViewById(R.id.text);
			   back=(Button) rootView.findViewById(R.id.back);
		 		web.getSettings().setBuiltInZoomControls(true);  
			  	WebSettings webSettings = web.getSettings(); 
				webSettings.setDefaultFontSize(fsize);

				if(signs=="Aries")
				{   
				 	othersign.setImageResource(R.drawable.aries);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>COMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
		 			web.loadUrl("file:///android_asset/leoaries.html");
				}
				if(signs=="Taurus")
				{
				 	web.setBackgroundColor(0);
				  	othersign.setImageResource(R.drawable.taurus);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>INCOMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
			 		 web.loadUrl("file:///android_asset/leotaur.html");
				}
				if(signs=="Gemini")
				{
			 		web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.gemini);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>COMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leogemini.html");
	 			}
				if(signs=="Cancer")
				{
				 	web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.cancer);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>INCOMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leocancer.html");
			  	}
				if(signs=="Leo")
				{
				 	web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.leo1);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>VARIABLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leoleo.html");
					
				}
				if(signs=="Virgo")
				{
		 			web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.virgo);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>INCOMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leovirgo.html");
					
		 	 		}
				if(signs=="Libra")
				{
		 			web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.libra);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>COMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leolibra.html");
					
		 		}
				if(signs=="Scorpio")
				{
				 		web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.scorpio);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>INCOMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leoscorp.html");
					 
	 			}
				if(signs=="Sagittarius")
				{
				 	
					web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.sagg);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>COMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leosagg.html");
				}
				if(signs=="Capricorn")
				{
				 	web.setBackgroundColor(0);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>INCOMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					othersign.setImageResource(R.drawable.capri);
					web.loadUrl("file:///android_asset/leocapri.html");
			  	}
				if(signs=="Aquarius")
				{
		 		 		web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.aquar);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>VARIABLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leoaquar.html");
			 	 	}
				if(signs=="Pisces")
				{
			 		web.setBackgroundColor(0);
					othersign.setImageResource(R.drawable.pisces);
					signtext.setText(Html.fromHtml("<font size=\"4\" color=\"#000000\"> Leo is : </font><font size=\"6\" color=\"#0b2701\"><b>INCOMPATIBLE</b></font><font size=\"4\" color=\"#000000\"> with "+signs+"</font>"));
					web.loadUrl("file:///android_asset/leopisces.html");
				}
				
		 		back.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						
						Fragment newFragment = new compatibility();  
						Bundle args = new Bundle();  
						newFragment.setArguments(args);
					 	FragmentTransaction transaction = getFragmentManager().beginTransaction();
						transaction.setCustomAnimations(R.anim.left_out, R.anim.left_in);
						transaction.replace(R.id.frame, newFragment);  
		 				transaction.addToBackStack(null);
						transaction.commit();  
					}
				});
			return rootView;
	    }
}
