Skip to content

Commit

Permalink
crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush2622 committed Jan 31, 2024
1 parent 9c2c932 commit 37a5374
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/src/main/java/ani/dantotsu/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import ani.dantotsu.themes.ThemeManager
import eu.kanade.domain.source.service.SourcePreferences
import io.noties.markwon.Markwon
import io.noties.markwon.SoftBreakAddsNewLinePlugin
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
Expand All @@ -71,14 +70,15 @@ class MainActivity : AppCompatActivity() {
private lateinit var incognitoLiveData: SharedPreferenceBooleanLiveData
private val scope = lifecycleScope
private var load = false

private var uiSettings = UserInterfaceSettings()

@kotlin.OptIn(DelicateCoroutinesApi::class)

@SuppressLint("InternalInsetResource", "DiscouragedApi")
@OptIn(UnstableApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
ThemeManager(this).applyTheme()

super.onCreate(savedInstanceState)

//get FRAGMENT_CLASS_NAME from intent
Expand All @@ -87,16 +87,16 @@ class MainActivity : AppCompatActivity() {
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

var bottomBar = findViewById<AnimatedBottomBar>(R.id.navbar)
val _bottomBar = findViewById<AnimatedBottomBar>(R.id.navbar)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

val backgroundDrawable = bottomBar.background as GradientDrawable
val backgroundDrawable = _bottomBar.background as GradientDrawable
val currentColor = backgroundDrawable.color?.defaultColor ?: 0
val semiTransparentColor = (currentColor and 0x00FFFFFF) or 0xF9000000.toInt()
backgroundDrawable.setColor(semiTransparentColor)
bottomBar.background = backgroundDrawable
_bottomBar.background = backgroundDrawable
}
bottomBar.background = ContextCompat.getDrawable(this, R.drawable.bottom_nav_gray)
_bottomBar.background = ContextCompat.getDrawable(this, R.drawable.bottom_nav_gray)


val offset = try {
Expand Down Expand Up @@ -234,7 +234,7 @@ class MainActivity : AppCompatActivity() {
startActivity(Intent(this, NoInternet::class.java))
} else {
val model: AnilistHomeViewModel by viewModels()
model.genres.observe(this) {
model.genres.observe(this) { it ->
if (it != null) {
if (it) {
val navbar = binding.includedNavbar.navbar
Expand Down

0 comments on commit 37a5374

Please sign in to comment.