mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
Can now display splashscreen when first entering the app v.3
This commit is contained in:
parent
8fa081e4b7
commit
85f78e3333
@ -40,6 +40,7 @@
|
||||
<activity android:name="com.example.listify.ui.LoginPage" />
|
||||
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
||||
<activity android:name="com.example.listify.ListPage" />
|
||||
<activity android:name="com.example.listify.SplashActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -2,6 +2,7 @@ package com.example.listify;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -14,12 +15,15 @@ import androidx.navigation.NavController;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.navigation.ui.AppBarConfiguration;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import com.amplifyframework.auth.AuthException;
|
||||
import com.example.listify.data.Item;
|
||||
import com.example.listify.data.ItemSearch;
|
||||
import com.example.listify.data.List;
|
||||
import com.example.listify.data.ListEntry;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import static com.example.listify.SplashActivity.showSplash;
|
||||
|
||||
import org.json.JSONException;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
@ -29,13 +33,25 @@ import java.util.Random;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements CreateListDialogFragment.OnNewListListener {
|
||||
private AppBarConfiguration mAppBarConfiguration;
|
||||
|
||||
public static AuthManager am = new AuthManager();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(showSplash) {
|
||||
showSplash = false;
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Intent intent = new Intent(MainActivity.this, SplashActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------Auth Testing---------------------------------------------//
|
||||
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.example.listify;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
public static boolean showSplash = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_splashscreen);
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showSplash = false;
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user