package aquarius.findyourfate.com;
import android.app.Activity; 
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.view.Gravity; 
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ScrollView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

public class listcharacter extends AppCompatActivity{
	 Button back;
	 int fsize=0;
	 String content;
		
		@Override 
	protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.character);
            
            String userAgent = new WebView(listcharacter.this).getSettings().getUserAgentString();
	       if (userAgent.contains("Mobile")) {
			fsize=16;
			} 
			else {
	  		fsize=19;
			}       
            
        back=(Button) findViewById(R.id.back);

			ActionBar actionBar = getSupportActionBar();
			if (actionBar != null) {
				// Enable the home button and set display options
				actionBar.setDisplayHomeAsUpEnabled(true);
				actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);

				// Set the title of the ActionBar
				actionBar.setTitle(Html.fromHtml("<font color=\"#ffffff\" size=\"21px\"><b>Aquarius</b></font>"));

				// Enable the home button for backward compatibility
				if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
					actionBar.setHomeButtonEnabled(true);
				}

				// Show the ActionBar
				actionBar.show();
			}
    	 	LinearLayout layouts = (LinearLayout) findViewById(R.id.layout);
          	final ScrollView home_scroll = new ScrollView(this); 
    	 	 home_scroll.setBackgroundColor(Color.BLACK);  
    	 	 final LinearLayout layout=new  LinearLayout(this);
    	 	 layout.setOrientation(LinearLayout.VERTICAL);
    		 layout.setGravity(Gravity.CENTER);
    	 	 final WebView web=new WebView(this);
    		 web.setPadding(0, 20, 0, 20);
    		 WebSettings webSettings = web.getSettings(); 
			 webSettings.setDefaultFontSize(fsize);
		     webSettings.setBuiltInZoomControls(true);
		     
		     content =getIntent().getStringExtra("listvalue");
		     
	 	     if(content.equals("Traits Summary"))
		       {  
		    	  web.setBackgroundColor(0);
		   		  web.loadUrl("file:///android_asset/aquarius.html");  
		      }
	 	    if(content.equals("Apology"))
		        {  
		    	  web.setBackgroundColor(0);
		    	  web.setBackgroundResource(R.drawable.apologybg);  
		      	  web.loadUrl("file:///android_asset/apology.html");  
		       }
		       if(content.equals("Characters"))
		       {
			   web.setBackgroundColor(0);
		 		  web.setBackgroundResource(R.drawable.charbg);  
		     	   web.loadUrl("file:///android_asset/char.html");  
               }
		       if(content.equals("Element"))
		       {
			      web.setBackgroundColor(0);
			  	  web.setBackgroundResource(R.drawable.elementbg);  
		     	  web.loadUrl("file:///android_asset/element.html");  
     	        }
		       if(content.equals("Finance"))
		      {
			     web.setBackgroundColor(0);
		 		  web.setBackgroundResource(R.drawable.financebg);  
		    	 	 web.loadUrl("file:///android_asset/finance.html");  
              }
		       if(content.equals("Physical"))
		      {
			   web.setBackgroundColor(0);
		 	  web.setBackgroundResource(R.drawable.physicalbg);  
		  	 web.loadUrl("file:///android_asset/physical.html");  
              }
		       if(content.equals("Career"))
		      {
			   web.setBackgroundColor(0);
	    		  web.setBackgroundResource(R.drawable.careerbg);  
		 	    	  web.loadUrl("file:///android_asset/career.html");  
       	   }
	 	  if(content.equals("Health"))
	 	  {
	 		  web.setBackgroundColor(0);
	 	   		  web.setBackgroundResource(R.drawable.healthbg);  
		  		  web.loadUrl("file:///android_asset/health.html");  
           }
	 	 if(content.equals("Myth"))
	 	 {
	 		 web.setBackgroundColor(0);
	 	 	  web.setBackgroundResource(R.drawable.mythbg);  
		  		 web.loadUrl("file:///android_asset/myth.html");  
     	 }
	 	  if(content.equals("Leisure"))
	 	 {
	 		 web.setBackgroundColor(0);
	 		 	  web.setBackgroundResource(R.drawable.leisurebg);  
		    	 	 web.loadUrl("file:///android_asset/leisure.html");  
     	 }
	 	 if(content.equals("Fashion"))
	 	 {
	 		 web.setBackgroundColor(0);
	     	 web.setBackgroundResource(R.drawable.fashionbg);  
		       	 web.loadUrl("file:///android_asset/fashion.html");  
   	      }
	 	 if(content.equals("Love"))
	 	 {
	 		 web.setBackgroundColor(0);
	 	  	 web.setBackgroundResource(R.drawable.lovebg);  
		       	 web.loadUrl("file:///android_asset/love.html");  
	 	 }
 	 	  if(content.equals("Women"))
 	 	   {
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.womenbg); 
	     	 web.loadUrl("file:///android_asset/women.html");  
     	 	}
 	 	 if(content.equals("Men"))
 	 	  {
	 		 web.setBackgroundColor(0);
	  	   web.setBackgroundResource(R.drawable.menbg); 
	    	  web.loadUrl("file:///android_asset/men.html");  
    	 }
 	 	 if(content.equals("Likes"))
	 	  {
	 		 web.setBackgroundColor(0);
	 	 web.setBackgroundResource(R.drawable.likesbg); 
	       	 web.loadUrl("file:///android_asset/likes.html");  
       	
	 	 	}
		 if(content.equals("Dislikes"))
	 	  {
	 		 web.setBackgroundColor(0);
	 	      web.setBackgroundResource(R.drawable.dislikebg); 
	    	 web.loadUrl("file:///android_asset/dislikes.html");  
       	
	 	 	}
		 if(content.equals("Flowers"))
	 	  {
	 		 web.setBackgroundColor(0);
	    	  web.setBackgroundResource(R.drawable.flowersbg);      
	     	 web.loadUrl("file:///android_asset/flowers.html");  
       	
	 	 	}
		if(content.equals("Dentistry"))
	 	  {
	 		 web.setBackgroundColor(0);
	 		  web.setBackgroundResource(R.drawable.densitbg); 
	      	 web.loadUrl("file:///android_asset/densit.html");  
      	
	 	 	}
		
				 if(content.equals("Bad Habits"))
	 	  {
	 		 web.setBackgroundColor(0);
	  	 web.setBackgroundResource(R.drawable.badbg); 
	     	 web.loadUrl("file:///android_asset/badhabits.html");  
       	
	 	 	}
		 if(content.equals("Best Friends"))
	 	 {
		 	 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.bestbg); 
	      	 web.loadUrl("file:///android_asset/bestfriends.html");  
       	
	 	 	}
				 if(content.equals("Car Colors"))
	 	  {
	 	 web.setBackgroundColor(0);
	 	 web.setBackgroundResource(R.drawable.carbg); 
     	 web.loadUrl("file:///android_asset/car.html");  
        	}
		if(content.equals("Eating habits"))
	    	{
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.eatbg); 
	      	 web.loadUrl("file:///android_asset/eatinghabits.html");  
      	}  
		 if(content.equals("Coffee"))
	    	{
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.cofeebg); 
	    	  web.loadUrl("file:///android_asset/coffee.html");  
           }  
	 	if(content.equals("Hobbies"))
	 	  {
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.hobbiesbg); 
	      	 web.loadUrl("file:///android_asset/hobbies.html");  
      	
	 	 	}  
		 if(content.equals("Exercises"))
	 	   {
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.excerbg); 
	      	 web.loadUrl("file:///android_asset/exercise.html");  
     	  }   
		  if(content.equals("Organic Foods"))
	 		{
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.organicbg); 
	      	 web.loadUrl("file:///android_asset/organic.html");  
     	 	} 
		 	 if(content.equals("Diet"))
		 	 	{
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.dietbg); 
	    	 web.loadUrl("file:///android_asset/diet.html");  
         	}
		 	 if(content.equals("Moms"))
		 	 	{
	 		 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.mombg); 
	     	 web.loadUrl("file:///android_asset/mom.html");  
        	} 
		 	 if(content.equals("Spotting"))
		 	 	{
	 		 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.spotbg); 
	    	 web.loadUrl("file:///android_asset/spot.html");  
     	 	}
		 	 if(content.equals("Loves"))
		 	 {
	 		 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.lovebg); 
	      	 web.loadUrl("file:///android_asset/loving.html");  
      	 	} 
		 	 if(content.equals("Going Green"))
		 	 {
	 		 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.greenbg); 
	      	 web.loadUrl("file:///android_asset/gnggreen.html");  
     	 	} 
		 	 if(content.equals("Volunteering"))
		 	 {
	 		 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.volbg); 
	     	 web.loadUrl("file:///android_asset/vol.html");  
       	
	 	 	} 
		 	   
		 if(content.equals("Best Pets"))
	 		{
	 		 web.setBackgroundColor(0);
	  		 web.setBackgroundResource(R.drawable.petbg); 
	     	 web.loadUrl("file:///android_asset/bestpet.html");  
       	
	 	 	}   
		 if(content.equals("Dating"))
	 		{
	 		 web.setBackgroundColor(0);
	 	     web.setBackgroundResource(R.drawable.datingbg); 
	      	 web.loadUrl("file:///android_asset/dating.html");  
     	 	}  
		 if(content.equals("Fitness"))
	 		{
	 		 web.setBackgroundColor(0);
	 		 web.setBackgroundResource(R.drawable.fitbg); 
	 		 web.loadUrl("file:///android_asset/fitness.html");  
 	 		}  
		 if(content.equals("Talents"))
	 	    {
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.talentbg); 
	      	 web.loadUrl("file:///android_asset/talent.html");  
	 	    }  
		 if(content.equals("Strengths and Weaknesses"))
	 	    {
	 		 web.setBackgroundColor(0);
	 	 	 web.setBackgroundResource(R.drawable.strengthbg); 
	      	 web.loadUrl("file:///android_asset/strength.html");  
	 	    } 
	 		if(content.equals("Colors"))
	 	    {
	 		 web.setBackgroundColor(0);
	 		 web.setBackgroundResource(R.drawable.colorbg); 
	     	 web.loadUrl("file:///android_asset/colors.html");  
	 	    	}  
		 	 
 		 	 
 		 	 
		       layout.addView(web);
    		   back.setOnClickListener(new View.OnClickListener() {
    			   
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
			 	listcharacter.this.finish();
		 		overridePendingTransition(R.anim.left_out, R.anim.right_in);
				}
			});
    	       home_scroll.addView(layout);  
              layouts.removeAllViews();
   		      layouts.addView(home_scroll);

	 }
	 
	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
 	
		    MenuInflater inflater = getMenuInflater();
		    inflater.inflate(R.menu.mainone, menu);
		 // animation = (AnimationView) menu.findItem(R.id.character);
		    return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
           // toggle nav drawer on selecting action bar app icon/title
            int id = item.getItemId();
            if (id == R.id.character) {
              	 Intent in=new Intent(listcharacter.this,signtraits.class);
              	 startActivity(in);
               	  return true;
               }
            if (id == R.id.card) {
           	 Intent in=new Intent(listcharacter.this,card.class);
           	 startActivity(in);
            	  return true;
            }
            else  if(id==R.id.share)
            {
          	Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
 		    	emailIntent.setType("text/plain");
 		    	emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Aquarius - Findyourfate.com ");
 		      	emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hi,I would like to suggest, this Aquarius App to you. \n\n Click this Link to Download app \"http://goo.gl/0tIwFJ\"\n\n Regards");
 		    	startActivity(emailIntent);  
            }
            else if(id==R.id.exit)
            {
          	  AlertDialog.Builder builder = new AlertDialog.Builder(this);
 	   				builder.setTitle("Exit!");
 	   		 	    builder.setMessage("Are you sure want to exit from Aquarius Apps?")
 	   			     .setCancelable(false)
 	   			     .setIcon(R.drawable.alert)
 	   			       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
 	   			          public void onClick(DialogInterface dialog, int id) {
 	   			            Intent intent = new Intent(Intent.ACTION_MAIN);
 	   			   		    intent.addCategory(Intent.CATEGORY_HOME);
 	   			   		    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 	   			   		    startActivity(intent);
 	   			              }
 	   			          })
 	   			          .setNegativeButton("No", new DialogInterface.OnClickListener() {
 	   			              public void onClick(DialogInterface dialog, int id) {
 	   			                 dialog.cancel();
 	   			               }
 	   			           });
 	   			    AlertDialog alert = builder.create();
 	   			    alert.show();
             }
           else
           {
         	  
           }
           return super.onOptionsItemSelected(item);
           }
}

