Omega-R / OmegaLint

3 stars 0 forks source link

Некорректное срабатывание #20

Closed scrinoman closed 3 years ago

scrinoman commented 3 years ago
override fun setActiveMainPageId(mainPageId: MainPageId) {
        val fixedPageId =
            if (mainPageId == EMPTY_PAGE_ID)
                mainPages.firstOrNull()?.id ?: mainPageId
            else mainPageId
        this.mainPageId = fixedPageId
        val mainPage = mainPages.firstOrNull { it.id == fixedPageId } ?: return

        val activeFragments = supportFragmentManager
            .fragments
            .filter { !it.isHidden && it is BaseFragment }
            .toMutableList()

        val currentFragment = supportFragmentManager.fragments.firstOrNull { fragment ->
            mainPage.fragmentLauncher.isOurFragment(fragment)
        }

        activeFragments -= currentFragment
        supportFragmentManager.edit {
            activeFragments.forEach {
                hide(it)
            }
            if (currentFragment == null) {
                val newFragment = mainPage.fragmentLauncher.createFragment()
                add(R.id.layout_container, newFragment, fixedPageId.toString())
            } else {
                show(currentFragment)
            }

        }
    }

Проверка http://wiki.omega-r.club/dev-android-code#rec228194333 учитывает пустые строки, а не должна