From 42cb9bea91c813350e80a5358a3ae117dfa053a6 Mon Sep 17 00:00:00 2001 From: teddywilson Date: Mon, 10 Jul 2017 13:14:17 -0400 Subject: [PATCH] splash screen set up, need logo asset --- app/src/main/AndroidManifest.xml | 7 ++- .../spurceexampleapp/SplashActivity.java | 50 +++++++++++++++++++ app/src/main/res/layout/activity_splash.xml | 39 +++++++++++++++ app/src/main/res/values/dimens.xml | 1 + 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/willowtreeapps/spurceexampleapp/SplashActivity.java create mode 100644 app/src/main/res/layout/activity_splash.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 977b992..3eb2bee 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -31,7 +31,7 @@ android:supportsRtl="true" android:theme="@style/AppTheme"> @@ -39,6 +39,11 @@ + + + diff --git a/app/src/main/java/com/willowtreeapps/spurceexampleapp/SplashActivity.java b/app/src/main/java/com/willowtreeapps/spurceexampleapp/SplashActivity.java new file mode 100644 index 0000000..91f31af --- /dev/null +++ b/app/src/main/java/com/willowtreeapps/spurceexampleapp/SplashActivity.java @@ -0,0 +1,50 @@ +/* + * Spruce + * + * Copyright (c) 2017 WillowTree, Inc. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +package com.willowtreeapps.spurceexampleapp; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; + +public class SplashActivity extends AppCompatActivity { + + private static int SPLASH_TIMEOUT = 2000; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash); + + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + startActivity(new Intent(SplashActivity.this, SpruceActivity.class)); + finish(); + } + }, SPLASH_TIMEOUT); + } + +} diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml new file mode 100644 index 0000000..831cd42 --- /dev/null +++ b/app/src/main/res/layout/activity_splash.xml @@ -0,0 +1,39 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index aa568ee..f0351bd 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -24,4 +24,5 @@ 16dp 16dp + 96dp