Skip to content

Commit

Permalink
Add splash screen to the example app.
Browse files Browse the repository at this point in the history
  • Loading branch information
pandulapeter committed Oct 15, 2019
1 parent cfdcec2 commit 7e3c2cb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
4 changes: 2 additions & 2 deletions beagle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
Expand Down
2 changes: 1 addition & 1 deletion example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
android:theme="@style/SplashTheme"
tools:ignore="GoogleAppIndexingWarning">

<activity android:name="com.pandulapeter.beagleExample.screens.MainActivity">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.pandulapeter.beagleExample.utils.mockTestAccounts
class LoginActivity : AppCompatActivity(R.layout.activity_login) {

override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
findViewById<View>(R.id.open_debug_menu_button).setOnClickListener { Beagle.fetch(this) }
findViewById<View>(R.id.back_button).setOnClickListener { supportFinishAfterTransition() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.pandulapeter.beagleExample.utils.logMessages
class MainActivity : AppCompatActivity(R.layout.activity_main) {

override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
findViewById<View>(R.id.open_debug_menu_button).setOnClickListener { Beagle.fetch(this) }
findViewById<View>(R.id.perform_network_request_button).setOnClickListener { performNetworkRequest() }
Expand Down
7 changes: 7 additions & 0 deletions example/src/main/res/drawable/bg_splash.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/beagle_background" />
<item
android:drawable="@drawable/img_logo"
android:gravity="center" />
</layer-list>
20 changes: 17 additions & 3 deletions example/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
<resources>

<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar">
<style name="SplashTheme" parent="Theme.MaterialComponents.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowBackground">@drawable/bg_splash</item>
</style>

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowBackground">@color/beagle_foreground</item>
<item name="colorPrimary">@color/beagle_background</item>
<item name="materialButtonStyle">@style/Button</item>
<item name="android:textColor">@color/white</item>
</style>

<style name="Button" parent="Widget.MaterialComponents.Button">
<item name="android:textAllCaps">false</item>
<item name="android:textColor">@color/beagle_foreground</item>
</style>

<style name="BeagleTheme" parent="Theme.MaterialComponents.Light">
<item name="colorPrimary">@color/accent</item>
<item name="colorButtonNormal">@color/accent</item>
<item name="colorAccent">@color/accent</item>
<item name="colorSwitchThumbNormal">@color/accent</item>
<item name="materialButtonStyle">@style/Button</item>
<item name="materialButtonStyle">@style/BeagleButton</item>
<item name="android:windowBackground">@color/background</item>
</style>

<style name="Button" parent="Widget.MaterialComponents.Button">
<style name="BeagleButton" parent="Widget.MaterialComponents.Button">
<item name="android:textAllCaps">false</item>
</style>

Expand Down

0 comments on commit 7e3c2cb

Please sign in to comment.