From e92f2c7f5680cf403aa2bd4a59e31e33b0e8b911 Mon Sep 17 00:00:00 2001 From: Veena Date: Tue, 1 Oct 2019 10:34:50 +0530 Subject: [PATCH] Fix #11: Introduce Oppia splash screen. (#60) * created splash screen * changed splash image * added fade transition * handle configuration changes * created background for splashtheme This is to avoid black or white screen when app is launched and resources are not yet initialized * implemented Logging system - Used hyperLog library to store app logs in local file. - Logger class is used to log files in entire application - OppiaApplication class is created to initialize hyperlog * fixed issues * Update misc.xml * Fixed issues - Removed unwanted spaces - Removed wait time during transition - Added Javadoc comment - created background image for splashActivity and it is set to theme. - Added animation to SplashTheme styles. * working on test cases * resoilved conflicts * Update styles.xml * fixed java doc comments * Update activity_splash.xml Changed to framelayout * Fixed issues * uncommented some code * fixed .idea file * writting unit test * Workinh on writting testcase for fragment * Fixing issue with test case * uncommented code * Fixed spacing, rename layout files * working on test case * issue in passing test case * Update SplashFragment.kt * Update SplashFragment.kt * working on testcase * integrated testcase * Delete kotlinc.xml * Update build.gradle * Update AndroidManifest.xml * fixed issues * Fixed testcases * removed unused imports * added comma for dependency * fixed minor issues * added javadoc comments for activitytestrule * removed blank spaces * removed splashFragment as its not used anywhere * Delete splash_fragment.xml * deleted bg_splash * Update build.gradle * removed blank spaces * Update SplashActivityTest.kt * Update SplashActivityTest.kt * Delete AndroidManifest.xml * Update styles.xml * Update SplashActivityTest.kt * Delete output.json * Delete manifest-merger-debug-report.txt * Update SplashActivityTest.kt * Update SplashActivityTest.kt * Update SplashActivityTest.kt * updated manifest * Update AndroidManifest.xml --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 3 ++ .../org/oppia/app/splash/SplashActivity.kt | 22 ++++++++++ app/src/main/res/anim/fade_in.xml | 5 +++ app/src/main/res/anim/fade_out.xml | 6 +++ app/src/main/res/drawable/splash_page.xml | 30 +++++++++++++ app/src/main/res/layout/splash_activity.xml | 10 +++++ app/src/main/res/values/dimens.xml | 3 ++ app/src/main/res/values/styles.xml | 20 +++++++++ .../oppia/app/splash/SplashActivityTest.kt | 43 +++++++++++++++++++ 10 files changed, 143 insertions(+) create mode 100644 app/src/main/java/org/oppia/app/splash/SplashActivity.kt create mode 100644 app/src/main/res/anim/fade_in.xml create mode 100644 app/src/main/res/anim/fade_out.xml create mode 100644 app/src/main/res/drawable/splash_page.xml create mode 100644 app/src/main/res/layout/splash_activity.xml create mode 100644 app/src/sharedTest/java/org/oppia/app/splash/SplashActivityTest.kt diff --git a/app/build.gradle b/app/build.gradle index 64ea16800a2..22479f62151 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -79,6 +79,7 @@ dependencies { 'androidx.test.ext:junit:1.1.1', 'androidx.test:runner:1.2.0', 'com.google.truth:truth:0.43', + 'androidx.test.espresso:espresso-intents:3.1.0', ) androidTestUtil( 'androidx.test:orchestrator:1.2.0', diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e6248d90d9f..d7c9ef442f5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,5 +23,8 @@ + + diff --git a/app/src/main/java/org/oppia/app/splash/SplashActivity.kt b/app/src/main/java/org/oppia/app/splash/SplashActivity.kt new file mode 100644 index 00000000000..cdd6be10f7e --- /dev/null +++ b/app/src/main/java/org/oppia/app/splash/SplashActivity.kt @@ -0,0 +1,22 @@ +package org.oppia.app.splash + +import android.content.Intent +import android.os.Bundle +import android.view.WindowManager +import androidx.appcompat.app.AppCompatActivity +import org.oppia.app.R +import org.oppia.app.home.HomeActivity + +/** An activity that shows a temporary loading page until the app is fully loaded then navigates to [HomeActivity]. */ +class SplashActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.splash_activity) + + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + val intent = Intent(this@SplashActivity, HomeActivity::class.java) + startActivity(intent) + finish() + } +} diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml new file mode 100644 index 00000000000..37b4726f315 --- /dev/null +++ b/app/src/main/res/anim/fade_in.xml @@ -0,0 +1,5 @@ + + diff --git a/app/src/main/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml new file mode 100644 index 00000000000..9dd0951cc63 --- /dev/null +++ b/app/src/main/res/anim/fade_out.xml @@ -0,0 +1,6 @@ + + diff --git a/app/src/main/res/drawable/splash_page.xml b/app/src/main/res/drawable/splash_page.xml new file mode 100644 index 00000000000..96790799d5d --- /dev/null +++ b/app/src/main/res/drawable/splash_page.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/layout/splash_activity.xml b/app/src/main/res/layout/splash_activity.xml new file mode 100644 index 00000000000..a6df0fd332b --- /dev/null +++ b/app/src/main/res/layout/splash_activity.xml @@ -0,0 +1,10 @@ + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 83e6f4fa98a..d9c61be15b7 100755 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,5 +1,8 @@ + 1000 + 1000 + 8dp 32dp 24dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 56954dc831d..f5695ca647d 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -7,6 +7,26 @@ @color/colorPrimary + + + + + + +