diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java index feaf1b7..2a6d124 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java @@ -157,6 +157,9 @@ public class CheckInActivity extends AppCompatActivity { @Override public void onClick(View view) { + SharedPreferences.Editor editor = shared.edit(); + editor.putBoolean("IsUserLogin",false); + editor.commit(); Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class); startActivity(intent); @@ -186,6 +189,10 @@ public class CheckInActivity extends AppCompatActivity { popup_log_out.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + SharedPreferences.Editor editor = shared.edit(); + editor.putBoolean("IsUserLogin",false); + editor.commit(); + Intent intent = new Intent(CheckInActivity.this, LoginActivityNew.class); startActivity(intent); finish(); diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/Splashactivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/Splashactivity.java index 5131472..21e0e57 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/Splashactivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/Splashactivity.java @@ -10,8 +10,10 @@ import android.os.Handler; import android.view.WindowManager; import cn.pedant.SweetAlert.SweetAlertDialog; +import ru.visionlab.femdemo.authentication.AuthSuccessActivity; import ru.visionlab.femdemo.login.LoginActivity; import ru.visionlab.femdemo.login.LoginActivityNew; +import ru.visionlab.femdemo.register.RegisterActivity; public class Splashactivity extends AppCompatActivity { @@ -29,26 +31,20 @@ public class Splashactivity extends AppCompatActivity { // creating a new intent SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE); boolean loggedBefore = sharedPreferences.getBoolean("loggedBefore",false); + boolean IsUserLogin = sharedPreferences.getBoolean("IsUserLogin",false); - System.out.println("Value of loggedBefore "+ loggedBefore); - - if(loggedBefore){ + if(!IsUserLogin){ Intent i = new Intent(Splashactivity.this, LoginActivity.class); startActivity(i); + finish(); } 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(); + final Intent intent = new Intent(Splashactivity.this, CheckInActivity.class); + intent.putExtra("FromRegister", true); + intent.putExtra("checkinButtonFromRegister", true); + startActivity(intent); + finish(); } - - } }, 2000); } diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java index 87114a8..ffd44d3 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivity.java @@ -106,6 +106,7 @@ public class LoginActivity extends BaseActivity { public void onClick(View view) { Intent intent = new Intent(LoginActivity.this,LoginActivityNew.class); startActivity(intent); + finish(); } }); reg_new = findViewById(R.id.reg_new); @@ -114,6 +115,7 @@ public class LoginActivity extends BaseActivity { public void onClick(View view) { Intent intent = new Intent(LoginActivity.this, RegisterActivityNew.class); startActivity(intent); + finish(); } }); diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java index f79821c..8a1fbd4 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/login/LoginActivityNew.java @@ -557,7 +557,6 @@ public class LoginActivityNew extends AppCompatActivity { if(statuscode.equals("200")) { -// preferences.setUsername(username); SharedPreferences.Editor editor = shared.edit(); editor.putString("RegisterUser",username); editor.putString("Employeeid",_employeeid); diff --git a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java index c3ae7be..e93c0b1 100644 --- a/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java +++ b/examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/register/RegisterActivity.java @@ -118,7 +118,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen private boolean goingSomewhere = false; String valueFromApiCheckIn; - + SharedPreferences shared; @SuppressLint("MissingInflatedId") @@ -131,9 +131,9 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen //ButterKnife.bind(this); setToolbar(); - SharedPreferences sharedPreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE); - String login = sharedPreferences.getString("login",""); - String Descriptor = sharedPreferences.getString("Descriptor",""); + shared = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE); + String login = shared.getString("login",""); + String Descriptor = shared.getString("Descriptor",""); System.out.println("Value of login and Descriptor " + preferences.getUsername()+" "); Intent intent = getIntent(); @@ -584,12 +584,13 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen } private void showSuccess() { + SharedPreferences.Editor editor = shared.edit(); + editor.putBoolean("IsUserLogin",true); + editor.commit(); + final Intent intent = new Intent(RegisterActivity.this, CheckInActivity.class); intent.putExtra(AuthSuccessActivity.LOGIN, login); - System.out.println("login value "+ login); - - if (BuildConfig.IS_OFFLINE_VERSION) { intent.putExtra(AuthSuccessActivity.TIME, (int) (((double) (verifEndTime - verifStartTime)) / 1e6)); intent.putExtra("FromRegister", true); @@ -597,9 +598,7 @@ public class RegisterActivity extends ToolbarActivity implements RegisterFragmen intent.putExtra("valueFromApiCheckIn", valueFromApiCheckIn); intent.putExtra("UserName", login); } - startActivity(intent); - finish(); /*if (checkinButton) {