Browse Source

Guest now works

pull/24/head
Ezerous 8 years ago
parent
commit
9f5be88049
  1. 4
      app/build.gradle
  2. 14
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

4
app/build.gradle

@ -8,8 +8,8 @@ android {
applicationId "gr.thmmy.mthmmy" applicationId "gr.thmmy.mthmmy"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 25 targetSdkVersion 25
versionCode 1 versionCode 2
versionName "0.14" versionName "0.15"
} }
buildTypes { buildTypes {
release { release {

14
app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

@ -22,6 +22,7 @@ import static gr.thmmy.mthmmy.utils.Thmmy.login;
public class LoginActivity extends BaseActivity { public class LoginActivity extends BaseActivity {
private static final String TAG = "LoginActivity"; private static final String TAG = "LoginActivity";
private static boolean passed=false; //becomes true after (guest) login - to redirect to Main
private EditText inputUsername; private EditText inputUsername;
private EditText inputPassword; private EditText inputPassword;
Button btnLogin; Button btnLogin;
@ -29,6 +30,12 @@ public class LoginActivity extends BaseActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
if(passed) //redirect to MainActivity if user passed this one at least once
{
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
@ -61,7 +68,11 @@ public class LoginActivity extends BaseActivity {
btnGuest.setOnClickListener(new View.OnClickListener() { btnGuest.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
//TO-DO Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
passed=true;
finish();
overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
} }
}); });
} }
@ -134,6 +145,7 @@ public class LoginActivity extends BaseActivity {
.show(); .show();
Intent intent = new Intent(LoginActivity.this, MainActivity.class); Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent); startActivity(intent);
passed=true;
finish(); finish();
overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
break; break;

Loading…
Cancel
Save