diff --git a/sample/src/androidTest/kotlin/com/natura/android/sample/SplashScreenFunctionalTests.kt b/sample/src/androidTest/kotlin/com/natura/android/sample/SplashScreenFunctionalTests.kt new file mode 100644 index 000000000..f6c3ee236 --- /dev/null +++ b/sample/src/androidTest/kotlin/com/natura/android/sample/SplashScreenFunctionalTests.kt @@ -0,0 +1,32 @@ +package com.natura.android.sample + +import androidx.test.core.app.ActivityScenario +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.matcher.ViewMatchers.withId +import androidx.test.espresso.matcher.ViewMatchers.withText +import androidx.test.espresso.matcher.ViewMatchers.isDisplayed +import androidx.test.ext.junit.runners.AndroidJUnit4 +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class SplashScreenFunctionalTests { + @Before + fun setup() { + ActivityScenario.launch(SplashActivity::class.java) + } + + @Test + fun shouldOpenBorderRadiusScreenWhenTapOnItButton() { + onView(withText("NATDS")) + .check(matches(isDisplayed())) + + onView(withText("Natura Design System")) + .check(matches(isDisplayed())) + + onView(withId(R.id.naturaCoLogo)) + .check(matches(isDisplayed())) + } +} diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 8172ba5cd..83554427b 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -12,14 +12,15 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.AppCompat.Light"> - - + - + + android:theme="@style/Theme.Natura" /> + android:theme="@style/Theme.AppCompat" /> + android:theme="@style/Theme.Natura" /> @@ -96,8 +97,7 @@ android:name=".components.ExpansionPanelActivity" android:theme="@style/Theme.Natura" /> - + \ No newline at end of file diff --git a/sample/src/main/java/com/natura/android/sample/SplashActivity.kt b/sample/src/main/java/com/natura/android/sample/SplashActivity.kt new file mode 100644 index 000000000..6930f66d2 --- /dev/null +++ b/sample/src/main/java/com/natura/android/sample/SplashActivity.kt @@ -0,0 +1,47 @@ +package com.natura.android.sample + +import android.content.Intent +import android.os.Bundle +import android.os.Handler +import android.view.animation.AccelerateInterpolator +import android.view.animation.AlphaAnimation +import androidx.appcompat.app.AppCompatActivity +import kotlinx.android.synthetic.main.activity_splash.* + +class SplashActivity : AppCompatActivity() { + lateinit var mDelayHandler: Handler + + private val mRunnable: Runnable = Runnable { + if (!isFinishing) { + val intent = Intent(applicationContext, BrandSelectorActivity::class.java) + startActivity(intent) + finish() + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_splash) + + val fadeIn = AlphaAnimation(0f, 1f) + fadeIn.interpolator = AccelerateInterpolator() + fadeIn.duration = 2000 + + splashContainer.apply { + animation = fadeIn + } + + mDelayHandler = Handler() + + mDelayHandler?.postDelayed(mRunnable, SPLASH_DELAY) + } + + public override fun onDestroy() { + mDelayHandler?.removeCallbacks(mRunnable) + super.onDestroy() + } + + companion object { + private const val SPLASH_DELAY: Long = 3000 + } +} diff --git a/sample/src/main/res/drawable/logo_natura_co.xml b/sample/src/main/res/drawable/logo_natura_co.xml new file mode 100644 index 000000000..52b93aff3 --- /dev/null +++ b/sample/src/main/res/drawable/logo_natura_co.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/sample/src/main/res/drawable/splash_full_background.webp b/sample/src/main/res/drawable/splash_full_background.webp new file mode 100644 index 000000000..dd5ea4ba8 Binary files /dev/null and b/sample/src/main/res/drawable/splash_full_background.webp differ diff --git a/sample/src/main/res/layout/activity_splash.xml b/sample/src/main/res/layout/activity_splash.xml new file mode 100644 index 000000000..3c7f692ff --- /dev/null +++ b/sample/src/main/res/layout/activity_splash.xml @@ -0,0 +1,49 @@ + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/values/style.xml b/sample/src/main/res/values/style.xml new file mode 100644 index 000000000..6b0346fb7 --- /dev/null +++ b/sample/src/main/res/values/style.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file