Remove splash screen activity from sample app

Summary: The yoga splash screen that runs at the beginning of the app is unnecessary and can be removed for simplicty.

Reviewed By: emilsjolander

Differential Revision: D4571624

fbshipit-source-id: 3eb12f7c3447805f4546bd192df9670c5427572a
This commit is contained in:
Robert Spencer
2017-02-16 02:40:58 -08:00
committed by Facebook Github Bot
parent 2199a7908d
commit fbd692c449
5 changed files with 4 additions and 91 deletions

View File

@@ -30,21 +30,16 @@
>
<activity
android:name=".SplashScreenActivity"
android:name=".MainActivity"
android:exported="true"
android:theme="@style/AppFullScreenTheme"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="false"
/>
</activity>
</application>

View File

@@ -13,6 +13,7 @@ import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import com.facebook.samples.yoga.R;
import com.facebook.soloader.SoLoader;
import com.facebook.yoga.android.YogaViewLayoutFactory;
/**
@@ -26,6 +27,7 @@ public class MainActivity extends ActionBarActivity {
public void onCreate(Bundle savedInstanceState) {
LayoutInflater.from(this).setFactory(YogaViewLayoutFactory.getInstance());
super.onCreate(savedInstanceState);
SoLoader.init(this, false);
setContentView(R.layout.main_layout);
}

View File

@@ -1,50 +0,0 @@
/**
* Copyright 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE-examples file in the root directory of this source tree.
*/
package com.facebook.samples.yoga;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import com.facebook.samples.yoga.R;
import com.facebook.soloader.SoLoader;
import com.facebook.yoga.android.YogaViewLayoutFactory;
/**
* A (non-interactive) splash screen. Displays for two seconds before calling the main activity.
*/
public class SplashScreenActivity extends ActionBarActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
LayoutInflater.from(this).setFactory(YogaViewLayoutFactory.getInstance());
super.onCreate(savedInstanceState);
SoLoader.init(this, false);
setContentView(R.layout.splash_layout);
new Handler(Looper.getMainLooper()).postDelayed(
new Runnable() {
@Override
public void run() {
startMainActivity();
}
},
2000);
}
private void startMainActivity() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
this.finish();
}
}

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2014-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the license found in the
LICENSE-examples file in the root directory of this source tree.
-->
<YogaLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/yoga_grey"
yoga:align_items="center"
yoga:justify_content="center"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
yoga:height="200dp"
yoga:aspect_ratio="1"
/>
</YogaLayout>

View File

@@ -20,11 +20,4 @@
<style name="MyTitleText" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/yoga_blue</item>
</style>
<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>