|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
package io.legado.app.ui.welcome |
|
|
|
|
|
|
|
|
|
import android.animation.Animator |
|
|
|
|
import android.animation.ValueAnimator |
|
|
|
|
import android.content.Intent |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import com.github.houbb.opencc4j.util.ZhConverterUtil |
|
|
|
@ -16,7 +18,7 @@ import kotlinx.android.synthetic.main.activity_welcome.* |
|
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
|
import java.util.concurrent.TimeUnit |
|
|
|
|
|
|
|
|
|
open class WelcomeActivity : BaseActivity(R.layout.activity_welcome) { |
|
|
|
|
open class WelcomeActivity : BaseActivity(R.layout.activity_welcome), Animator.AnimatorListener { |
|
|
|
|
|
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
|
iv_book.setColorFilter(accentColor) |
|
|
|
@ -40,15 +42,33 @@ open class WelcomeActivity : BaseActivity(R.layout.activity_welcome) { |
|
|
|
|
else -> null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
root_view.postDelayed({ |
|
|
|
|
startActivity<MainActivity>() |
|
|
|
|
if (getPrefBoolean(getString(R.string.pk_default_read))) { |
|
|
|
|
startActivity<ReadBookActivity>() |
|
|
|
|
} |
|
|
|
|
finish() |
|
|
|
|
}, 200) |
|
|
|
|
val welAnimator = ValueAnimator.ofFloat(1f, 0.3f).setDuration(300) |
|
|
|
|
welAnimator.addUpdateListener { animation -> |
|
|
|
|
root_view.alpha = animation.animatedValue as Float |
|
|
|
|
} |
|
|
|
|
welAnimator.addListener(this) |
|
|
|
|
welAnimator.start() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun startMainActivity() { |
|
|
|
|
startActivity<MainActivity>() |
|
|
|
|
if (getPrefBoolean(getString(R.string.pk_default_read))) { |
|
|
|
|
startActivity<ReadBookActivity>() |
|
|
|
|
} |
|
|
|
|
finish() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onAnimationStart(animation: Animator) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onAnimationEnd(animation: Animator) { |
|
|
|
|
startMainActivity() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onAnimationCancel(animation: Animator) = Unit |
|
|
|
|
|
|
|
|
|
override fun onAnimationRepeat(animation: Animator) = Unit |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class Launcher1 : WelcomeActivity() |
|
|
|
|