package mercuryretrograde.findyourfate.com; 
import android.app.Activity; 
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

 
public class fontchange extends Activity {
 
  private RadioGroup radioSexGroup;
  private RadioButton radioSexButton;
  private Button btnDisplay;
  public static final String MyPREFERENCES = "MyPrefs" ;
  public static final String name = "fontsize";  
  SharedPreferences sharedpreferences;
  Editor editor;
  String fontsize=null;
  @Override
  public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.fontchange); 
	radioSexGroup = (RadioGroup) findViewById(R.id.rgOpinion);
	btnDisplay = (Button) findViewById(R.id.btnDisplay);
	RadioButton s = (RadioButton) findViewById(R.id.small);
	RadioButton m= (RadioButton) findViewById(R.id.normal);
	RadioButton l= (RadioButton) findViewById(R.id.large);
	RadioButton ll= (RadioButton) findViewById(R.id.larger);
	RadioButton xl= (RadioButton) findViewById(R.id.xlarge);
	addListenerOnButton();
	  
	 
		/* sharedpreferences=getSharedPreferences(MyPREFERENCES,Context.MODE_PRIVATE);
			      if (sharedpreferences.contains(name))
			      {
			        fontsize=sharedpreferences.getString("fontsize", name);
			        if(fontsize.equals("Small"))
			        {
			        	s.setChecked(true);
			        }
			        else if(fontsize.equals("Medium"))
			        {
			        	m.setChecked(true);
			        }
			        else if(fontsize.equals("Large"))
			        {
			        	l.setChecked(true);
			        }
			        else if(fontsize.equals("Larger"))
			        {
			        	ll.setChecked(true);
			        }
			        else if(fontsize.equals("X-Large"))
			        {
			        	xl.setChecked(true);
			        }
			    	  
			        else
			        {
			        	m.setChecked(true);
			        }
			      } 
	 */
	 
 
  }
 
  public void addListenerOnButton() {
 
	btnDisplay.setOnClickListener(new OnClickListener() {
 
		@Override
		public void onClick(View v) {
			int selectedId = radioSexGroup.getCheckedRadioButtonId();  
		        radioSexButton = (RadioButton) findViewById(selectedId);
 String fontsize=radioSexButton.getText().toString();
		 Toast.makeText(fontchange.this,"vv"+fontsize, Toast.LENGTH_SHORT).show();
			
			/*editor = sharedpreferences.edit(); 
			 editor.putString(name, fontsize); 
		      editor.commit();*/
			
		      fontchange.this.finish();
			 
		}
 
	});
 
  }
}
 