Browse Source

load preferred sub/content language on startup

pull/49/head
Jannik 4 months ago
parent
commit
30a5331bbc
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 16
      app/src/main/java/org/mosad/teapod/ui/activity/main/MainActivity.kt

16
app/src/main/java/org/mosad/teapod/ui/activity/main/MainActivity.kt

@ -44,9 +44,11 @@ import org.mosad.teapod.ui.activity.onboarding.OnboardingActivity
import org.mosad.teapod.ui.activity.player.PlayerActivity
import org.mosad.teapod.ui.components.LoginDialog
import org.mosad.teapod.util.DataTypes
import java.util.*
import kotlin.system.measureTimeMillis
class MainActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListener {
private val classTag = javaClass.name
private lateinit var binding: ActivityMainBinding
private var activeBaseFragment: Fragment = HomeFragment() // the currently active fragment, home at the start
@ -146,16 +148,20 @@ class MainActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListen
runBlocking { initCrunchyroll().joinAll() }
}
}
Log.i(javaClass.name, "loading in $time ms")
Log.i(classTag, "loading in $time ms")
}
private fun initCrunchyroll(): List<Job> {
println("init")
val scope = CoroutineScope(Dispatchers.IO + CoroutineName("InitialLoadingScope"))
return listOf(
scope.launch { Crunchyroll.index() },
scope.launch { Crunchyroll.account() }
scope.launch { Crunchyroll.account() },
scope.launch {
// update the local preferred content language, since it may have changed
val locale = Locale.forLanguageTag(Crunchyroll.profile().preferredContentSubtitleLanguage)
Preferences.savePreferredLocal(this@MainActivity, locale)
}
)
}
@ -169,7 +175,7 @@ class MainActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListen
// Log.w(javaClass.name, "Login failed, please try again.")
// }
}.negativeButton {
Log.i(javaClass.name, "Login canceled, exiting.")
Log.i(classTag, "Login canceled, exiting.")
finish()
}.show()
}

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close