|
|
@ -6,7 +6,9 @@ import android.content.Intent; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.Button; |
|
|
|
import android.widget.EditText; |
|
|
|
import android.widget.ImageButton; |
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
import ru.visionlab.femdemo.CheckInActivity; |
|
|
|
import ru.visionlab.femdemo.R; |
|
|
@ -18,18 +20,37 @@ public class LoginActivityNew extends AppCompatActivity { |
|
|
|
|
|
|
|
ImageButton back; |
|
|
|
|
|
|
|
EditText edt_empId,edt_pass; |
|
|
|
String empId = "", pass = ""; |
|
|
|
|
|
|
|
boolean isAllFieldsChecked = false; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
setContentView(R.layout.activity_login_new); |
|
|
|
|
|
|
|
edt_empId = findViewById(R.id.edt_empId); |
|
|
|
edt_pass = findViewById(R.id.edt_pass); |
|
|
|
|
|
|
|
empId = edt_empId.getText().toString().trim(); |
|
|
|
pass = edt_pass.getText().toString().trim(); |
|
|
|
|
|
|
|
System.out.println("value of emp and pass " + empId + " " + pass); |
|
|
|
|
|
|
|
btnSignin = findViewById(R.id.btnSignin); |
|
|
|
|
|
|
|
btnSignin.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
Intent intent = new Intent(LoginActivityNew.this, CheckInActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
|
|
|
|
isAllFieldsChecked = CheckAllFields(); |
|
|
|
if(isAllFieldsChecked) { |
|
|
|
Intent intent = new Intent(LoginActivityNew.this, CheckInActivity.class); |
|
|
|
startActivity(intent); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
@ -41,5 +62,22 @@ public class LoginActivityNew extends AppCompatActivity { |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean CheckAllFields() { |
|
|
|
if (edt_empId.length() == 0) { |
|
|
|
edt_empId.setError("This field is required"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (edt_pass.length() == 0) { |
|
|
|
edt_pass.setError("This field is required"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// after all validation return true. |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |