32 lines
955 B
Java
32 lines
955 B
Java
package com.iamthefij.otbeta;
|
|
|
|
import android.content.Intent;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.os.Bundle;
|
|
|
|
import java.net.HttpCookie;
|
|
import java.util.List;
|
|
|
|
public class SplashActivity extends AppCompatActivity {
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_splash);
|
|
|
|
// Check for existing cookies
|
|
PersistentCookieStore cookieStore = new PersistentCookieStore(this);
|
|
List<HttpCookie> cookies = cookieStore.getCookies();
|
|
|
|
// Set next intent based on existing cookies
|
|
Intent nextIntent;
|
|
if (cookies.isEmpty()) {
|
|
nextIntent = new Intent(SplashActivity.this, LoginActivity.class);
|
|
} else {
|
|
nextIntent = new Intent(SplashActivity.this, WorkoutListActivity.class);
|
|
}
|
|
startActivity(nextIntent);
|
|
finish();
|
|
}
|
|
}
|