package metro.net.tehranit;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class MetroActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button btnlogin = (Button) findViewById(R.id.btnlogin);
        final EditText txt1login = (EditText) findViewById(R.id.txt1login);
        btnlogin.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                String y = txt1login.getText().toString();
                Double x = Double.parseDouble(y.toString());
                if (x == 12345) {
                    Intent myintent = new Intent(MetroActivity.this, QRActivity.class);
                    MetroActivity.this.startActivity(myintent);

                    Toast.makeText(MetroActivity.this, "کد وارد شده صحیح است", Toast.LENGTH_LONG).show();
                }
                else {
                    txt1login.setText("");
                    txt1login.setHint("کد احراز هویت را وارد کنید");
                    Toast.makeText(MetroActivity.this, "کد احراز هویت 12345", Toast.LENGTH_SHORT).show();

                }

            }
        });

    }
}