|
|
@ -12,6 +12,7 @@ import com.google.android.material.tabs.TabLayout |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.VMBaseFragment |
|
|
|
import io.legado.app.base.VMBaseFragment |
|
|
|
|
|
|
|
import io.legado.app.constant.AppConst |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.data.entities.BookGroup |
|
|
|
import io.legado.app.data.entities.BookGroup |
|
|
@ -123,11 +124,15 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
private fun upGroup(data: List<BookGroup>) { |
|
|
|
private fun upGroup(data: List<BookGroup>) { |
|
|
|
|
|
|
|
if (data.isEmpty()) { |
|
|
|
|
|
|
|
App.db.bookGroupDao().enableGroup(AppConst.bookGroupAllId) |
|
|
|
|
|
|
|
} else { |
|
|
|
bookGroups.clear() |
|
|
|
bookGroups.clear() |
|
|
|
bookGroups.addAll(data) |
|
|
|
bookGroups.addAll(data) |
|
|
|
adapter.notifyDataSetChanged() |
|
|
|
adapter.notifyDataSetChanged() |
|
|
|
selectLastTab() |
|
|
|
selectLastTab() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Synchronized |
|
|
|
@Synchronized |
|
|
|
private fun selectLastTab() { |
|
|
|
private fun selectLastTab() { |
|
|
|