Skip to content

Instantly share code, notes, and snippets.

@AlonsoFloo
Created September 19, 2018 10:05
Show Gist options
  • Save AlonsoFloo/f5a1d979e2f2efcb6571a87b1728dd3e to your computer and use it in GitHub Desktop.
Save AlonsoFloo/f5a1d979e2f2efcb6571a87b1728dd3e to your computer and use it in GitHub Desktop.
Android SplashScreen templates
<activity
android:name=".ui.activity.SplashScreenActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/white" />
<item
android:drawable="@drawable/logo"
android:gravity="center" />
</layer-list>
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
/**
* Created by Florian ALONSO
*/
public class SplashScreenActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO : Push notification may be needed here
if (isLogged)
// Show home
else
// Show loggin
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// TODO : Push notification may be needed here
}
}
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/windowBackground</item>
<item name="android:textColorPrimary">@color/white</item>
</style>
<style name="AppTheme.SplashTheme" parent="AppTheme">
<item name="colorPrimaryDark">@color/grey</item>
<item name="android:windowBackground">@drawable/background_splashscreen</item>
<item name="android:navigationBarColor" tools:targetApi="21">@color/transparent</item>
</style>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment