Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@
<activity
android:name=".activity.LoginActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -92,6 +87,17 @@
</intent-filter>
</activity>


<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service android:name=".InstiAppFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/java/app/insti/activity/SplashActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package app.insti.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import app.insti.SessionManager;

public class SplashActivity extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SessionManager session = new SessionManager(this);
Intent intent;

/* Skip inflating login activity if logged in */
if (session.isLoggedIn()) {
intent = new Intent(this, MainActivity.class);
} else {
intent = new Intent(this, LoginActivity.class);
}

startActivity(intent);
finish();
}
}
16 changes: 16 additions & 0 deletions app/src/main/res/drawable/splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@color/colorWhite" />

<item
android:width="400dp"
android:height="800dp"
android:gravity="center">

<bitmap
android:src="@drawable/splash_bg"
android:gravity="fill_horizontal|fill_vertical" />
</item>

</layer-list>
Binary file added app/src/main/res/drawable/splash_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,8 @@
<style name="UserTabsTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">12sp</item>
</style>

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>
</resources>