Small fix

This commit is contained in:
tom5079
2019-06-02 01:04:16 +09:00
parent 530da98ec6
commit 1faf6cb208
2 changed files with 24 additions and 21 deletions

View File

@@ -573,7 +573,6 @@ class MainActivity : AppCompatActivity() {
} }
if (next is LinearLayout) { if (next is LinearLayout) {
Log.d("Pupil", "hmm...")
val icon = next.findViewById<ImageView>(R.id.icon_next) val icon = next.findViewById<ImageView>(R.id.icon_next)
next.layoutParams.height = 1 next.layoutParams.height = 1
icon.layoutParams.height = 1 icon.layoutParams.height = 1

View File

@@ -190,27 +190,31 @@ class ReaderActivity : AppCompatActivity() {
onNotifyChangedHandler = { notify -> onNotifyChangedHandler = { notify ->
val fab = reader_fab_download val fab = reader_fab_download
if (notify) { runOnUiThread {
val icon = AnimatedVectorDrawableCompat.create(this, R.drawable.ic_downloading) if (notify) {
icon?.registerAnimationCallback(object: Animatable2Compat.AnimationCallback() { val icon = AnimatedVectorDrawableCompat.create(this, R.drawable.ic_downloading)
override fun onAnimationEnd(drawable: Drawable?) { icon?.registerAnimationCallback(object: Animatable2Compat.AnimationCallback() {
if (downloader.download) override fun onAnimationEnd(drawable: Drawable?) {
fab.post { if (downloader.download)
icon.start() fab.post {
fab.labelText = getString(R.string.reader_fab_download_cancel) icon.start()
} fab.labelText = getString(R.string.reader_fab_download_cancel)
else }
fab.post { else
fab.setImageResource(R.drawable.ic_download) fab.post {
fab.labelText = getString(R.string.reader_fab_download) fab.setImageResource(R.drawable.ic_download)
} fab.labelText = getString(R.string.reader_fab_download)
} }
}) }
})
fab.setImageDrawable(icon) fab.setImageDrawable(icon)
icon?.start() icon?.start()
} else { } else {
fab.setImageResource(R.drawable.ic_download) runOnUiThread {
fab.setImageResource(R.drawable.ic_download)
}
}
} }
} }
} }