mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
@@ -36,7 +36,7 @@ import io.legado.app.service.BaseReadAloudService
|
||||
import io.legado.app.ui.main.bookshelf.BaseBookshelfFragment
|
||||
import io.legado.app.ui.main.bookshelf.style1.BookshelfFragment1
|
||||
import io.legado.app.ui.main.bookshelf.style2.BookshelfFragment2
|
||||
import io.legado.app.ui.main.explore.style2.ExploreFragment2
|
||||
import io.legado.app.ui.main.explore.ExploreFragment
|
||||
import io.legado.app.ui.main.my.MyFragment
|
||||
import io.legado.app.ui.main.rss.RssFragment
|
||||
import io.legado.app.ui.widget.dialog.TextDialog
|
||||
@@ -145,7 +145,7 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
if (System.currentTimeMillis() - exploreReselected > 300) {
|
||||
exploreReselected = System.currentTimeMillis()
|
||||
} else {
|
||||
(fragmentMap[1] as? ExploreFragment2)?.compressExplore()
|
||||
(fragmentMap[1] as? ExploreFragment)?.compressExplore()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
return when (getId(position)) {
|
||||
idBookshelf1 -> BookshelfFragment1()
|
||||
idBookshelf2 -> BookshelfFragment2()
|
||||
idExplore -> ExploreFragment2()
|
||||
idExplore -> ExploreFragment()
|
||||
idRss -> RssFragment()
|
||||
else -> MyFragment()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import io.legado.app.utils.*
|
||||
|
||||
abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfViewModel>(layoutId) {
|
||||
|
||||
protected val activityViewModel by activityViewModels<MainViewModel>()
|
||||
val activityViewModel by activityViewModels<MainViewModel>()
|
||||
override val viewModel by viewModels<BookshelfViewModel>()
|
||||
|
||||
private val importBookshelf = registerForActivityResult(HandleFileContract()) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import io.legado.app.constant.PreferKey
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.Book
|
||||
import io.legado.app.data.entities.BookGroup
|
||||
import io.legado.app.databinding.FragmentBookshelf1Binding
|
||||
import io.legado.app.databinding.FragmentBookshelfBinding
|
||||
import io.legado.app.lib.theme.accentColor
|
||||
import io.legado.app.lib.theme.primaryColor
|
||||
import io.legado.app.ui.book.group.GroupEditDialog
|
||||
@@ -30,11 +30,11 @@ import kotlin.collections.set
|
||||
/**
|
||||
* 书架界面
|
||||
*/
|
||||
class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
|
||||
class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf),
|
||||
TabLayout.OnTabSelectedListener,
|
||||
SearchView.OnQueryTextListener {
|
||||
|
||||
private val binding by viewBinding(FragmentBookshelf1Binding::bind)
|
||||
private val binding by viewBinding(FragmentBookshelfBinding::bind)
|
||||
private val adapter by lazy { TabFragmentPageAdapter(childFragmentManager) }
|
||||
private val tabLayout: TabLayout by lazy {
|
||||
binding.titleBar.findViewById(R.id.tab_layout)
|
||||
|
||||
@@ -16,7 +16,7 @@ import io.legado.app.constant.PreferKey
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.Book
|
||||
import io.legado.app.data.entities.BookGroup
|
||||
import io.legado.app.databinding.FragmentBookshelf2Binding
|
||||
import io.legado.app.databinding.FragmentBookshelf1Binding
|
||||
import io.legado.app.help.book.isAudio
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.lib.theme.accentColor
|
||||
@@ -42,11 +42,11 @@ import kotlin.math.max
|
||||
/**
|
||||
* 书架界面
|
||||
*/
|
||||
class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf2),
|
||||
class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
|
||||
SearchView.OnQueryTextListener,
|
||||
BaseBooksAdapter.CallBack {
|
||||
|
||||
private val binding by viewBinding(FragmentBookshelf2Binding::bind)
|
||||
private val binding by viewBinding(FragmentBookshelf1Binding::bind)
|
||||
private val bookshelfLayout by lazy {
|
||||
getPrefInt(PreferKey.bookshelfLayout)
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package io.legado.app.ui.main.explore
|
||||
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseFragment
|
||||
import io.legado.app.lib.theme.primaryTextColor
|
||||
import io.legado.app.utils.applyTint
|
||||
|
||||
abstract class BaseExploreFragment(layoutId: Int) : VMBaseFragment<ExploreViewModel>(layoutId) {
|
||||
|
||||
protected abstract val searchView: SearchView
|
||||
|
||||
|
||||
private fun initSearchView() {
|
||||
searchView.applyTint(primaryTextColor)
|
||||
searchView.onActionViewExpanded()
|
||||
searchView.isSubmitButtonEnabled = true
|
||||
searchView.queryHint = getString(R.string.screen_find)
|
||||
searchView.clearFocus()
|
||||
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String?): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onQueryTextChange(newText: String?): Boolean {
|
||||
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.legado.app.ui.main.explore.style2
|
||||
package io.legado.app.ui.main.explore
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.legado.app.ui.main.explore.style2
|
||||
package io.legado.app.ui.main.explore
|
||||
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import io.legado.app.data.entities.BookSource
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.legado.app.ui.main.explore.style2
|
||||
package io.legado.app.ui.main.explore
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
@@ -12,18 +12,17 @@ import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseFragment
|
||||
import io.legado.app.constant.AppLog
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.BookSource
|
||||
import io.legado.app.databinding.FragmentExplore2Binding
|
||||
import io.legado.app.databinding.FragmentExploreBinding
|
||||
import io.legado.app.help.config.AppConfig
|
||||
import io.legado.app.lib.dialogs.alert
|
||||
import io.legado.app.lib.theme.primaryColor
|
||||
import io.legado.app.lib.theme.primaryTextColor
|
||||
import io.legado.app.ui.book.explore.ExploreShowActivity
|
||||
import io.legado.app.ui.book.source.edit.BookSourceEditActivity
|
||||
import io.legado.app.ui.main.explore.BaseExploreFragment
|
||||
import io.legado.app.ui.main.explore.ExploreViewModel
|
||||
import io.legado.app.utils.applyTint
|
||||
import io.legado.app.utils.cnCompare
|
||||
import io.legado.app.utils.setEdgeEffectColor
|
||||
@@ -38,14 +37,14 @@ import kotlinx.coroutines.launch
|
||||
/**
|
||||
* 发现界面
|
||||
*/
|
||||
class ExploreFragment2 : BaseExploreFragment(R.layout.fragment_explore2),
|
||||
class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explore),
|
||||
ExploreAdapter.CallBack {
|
||||
|
||||
override val viewModel by viewModels<ExploreViewModel>()
|
||||
private val binding by viewBinding(FragmentExplore2Binding::bind)
|
||||
private val binding by viewBinding(FragmentExploreBinding::bind)
|
||||
private val adapter by lazy { ExploreAdapter(requireContext(), this) }
|
||||
private val linearLayoutManager by lazy { LinearLayoutManager(context) }
|
||||
override val searchView: SearchView by lazy {
|
||||
private val searchView: SearchView by lazy {
|
||||
binding.titleBar.findViewById(R.id.search_view)
|
||||
}
|
||||
private val diffItemCallBack = ExploreDiffItemCallBack()
|
||||
@@ -1,21 +0,0 @@
|
||||
package io.legado.app.ui.main.explore.style1
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.viewModels
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.VMBaseFragment
|
||||
import io.legado.app.databinding.FragmentExplore1Binding
|
||||
import io.legado.app.ui.main.explore.ExploreViewModel
|
||||
import io.legado.app.utils.viewbindingdelegate.viewBinding
|
||||
|
||||
class ExploreFragment1 : VMBaseFragment<ExploreViewModel>(R.layout.fragment_explore1) {
|
||||
|
||||
private val binding by viewBinding(FragmentExplore1Binding::bind)
|
||||
override val viewModel by viewModels<ExploreViewModel>()
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
21
app/src/main/res/layout/fragment_bookshelf.xml
Normal file
21
app/src/main/res/layout/fragment_bookshelf.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<io.legado.app.ui.widget.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:attachToActivity="false"
|
||||
app:contentLayout="@layout/view_tab_layout_min"
|
||||
app:title="@string/bookshelf" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager_bookshelf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@@ -10,12 +11,37 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:attachToActivity="false"
|
||||
app:contentLayout="@layout/view_tab_layout_min"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:title="@string/bookshelf" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager_bookshelf"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
</LinearLayout>
|
||||
<io.legado.app.ui.widget.recycler.RecyclerViewAtPager2
|
||||
android:id="@+id/rv_bookshelf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/item_bookshelf_list" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_empty_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/bookshelf_empty"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:text="TextView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<io.legado.app.ui.widget.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:attachToActivity="false"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:title="@string/bookshelf" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<io.legado.app.ui.widget.recycler.RecyclerViewAtPager2
|
||||
android:id="@+id/rv_bookshelf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/item_bookshelf_list" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_empty_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/bookshelf_empty"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:text="TextView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<io.legado.app.ui.widget.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:attachToActivity="false"
|
||||
app:contentLayout="@layout/view_search"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:title="@string/discovery" />
|
||||
|
||||
<io.legado.app.ui.widget.recycler.RecyclerViewAtPager2
|
||||
android:id="@+id/rv_find"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:listitem="@layout/item_find_book" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_empty_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:text="@string/explore_empty"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:text="TextView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -67,9 +67,6 @@ class JsTest {
|
||||
result = result + o
|
||||
println(o)
|
||||
}
|
||||
var b=[]
|
||||
b.push(4,5,6)
|
||||
b.forEach(c => {println(c)})
|
||||
result
|
||||
""".trimIndent()
|
||||
val result = SCRIPT_ENGINE.eval(jsFor, scope).toString()
|
||||
|
||||
Reference in New Issue
Block a user