package athary.audio.ency;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import athary.audio.ency.R;

public class Wizard extends Activity{
	
	//Define Views
	private Button btn_DL;
	private Button btn_db;
	private TextView titleview;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wizard1);
		
		initplayer();
		initViews();
		Appearance();
		setListeners();
	
	}
	
    private void initplayer() {

		  SharedPreferences athary1 = getSharedPreferences("athary", 0);
	      String path = athary1.getString("path", "");
	      
		  if (path.equals("")) {if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)); return;}
		
	}

	private void initViews() {

		btn_DL =(Button) findViewById(R.id.btn_download);		
		btn_db =(Button) findViewById(R.id.btn_db);	
		titleview = (TextView) findViewById(R.id.titleview);
		
	}

	private void Appearance() {

		titleview.setTypeface(Typeface.createFromAsset(getAssets(), "font2.ttf"),Typeface.NORMAL);
		titleview.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f);
		btn_DL.setTypeface(Typeface.createFromAsset(getAssets(), "font2.ttf"),Typeface.NORMAL);
		btn_DL.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f);
		btn_db.setTypeface(Typeface.createFromAsset(getAssets(), "font2.ttf"),Typeface.NORMAL);
		btn_db.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f);		
		
	}

	private void setListeners() {

		btn_db.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(), athary.audio.ency.Helpers.main.FileChooser.class);
				i.putExtra("FLAG", "DB");
				startActivityForResult(i, 0);
			}
		});
		
		btn_DL.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(), Wizard2.class);
				startActivityForResult(i, 0);
			}
		});		
	}

	@Override
    public void onBackPressed()
    {
    	 setResult(1);
   		 finish();         
    }

	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (resultCode == 2){
	     finish();
		}
	}
		   
		
}
