Auto logout process handled
This commit is contained in:
		
							parent
							
								
									bf299f8dfc
								
							
						
					
					
						commit
						0ede79cbe7
					
				@ -157,6 +157,9 @@ public class CheckInActivity extends AppCompatActivity {
 | 
				
			|||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void onClick(View view) {
 | 
					            public void onClick(View view) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                SharedPreferences.Editor editor = shared.edit();
 | 
				
			||||||
 | 
					                editor.putBoolean("IsUserLogin",false);
 | 
				
			||||||
 | 
					                editor.commit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class);
 | 
					                Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class);
 | 
				
			||||||
                startActivity(intent);
 | 
					                startActivity(intent);
 | 
				
			||||||
@ -186,6 +189,10 @@ public class CheckInActivity extends AppCompatActivity {
 | 
				
			|||||||
                popup_log_out.setOnClickListener(new View.OnClickListener() {
 | 
					                popup_log_out.setOnClickListener(new View.OnClickListener() {
 | 
				
			||||||
                    @Override
 | 
					                    @Override
 | 
				
			||||||
                    public void onClick(View view) {
 | 
					                    public void onClick(View view) {
 | 
				
			||||||
 | 
					                        SharedPreferences.Editor editor = shared.edit();
 | 
				
			||||||
 | 
					                        editor.putBoolean("IsUserLogin",false);
 | 
				
			||||||
 | 
					                        editor.commit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class);
 | 
					                        Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class);
 | 
				
			||||||
                        startActivity(intent);
 | 
					                        startActivity(intent);
 | 
				
			||||||
                        finish();
 | 
					                        finish();
 | 
				
			||||||
 | 
				
			|||||||
@ -10,8 +10,10 @@ import android.os.Handler;
 | 
				
			|||||||
import android.view.WindowManager;
 | 
					import android.view.WindowManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import cn.pedant.SweetAlert.SweetAlertDialog;
 | 
					import cn.pedant.SweetAlert.SweetAlertDialog;
 | 
				
			||||||
 | 
					import ru.visionlab.femdemo.authentication.AuthSuccessActivity;
 | 
				
			||||||
import ru.visionlab.femdemo.login.LoginActivity;
 | 
					import ru.visionlab.femdemo.login.LoginActivity;
 | 
				
			||||||
import ru.visionlab.femdemo.login.LoginActivityNew;
 | 
					import ru.visionlab.femdemo.login.LoginActivityNew;
 | 
				
			||||||
 | 
					import ru.visionlab.femdemo.register.RegisterActivity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Splashactivity extends AppCompatActivity {
 | 
					public class Splashactivity extends AppCompatActivity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -29,26 +31,20 @@ public class Splashactivity extends AppCompatActivity {
 | 
				
			|||||||
                // creating a new intent
 | 
					                // creating a new intent
 | 
				
			||||||
                SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
 | 
					                SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
 | 
				
			||||||
                boolean loggedBefore = sharedPreferences.getBoolean("loggedBefore",false);
 | 
					                boolean loggedBefore = sharedPreferences.getBoolean("loggedBefore",false);
 | 
				
			||||||
 | 
					                boolean IsUserLogin = sharedPreferences.getBoolean("IsUserLogin",false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                System.out.println("Value of loggedBefore "+ loggedBefore);
 | 
					                if(!IsUserLogin){
 | 
				
			||||||
 | 
					 | 
				
			||||||
                if(loggedBefore){
 | 
					 | 
				
			||||||
                    Intent i = new Intent(Splashactivity.this, LoginActivity.class);
 | 
					                    Intent i = new Intent(Splashactivity.this, LoginActivity.class);
 | 
				
			||||||
                    startActivity(i);
 | 
					                    startActivity(i);
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                else {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    Intent i = new Intent(Splashactivity.this, LoginActivity.class);                    // on below line we are
 | 
					 | 
				
			||||||
                    // starting a new activity.
 | 
					 | 
				
			||||||
                    startActivity(i);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    // on the below line we are finishing
 | 
					 | 
				
			||||||
                    // our current activity.
 | 
					 | 
				
			||||||
                    finish();
 | 
					                    finish();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                else {
 | 
				
			||||||
 | 
					                    final Intent intent = new Intent(Splashactivity.this, CheckInActivity.class);
 | 
				
			||||||
 | 
					                        intent.putExtra("FromRegister", true);
 | 
				
			||||||
 | 
					                        intent.putExtra("checkinButtonFromRegister", true);
 | 
				
			||||||
 | 
					                        startActivity(intent);
 | 
				
			||||||
 | 
					                        finish();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }, 2000);
 | 
					        }, 2000);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -106,6 +106,7 @@ public class LoginActivity extends BaseActivity {
 | 
				
			|||||||
            public void onClick(View view) {
 | 
					            public void onClick(View view) {
 | 
				
			||||||
                Intent intent = new Intent(LoginActivity.this,LoginActivityNew.class);
 | 
					                Intent intent = new Intent(LoginActivity.this,LoginActivityNew.class);
 | 
				
			||||||
                startActivity(intent);
 | 
					                startActivity(intent);
 | 
				
			||||||
 | 
					                finish();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        reg_new = findViewById(R.id.reg_new);
 | 
					        reg_new = findViewById(R.id.reg_new);
 | 
				
			||||||
@ -114,6 +115,7 @@ public class LoginActivity extends BaseActivity {
 | 
				
			|||||||
            public void onClick(View view) {
 | 
					            public void onClick(View view) {
 | 
				
			||||||
                Intent intent = new Intent(LoginActivity.this, RegisterActivityNew.class);
 | 
					                Intent intent = new Intent(LoginActivity.this, RegisterActivityNew.class);
 | 
				
			||||||
                startActivity(intent);
 | 
					                startActivity(intent);
 | 
				
			||||||
 | 
					                finish();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -557,7 +557,6 @@ public class LoginActivityNew extends AppCompatActivity {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    if(statuscode.equals("200"))
 | 
					                    if(statuscode.equals("200"))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
//                        preferences.setUsername(username);
 | 
					 | 
				
			||||||
                        SharedPreferences.Editor editor = shared.edit();
 | 
					                        SharedPreferences.Editor editor = shared.edit();
 | 
				
			||||||
                        editor.putString("RegisterUser",username);
 | 
					                        editor.putString("RegisterUser",username);
 | 
				
			||||||
                        editor.putString("Employeeid",_employeeid);
 | 
					                        editor.putString("Employeeid",_employeeid);
 | 
				
			||||||
 | 
				
			|||||||
@ -118,7 +118,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
 | 
				
			|||||||
    private boolean goingSomewhere = false;
 | 
					    private boolean goingSomewhere = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    String valueFromApiCheckIn;
 | 
					    String valueFromApiCheckIn;
 | 
				
			||||||
 | 
					      SharedPreferences shared;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @SuppressLint("MissingInflatedId")
 | 
					    @SuppressLint("MissingInflatedId")
 | 
				
			||||||
@ -131,9 +131,9 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
 | 
				
			|||||||
        //ButterKnife.bind(this);
 | 
					        //ButterKnife.bind(this);
 | 
				
			||||||
        setToolbar();
 | 
					        setToolbar();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
 | 
					        shared = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
 | 
				
			||||||
        String login = sharedPreferences.getString("login","");
 | 
					        String login = shared.getString("login","");
 | 
				
			||||||
        String Descriptor = sharedPreferences.getString("Descriptor","");
 | 
					        String Descriptor = shared.getString("Descriptor","");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        System.out.println("Value of login and Descriptor " + preferences.getUsername()+" ");
 | 
					        System.out.println("Value of login and Descriptor " + preferences.getUsername()+" ");
 | 
				
			||||||
        Intent intent = getIntent();
 | 
					        Intent intent = getIntent();
 | 
				
			||||||
@ -584,12 +584,13 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    private void showSuccess() {
 | 
					    private void showSuccess() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        SharedPreferences.Editor editor = shared.edit();
 | 
				
			||||||
 | 
					        editor.putBoolean("IsUserLogin",true);
 | 
				
			||||||
 | 
					        editor.commit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        final Intent intent = new Intent(RegisterActivity.this, CheckInActivity.class);
 | 
					        final Intent intent = new Intent(RegisterActivity.this, CheckInActivity.class);
 | 
				
			||||||
        intent.putExtra(AuthSuccessActivity.LOGIN, login);
 | 
					        intent.putExtra(AuthSuccessActivity.LOGIN, login);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        System.out.println("login value "+ login);
 | 
					        System.out.println("login value "+ login);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (BuildConfig.IS_OFFLINE_VERSION) {
 | 
					        if (BuildConfig.IS_OFFLINE_VERSION) {
 | 
				
			||||||
            intent.putExtra(AuthSuccessActivity.TIME, (int) (((double) (verifEndTime - verifStartTime)) / 1e6));
 | 
					            intent.putExtra(AuthSuccessActivity.TIME, (int) (((double) (verifEndTime - verifStartTime)) / 1e6));
 | 
				
			||||||
            intent.putExtra("FromRegister", true);
 | 
					            intent.putExtra("FromRegister", true);
 | 
				
			||||||
@ -597,9 +598,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen
 | 
				
			|||||||
            intent.putExtra("valueFromApiCheckIn", valueFromApiCheckIn);
 | 
					            intent.putExtra("valueFromApiCheckIn", valueFromApiCheckIn);
 | 
				
			||||||
            intent.putExtra("UserName", login);
 | 
					            intent.putExtra("UserName", login);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        startActivity(intent);
 | 
					        startActivity(intent);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        finish();
 | 
					        finish();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*if (checkinButton) {
 | 
					        /*if (checkinButton) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user