Fixing a bug in the app

This commit is contained in:
oupson 2020-05-09 20:43:51 +02:00
parent f52b9e4563
commit f845202a50
2 changed files with 10 additions and 2 deletions

View File

@ -20,6 +20,11 @@ import java.io.File
import java.net.URL
// TODO REWRITE WITH CALLBACKS
// TODO REWRITE
/**
* USE [ApngDecoder] instead of this class to load an APNG
*/
/**
* @param file The APNG to load
@ -422,6 +427,7 @@ class ApngAnimator(private val context: Context?) {
GlobalScope.launch(Dispatchers.Main) {
imageView?.apply {
scaleType = this@ApngAnimator.scaleType ?: ImageView.ScaleType.FIT_CENTER
clearAnimation()
setImageDrawable(activeAnimation)
}
activeAnimation?.start()

View File

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Intent
import android.net.http.HttpResponseCache
import android.os.Bundle
import android.util.Log
import android.view.MenuItem
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
@ -29,6 +30,7 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.i(TAG, "${supportFragmentManager.fragments.size}")
setContentView(R.layout.activity_main)
@ -99,7 +101,7 @@ class MainActivity : AppCompatActivity() {
return@setNavigationItemSelectedListener true
}
if (intent.hasExtra("fragment")) {
if (intent.hasExtra("fragment") && supportFragmentManager.fragments.size == 0) {
when(intent.getStringExtra("fragment")) {
"kotlin" -> {
supportFragmentManager.beginTransaction().apply {
@ -131,7 +133,7 @@ class MainActivity : AppCompatActivity() {
selected = 2
}
}
} else {
} else if (supportFragmentManager.fragments.size == 0) {
supportFragmentManager.beginTransaction().apply {
add(
R.id.fragment_container,