From b580de08b3d76a70f815d7c0d09f1f9aa578d574 Mon Sep 17 00:00:00 2001 From: GKF Date: Mon, 3 Jun 2019 17:24:11 +0800 Subject: [PATCH] up --- .../java/io/legado/app/ui/main/MainActivity.kt | 8 ++++---- .../app/ui/main/bookshelf/BookshelfFragment.kt | 14 ++++++-------- .../app/ui/main/booksource/BookSourceFragment.kt | 14 ++++++-------- .../app/ui/main/findbook/FindBookFragment.kt | 14 ++++++-------- .../app/ui/main/myconfig/MyConfigFragment.kt | 14 ++++++-------- 5 files changed, 28 insertions(+), 36 deletions(-) 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 ea95d0256..4b1a01ef4 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()) - mFragmentList.add(FindBookFragment()) - mFragmentList.add(BookSourceFragment()) - mFragmentList.add(MyConfigFragment()) + 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)) 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 4d9c7492f..f47c26989 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 @@ -1,16 +1,14 @@ package io.legado.app.ui.main.bookshelf +import android.os.Bundle +import android.view.View import androidx.fragment.app.Fragment -class BookshelfFragment : Fragment() { +class BookshelfFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { -// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { -// return inflater.inflate(R.layout.fragment_bookshelf, container) -// } -// -// override fun onViewCreated(view: View, savedInstanceState: Bundle?) { -// super.onViewCreated(view, savedInstanceState) -// } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + } } \ No newline at end of file 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 85c0c7110..c7700907b 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 @@ -1,15 +1,13 @@ package io.legado.app.ui.main.booksource +import android.os.Bundle +import android.view.View import androidx.fragment.app.Fragment -class BookSourceFragment : Fragment() { +class BookSourceFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { -// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { -// return inflater.inflate(R.layout.fragment_book_source, container) -// } -// -// override fun onViewCreated(view: View, savedInstanceState: Bundle?) { -// super.onViewCreated(view, savedInstanceState) -// } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + } } \ No newline at end of file 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 f37d79941..1f82bde48 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 @@ -1,15 +1,13 @@ package io.legado.app.ui.main.findbook +import android.os.Bundle +import android.view.View import androidx.fragment.app.Fragment -class FindBookFragment : Fragment() { +class FindBookFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { -// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { -// return inflater.inflate(R.layout.fragment_find_book, container) -// } -// -// override fun onViewCreated(view: View, savedInstanceState: Bundle?) { -// super.onViewCreated(view, savedInstanceState) -// } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + } } \ No newline at end of file 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 6bd23077c..af07504b3 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 @@ -1,15 +1,13 @@ package io.legado.app.ui.main.myconfig +import android.os.Bundle +import android.view.View import androidx.fragment.app.Fragment -class MyConfigFragment : Fragment() { +class MyConfigFragment(contentLayoutId: Int) : Fragment(contentLayoutId) { -// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { -// return inflater.inflate(R.layout.fragment_my_config, container) -// } -// -// override fun onViewCreated(view: View, savedInstanceState: Bundle?) { -// super.onViewCreated(view, savedInstanceState) -// } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + } } \ No newline at end of file