|  |  |  | @ -13,22 +13,23 @@ import io.legado.app.App | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.R | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.base.VMBaseFragment | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.constant.AppConst | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.constant.Bus | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.constant.PreferKey | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.constant.PreferKey.saveTabPosition | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.data.entities.BookGroup | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.lib.dialogs.selector | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.lib.theme.ATH | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.lib.theme.accentColor | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.ui.book.search.SearchActivity | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.ui.download.DownloadActivity | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.getPrefBoolean | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.getViewModel | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.putPrefInt | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.startActivity | 
			
		
	
		
			
				
					|  |  |  |  | import io.legado.app.utils.* | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.android.synthetic.main.fragment_bookshelf.* | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.android.synthetic.main.view_tab_layout.* | 
			
		
	
		
			
				
					|  |  |  |  | import kotlinx.android.synthetic.main.view_title_bar.* | 
			
		
	
		
			
				
					|  |  |  |  | import org.jetbrains.anko.sdk27.listeners.onLongClick | 
			
		
	
		
			
				
					|  |  |  |  | import org.jetbrains.anko.startActivity | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_bookshelf), | 
			
		
	
		
			
				
					|  |  |  |  |     SearchView.OnQueryTextListener, | 
			
		
	
		
			
				
					|  |  |  |  |     GroupManageDialog.CallBack, | 
			
		
	
	
		
			
				
					|  |  |  | @ -82,7 +83,16 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b | 
			
		
	
		
			
				
					|  |  |  |  |         view_pager_bookshelf.adapter = BookshelfAdapter(this, this) | 
			
		
	
		
			
				
					|  |  |  |  |         TabLayoutMediator(tab_layout, view_pager_bookshelf) { tab, position -> | 
			
		
	
		
			
				
					|  |  |  |  |             tab.text = bookGroups[position].groupName | 
			
		
	
		
			
				
					|  |  |  |  |             tab.view?.onLongClick { | 
			
		
	
		
			
				
					|  |  |  |  |                 tab.select() | 
			
		
	
		
			
				
					|  |  |  |  |                 putPrefInt(saveTabPosition, position) | 
			
		
	
		
			
				
					|  |  |  |  |                 toast("该分组<" + bookGroups[position].groupName + ">已成为默认页。") | 
			
		
	
		
			
				
					|  |  |  |  |                 true | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         }.attach() | 
			
		
	
		
			
				
					|  |  |  |  |         observeEvent<Int>(Bus.UP_TABS) { | 
			
		
	
		
			
				
					|  |  |  |  |             tab_layout.getTabAt(it)?.select() | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     private fun initBookGroupData() { | 
			
		
	
	
		
			
				
					|  |  |  | 
 |