Beruflich Dokumente
Kultur Dokumente
First application is created for user, in which the user creates an account and details
about the user are saved. Using this detail and unique QR code is generated. This application
contains digital wallet, so the user should transfer required money from their bank account to
digital wallet before they travel in bus. After registration, passenger gets a contact-less smart
card through which digital payment done.
Another feature of this application is user can able to apply for bus pass and can pay
required amount through digital wallet. The bus pass information is stored in QR code, so the
conductor can easily scan and verify the user details. A POS application is created for
conductor. This application is used to generate ticket with insurance and accept digital
payment
Conductor
The conductor should enter source and destination place of the passenger. Then
passenger should provide contactless smart card to conduit. The conductor places the card at
the machine to make payment. The payment details and E-ticket with insurance is sending to
passenger application. At the same time the passenger detail is update to administrator.
Administrator
The application is created for administrator who can able to manage overall operation
of this system. According to travel history of passenger he can able to manage buses. This
reduces the rush in bus for specific route.
Claim form
This form enabled with user application, a claim form is a formal written request to
the government, an insurance company, or another organization for money that you think
you are entitled to according to their rules.
Architecture
Sequence Diagram
Activity Diagram
E – R Diagram
package com.example.businsurance.ui.activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.businsurance.R;
import com.example.businsurance.model.UserData;
import com.example.businsurance.utils.CommonUtils;
import com.example.businsurance.utils.DatabaseUtils;
import com.example.businsurance.utils.LogUtils;
import com.example.businsurance.utils.PreferenceUtils;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import butterknife.BindView;
import butterknife.ButterKnife;
@BindView(R.id.til_username)
TextInputLayout til_username;
@BindView(R.id.til_password)
TextInputLayout til_password;
@BindView(R.id.ed_username)
EditText ed_user_name;
@BindView(R.id.ed_password)
EditText ed_password;
@BindView(R.id.btn_login)
Button btn_login;
@BindView(R.id.llay_forget_password)
LinearLayout llay_forget_password;
@BindView(R.id.llay_register)
LinearLayout llay_register;
@BindView(R.id.tv_new_user)
TextView tv_new_user;
Dialog dialog;
FirebaseStorage storage;
int REQUEST_ID_STORAGE_PERMISSIONS=1;
Context context;
SharedPreferences prefs;
FirebaseDatabase database;
Bitmap bmSelected;
int LOGIN_TYPE=USER_LOGIN;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_screen);
try{
getSupportActionBar().hide();
ButterKnife.bind(this);
context = this;
database = FirebaseDatabase.getInstance();
storage=FirebaseStorage.getInstance();
tv_new_user.setPaintFlags(tv_new_user.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG);
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
try{
if(LOGIN_TYPE==USER_LOGIN){
String strUserName = ed_user_name.getText().toString().trim();
if (strUserName.length() == 12&&strPassword.length()>0 ) {
loginRequest(strUserName, strPassword);
} else {
if (strUserName.length() !=12) {
til_username.setError(getResources().getString(R.string.id_validation_field)
);
if (strPassword.length() == 0) {
til_password.setError(getResources().getString(R.string.empty_validation_fiel
d));
}else{
if(strUserName.equals("admin")&&strPassword.equals("admin@123")){
PreferenceUtils.saveBoolean(PreferenceUtils.LOGIN_STATUS,true,pref
s);
PreferenceUtils.saveText(PreferenceUtils.USER_ID,"admin",prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_CODE,"admin",prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_NAME,"Admin",prefs);
String
strFcmToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);
sendFCMToken(strFcmToken,"admin");
CommonUtils.goNextScreen(LoginScreen.this, HomeScreen.class);
finish();
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalid
Credentials),context);
} else {
if (strUserName.length() ==0) {
til_username.setError(getResources().getString(R.string.empty_validation_f
ield));
if (strPassword.length() == 0) {
til_password.setError(getResources().getString(R.string.empty_validation_fiel
d));
LogUtils.printException(e);
}
}
});
// llay_forget_password.setOnClickListener(new View.OnClickListener() {
// @Override
// try{
// CommonUtils.goNextScreen(LoginScreen.this, ForgetPasswordScreen.class);
// LogUtils.printException(e);
// }
//
// }
// });
llay_register.setOnClickListener(new View.OnClickListener() {
@Override
try{
startActivity(i);
LogUtils.printException(e);
}
});
boolean isLogin=prefs.getBoolean(PreferenceUtils.LOGIN_STATUS,false);
if(isLogin){
String nUserType=prefs.getString(PreferenceUtils.USER_TYPE,null);
CommonUtils.goNextScreen(LoginScreen.this,HomeScreen.class);
finish();
LogUtils.printException(e);
/**
*/
try{
Query query=myRef.orderByChild("aadhar").equalTo(strUsername);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
UserData bd = issue.getValue(UserData.class);
if(bd!=null){
if(bd.getAadhar().equals(strUsername)&&bd.getPassword().equals(strPas
sword)){
PreferenceUtils.saveBoolean(PreferenceUtils.LOGIN_STATUS,true,p
refs);
PreferenceUtils.saveText(PreferenceUtils.USER_ID,bd.getId(),prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_CODE,strUsername,
prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_NAME,bd.getName(
),prefs);
PreferenceUtils.saveText(PreferenceUtils.ACCOUNT,
bd.getAadhar(),prefs);
PreferenceUtils.saveText(PreferenceUtils.MOBILE,bd.getMobile(),pre
fs);
PreferenceUtils.saveText(PreferenceUtils.CITY,bd.getCity(),prefs);
String
strFcmToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);
sendFCMToken(strFcmToken,bd.getId());
CommonUtils.goNextScreen(LoginScreen.this, HomeScreen.class);
finish();
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.inval
idCredentials),context);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalid
Credentials),context);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCrede
ntials),context);
@Override
public void onCancelled(DatabaseError databaseError) {
});
LogUtils.printException(e);
try {
myRef.child("fcmToken").setValue(fcmtoken);
LogUtils.printException(e);
}
@Override
try{
//
if(requestCode==REQUEST_ID_STORAGE_PERMISSIONS&&grantResults[0]==
PackageManager.PERMISSION_GRANTED){
// intent.setType("image/*");
// intent.setAction(Intent.ACTION_GET_CONTENT);
// }
LogUtils.printException(e);
@Override
}
}package com.example.businsurance.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.example.businsurance.R;
import com.example.businsurance.model.UserData;
import com.example.businsurance.utils.CommonUtils;
import com.example.businsurance.utils.DatabaseUtils;
import com.example.businsurance.utils.LogUtils;
import com.example.businsurance.utils.PreferenceUtils;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import butterknife.BindView;
import butterknife.ButterKnife;
Context context;
SharedPreferences prefs;
@BindView(R.id.til_name)
TextInputLayout til_name;
@BindView(R.id.ed_name)
EditText ed_name;
@BindView(R.id.til_mobile)
TextInputLayout til_mobile;
@BindView(R.id.ed_mobile)
EditText ed_mobile;
@BindView(R.id.til_password)
TextInputLayout til_password;
@BindView(R.id.ed_password)
EditText ed_password;
@BindView(R.id.til_id)
TextInputLayout til_id;
@BindView(R.id.ed_id)
EditText ed_id;
@BindView(R.id.til_city)
TextInputLayout til_city;
@BindView(R.id.ed_city)
EditText ed_city;
@BindView(R.id.btn_register)
Button btnRegister;
FirebaseDatabase database;
int isMobileNumberAvailable=0;
int isAccountAvailable=0;
long createdTime=0;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration_screen);
try{
ButterKnife.bind(this);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context=this;
prefs=getSharedPreferences(PreferenceUtils.PREF_NAME,MODE_PRIVATE);
database = FirebaseDatabase.getInstance();
getSupportActionBar().setTitle(getResources().getString(R.string.sign_up));
btnRegister.setText(getResources().getString(R.string.sign_up));
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
try{
if (strId.length()==12&&isAccountAvailable==0&&strName.length() > 0
&& strMobile.length() > 0&&isMobileNumberAvailable==0 && strMobile.length()==10
&&strPassword.length()>0&&CommonUtils.isValidPassword(strPassword)&&strCity.length
()>0) {
registerRequest(strId,strName,strMobile,strPassword,strCity);
} else {
if (strName.length() == 0) {
til_name.setError(getResources().getString(R.string.empty_validation_fie
ld));
if (strCity.length() == 0) {
til_city.setError(getResources().getString(R.string.empty_validation_fiel
d));
if (strId.length() != 12) {
til_id.setError(getResources().getString(R.string.id_validation_field));
}else if(isAccountAvailable==1){
til_id.setError(getResources().getString(R.string.alreadyExist));
}
if (strMobile.length() == 0) {
til_mobile.setError(getResources().getString(R.string.empty_validation_f
ield));
}else if(strMobile.length()!=10 ){
til_mobile.setError(getResources().getString(R.string.valid_mobile));
}else if(isMobileNumberAvailable==1){
til_mobile.setError(getResources().getString(R.string.mobile_already_exi
st));
if (strPassword.length() == 0) {
til_password.setError(getResources().getString(R.string.empty_validation
_field));
}else if(!CommonUtils.isValidPassword(strPassword)){
til_password.setError(getResources().getString(R.string.valid_password_
error));
LogUtils.printException(e);
});
ed_mobile.addTextChangedListener(new TextWatcher() {
@Override
@Override
if(CommonUtils.isValid(ed_mobile)){
til_mobile.setError(null);
handler.removeCallbacks(runnableMobile);
handler.postDelayed(runnableMobile,CommonUtils.EDITBOX_DELAY);
@Override
});
ed_id.addTextChangedListener(new TextWatcher() {
@Override
@Override
til_id.setError(null);
handler.removeCallbacks(runnableAccountId);
handler.postDelayed(runnableAccountId,CommonUtils.EDITBOX_DELAY);
@Override
});
CommonUtils.initTextChangeEvent(ed_name,til_name);
// CommonUtils.initTextChangeEvent(ed_countrycode,til_countrycode);
CommonUtils.initTextChangeEvent(ed_password,til_password);
LogUtils.printException(e);
try{
String strMobile=ed_mobile.getText().toString().trim();
if(CommonUtils.isValidMobile(strMobile)){
checkMobileNumberExist();
}else{
til_mobile.setError(getResources().getString(R.string.valid_mobile));
LogUtils.printException(e);
};
@Override
try{
String strId=ed_id.getText().toString().trim();
if(strId.length()==12){
checkAccountIdExist();
}else{
til_id.setError(getResources().getString(R.string.id_validation_field));
}
}catch (Exception e){
LogUtils.printException(e);
};
try {
isMobileNumberAvailable=0;
Query query=myRef.orderByChild("mobile").equalTo(strMobile);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
// CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
UserData bd = issue.getValue(UserData.class);
if(bd!=null){
if(bd.getMobile()!=null&&bd.getMobile().equals(strMobile)){
isMobileNumberAvailable=1;
til_mobile.setError(getResources().getString(R.string.mobile_alread
y_exist));
}else{
}else{
}else{
@Override
});
} catch (Exception e) {
LogUtils.printException(e);
}
try {
isAccountAvailable=0;
Query query=myRef.orderByChild("aadhar").equalTo(strAccountId);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
// CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
UserData bd = issue.getValue(UserData.class);
if(bd!=null){
if(bd.getAadhar()!=null&&bd.getAadhar().equals(strAccountId)){
isAccountAvailable=1;
til_id.setError(getResources().getString(R.string.alreadyExist));
}else{
}else{
}else{
@Override
});
} catch (Exception e) {
LogUtils.printException(e);
}
@Override
switch (item.getItemId()) {
case android.R.id.home:
goBack();
return true;
return super.onOptionsItemSelected(item);
/**
*/
try{
finish();
LogUtils.printException(e);
@Override
try{
if (keyCode == KeyEvent.KEYCODE_BACK) {
goBack();
return true;
LogUtils.printException(e);
@Override
super.onPause();
@Override
super.onResume();
@Override
LogUtils.printException(e);
/**
*/
private void registerRequest(final String strId, String strName, final String strMobile,
String strPwd, String strCity){
try {
String id=myRef.push().getKey();
if(createdTime==0){
createdTime=modifiedTime;
String strFCMToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);
UserData bd=new
UserData(id,strId,strName,strMobile,strPwd,strFCMToken,strCity,createdTime,modifiedTim
e);
CommonUtils.showProgress(context);
myRef.child(id).setValue(bd).addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
CommonUtils.hideProgress();
CommonUtils.showSuccessToast(getResources().getString(R.string.saveSuccess
),context);
goBack();
}).addOnFailureListener(new OnFailureListener() {
@Override
CommonUtils.hideProgress();
});
LogUtils.printException(e);
}
}
@Override