package credit.android.dg;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class DrugLords extends Activity implements Constants{
	
	public static TelephonyManager mTManager;
	private String DeviceID;
	private Button FirstTimeButton;
	private Button Login;
	private TextView TextID;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 
        
        mTManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
        DeviceID = mTManager.getDeviceId();
        
        /*	manipulate with DeviceID 
         * */
        
        
        FirstTimeButton = (Button) findViewById(R.id.firsttimebutton);
        Login = (Button) findViewById(R.id.login);
        TextID = (TextView) findViewById(R.id.textID);
        TextID.setText("i-th " + mTManager.getSimState() + " " + mTManager.getDeviceId());
        
        FirstTimeButton.setOnClickListener(new View.OnClickListener() {
        	
        	public void onClick(View view){        		
        		doFirstTime();    		
        	}
        });
        
        Login.setOnClickListener(new View.OnClickListener() {
        	
        	public void onClick(View view){
        		doLogin();
        	}
        });
    }
    
    
    
    public void doFirstTime(){
    	
    	Intent i = new Intent(this, ConnectScreen.class);
    	i.putExtra(DIALOG_STRING, FIRST_TIME_DIALOG);
    	i.putExtra(DEVICE_ID_STRING, DeviceID);
    	startActivity(i);
    }
    
    public void doLogin(){
    	Intent i = new Intent(this, ConnectScreen.class);
    	i.putExtra(DIALOG_STRING, LOGIN_DIALOG);
    	i.putExtra(DEVICE_ID_STRING, DeviceID);
    	startActivity(i);
    }
}