pull/32/head
gedoor 6 years ago
parent d35ba56ea1
commit 96048db37d
  1. 7
      app/src/main/AndroidManifest.xml
  2. 50
      app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt
  3. 15
      app/src/main/res/layout/activity_welcome.xml

@ -27,14 +27,14 @@
android:theme="@style/AppTheme.Light"
tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute">
<activity
android:name=".ui.main.MainActivity"
android:label="@string/app_name">
android:name=".ui.welcome.WelcomeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".ui.main.MainActivity" />
<activity android:name=".ui.replacerule.ReplaceRuleActivity"/>
<activity android:name=".ui.search.SearchActivity"/>
<activity android:name=".ui.about.AboutActivity"/>
@ -47,6 +47,7 @@
<activity android:name=".ui.about.DonateActivity" />
<activity android:name=".ui.bookinfo.BookInfoActivity" />
<activity android:name=".ui.bookinfo.BookInfoEditActivity" />
</application>
</manifest>

@ -0,0 +1,50 @@
package io.legado.app.ui.welcome
import android.animation.Animator
import android.animation.ValueAnimator
import android.os.Bundle
import androidx.lifecycle.AndroidViewModel
import io.legado.app.R
import io.legado.app.base.BaseActivity
import io.legado.app.lib.theme.ThemeStore
import io.legado.app.ui.main.MainActivity
import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_welcome.*
import org.jetbrains.anko.startActivity
class WelcomeActivity : BaseActivity<AndroidViewModel>() {
override val viewModel: AndroidViewModel
get() = getViewModel(AndroidViewModel::class.java)
override val layoutID: Int
get() = R.layout.activity_welcome
override fun onViewModelCreated(viewModel: AndroidViewModel, savedInstanceState: Bundle?) {
iv_bg.setColorFilter(ThemeStore.accentColor(this))
val welAnimator = ValueAnimator.ofFloat(1f, 0f).setDuration(800)
welAnimator.startDelay = 100
welAnimator.addUpdateListener { animation ->
val alpha = animation.animatedValue as Float
iv_bg.alpha = alpha
}
welAnimator.addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
startActivity<MainActivity>()
finish()
}
override fun onAnimationEnd(animation: Animator) {
}
override fun onAnimationCancel(animation: Animator) {
}
override fun onAnimationRepeat(animation: Animator) {
}
})
welAnimator.start()
}
}

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_bg"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/image_welcome"
android:scaleType="fitCenter"
android:contentDescription="@string/welcome" />
</LinearLayout>
Loading…
Cancel
Save