diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 4b1a01ef4..ea95d0256 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -31,10 +31,10 @@ class MainActivity : BaseActivity(), BottomNavigationView.OnNavig get() = R.layout.activity_main override fun onViewModelCreated(viewModel: MainViewModel, savedInstanceState: Bundle?) { - mFragmentList.add(BookshelfFragment(R.layout.fragment_bookshelf)) - mFragmentList.add(FindBookFragment(R.layout.fragment_find_book)) - mFragmentList.add(BookSourceFragment(R.layout.fragment_book_source)) - mFragmentList.add(MyConfigFragment(R.layout.fragment_my_config)) + mFragmentList.add(BookshelfFragment()) + mFragmentList.add(FindBookFragment()) + mFragmentList.add(BookSourceFragment()) + mFragmentList.add(MyConfigFragment()) view_pager_main.adapter = TabFragmentPageAdapter(supportFragmentManager, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) view_pager_main.addOnPageChangeListener(this) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index f47c26989..587ea750f 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -3,8 +3,9 @@ package io.legado.app.ui.main.bookshelf import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment +import io.legado.app.R -class BookshelfFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { +class BookshelfFragment : Fragment(R.layout.fragment_bookshelf) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt index c7700907b..5b384b0b2 100644 --- a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt @@ -3,8 +3,9 @@ package io.legado.app.ui.main.booksource import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment +import io.legado.app.R -class BookSourceFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { +class BookSourceFragment : Fragment(R.layout.fragment_book_source) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt b/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt index 1f82bde48..836edebd4 100644 --- a/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt @@ -3,8 +3,9 @@ package io.legado.app.ui.main.findbook import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment +import io.legado.app.R -class FindBookFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { +class FindBookFragment : Fragment(R.layout.fragment_find_book) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt index af07504b3..d045344e0 100644 --- a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt @@ -3,8 +3,9 @@ package io.legado.app.ui.main.myconfig import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment +import io.legado.app.R -class MyConfigFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { +class MyConfigFragment : Fragment(R.layout.fragment_my_config) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/app/src/main/res/layout/fragment_my_config.xml b/app/src/main/res/layout/fragment_my_config.xml index a4b260fa9..82d00c33c 100644 --- a/app/src/main/res/layout/fragment_my_config.xml +++ b/app/src/main/res/layout/fragment_my_config.xml @@ -12,4 +12,5 @@ app:layout_constraintTop_toTopOf="parent" app:title="我的"/> + \ No newline at end of file