Thursday 5 March 2015

forget password activity

package com.cssoft.speedlocker;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.cssoft.fonts.MyFonts;
import com.cssoft.validation.Validations;
import com.cssoft.webservices.ForgotPassword;

public class ForgotActivity extends Activity {

private TextView txt_text;
private EditText edit_email;
private Button btn_send;
private Validations valid;

@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot);

valid = new Validations(ForgotActivity.this);

getUI();
setFonts();
clickEvents();
}

private void getUI() {
txt_text = (TextView) findViewById(R.id.txt_forgot_text);
edit_email = (EditText) findViewById(R.id.edit_forgot_email);
btn_send = (Button) findViewById(R.id.btn_forgot_send);
}

private void setFonts() {
txt_text.setTypeface(MyFonts.RobotoMedium(this));
edit_email.setTypeface(MyFonts.RobotoMedium(this));
btn_send.setTypeface(MyFonts.RobotoMedium(this));
}

private void clickEvents() {
btn_send.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
String email = edit_email.getText().toString().trim();

if (!valid.isEmpty(email)) {
Toast.makeText(getApplicationContext(), "Enter Email ID",
Toast.LENGTH_SHORT).show();
} else if (!valid.isValidEmail(email)) {
Toast.makeText(getApplicationContext(),
"Enter Valid Email ID", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "OK",
Toast.LENGTH_SHORT).show();

new ForgotPassword(ForgotActivity.this).execute(email);
}

}
});
}
}

No comments:

Post a Comment