Add animated splash screen (4s), show app version on settings page
This commit is contained in:
@@ -25,14 +25,20 @@
|
|||||||
android:label="@string/settings_title" />
|
android:label="@string/settings_title" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".SplashActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden">
|
android:theme="@style/Theme.SvxRemote">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:configChanges="orientation|screenSize|keyboardHidden" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
53
app/src/main/java/ru/ua1zbe/svxremote/SplashActivity.kt
Normal file
53
app/src/main/java/ru/ua1zbe/svxremote/SplashActivity.kt
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package ru.ua1zbe.svxremote
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.view.animation.AccelerateDecelerateInterpolator
|
||||||
|
|
||||||
|
/** Красивая заставка с плавным появлением логотипа. */
|
||||||
|
class SplashActivity : Activity() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_splash)
|
||||||
|
|
||||||
|
val title = findViewById<View>(R.id.splash_title)
|
||||||
|
val subtitle = findViewById<View>(R.id.splash_subtitle)
|
||||||
|
val line = findViewById<View>(R.id.splash_line)
|
||||||
|
|
||||||
|
val baseAlpha = title.alpha
|
||||||
|
title.alpha = 0f
|
||||||
|
subtitle.alpha = 0f
|
||||||
|
line.alpha = 0f
|
||||||
|
|
||||||
|
title.animate()
|
||||||
|
.alpha(1f)
|
||||||
|
.scaleX(1.0f)
|
||||||
|
.scaleY(1.0f)
|
||||||
|
.setStartDelay(150)
|
||||||
|
.setDuration(700)
|
||||||
|
.setInterpolator(AccelerateDecelerateInterpolator())
|
||||||
|
.start()
|
||||||
|
|
||||||
|
subtitle.animate()
|
||||||
|
.alpha(1f)
|
||||||
|
.setStartDelay(600)
|
||||||
|
.setDuration(600)
|
||||||
|
.start()
|
||||||
|
|
||||||
|
line.animate()
|
||||||
|
.alpha(1f)
|
||||||
|
.setStartDelay(900)
|
||||||
|
.setDuration(500)
|
||||||
|
.start()
|
||||||
|
|
||||||
|
window.decorView.postDelayed({
|
||||||
|
val intent = Intent(this, MainActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||||
|
finish()
|
||||||
|
}, 4000)
|
||||||
|
}
|
||||||
|
}
|
||||||
8
app/src/main/res/drawable/bg_splash.xml
Normal file
8
app/src/main/res/drawable/bg_splash.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:angle="135"
|
||||||
|
android:startColor="#0D1117"
|
||||||
|
android:centerColor="#101826"
|
||||||
|
android:endColor="#0D1117" />
|
||||||
|
</shape>
|
||||||
@@ -128,5 +128,15 @@
|
|||||||
android:background="@drawable/bg_primary_btn"
|
android:background="@drawable/bg_primary_btn"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/lbl_version"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/app_version"
|
||||||
|
android:textColor="@color/text_secondary"
|
||||||
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
44
app/src/main/res/layout/activity_splash.xml
Normal file
44
app/src/main/res/layout/activity_splash.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_splash">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/splash_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="SVXhomyak"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="34sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:letterSpacing="0.08"
|
||||||
|
android:alpha="0" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/splash_subtitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="СВЯЗЬ ЧЕРЕЗ СЕРВЕР"
|
||||||
|
android:textColor="@color/text_secondary"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:letterSpacing="0.3"
|
||||||
|
android:alpha="0" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/splash_line"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="@color/info"
|
||||||
|
android:alpha="0" />
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<string name="pref_auth_key">Пароль (AUTH_KEY)</string>
|
<string name="pref_auth_key">Пароль (AUTH_KEY)</string>
|
||||||
<string name="pref_tg">Группа вещания (TG)</string>
|
<string name="pref_tg">Группа вещания (TG)</string>
|
||||||
<string name="btn_save">Сохранить</string>
|
<string name="btn_save">Сохранить</string>
|
||||||
|
<string name="app_version">SVXhomyak — v1.0.0</string>
|
||||||
<string name="saved">Сохранено</string>
|
<string name="saved">Сохранено</string>
|
||||||
<string name="pref_callsign_hint">например UA1ZBE</string>
|
<string name="pref_callsign_hint">например UA1ZBE</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user