|
|
@ -41,6 +41,7 @@ import kotlinx.android.synthetic.main.view_title_bar.* |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
import org.jetbrains.anko.startActivityForResult |
|
|
|
import org.jetbrains.anko.startActivityForResult |
|
|
|
import org.jetbrains.anko.startService |
|
|
|
import org.jetbrains.anko.startService |
|
|
|
|
|
|
|
import org.jetbrains.anko.toast |
|
|
|
|
|
|
|
|
|
|
|
class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity_book_source), |
|
|
|
class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity_book_source), |
|
|
|
BookSourceAdapter.CallBack, |
|
|
|
BookSourceAdapter.CallBack, |
|
|
@ -56,6 +57,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
override fun onActivityCreated(savedInstanceState: Bundle?) { |
|
|
|
setSupportActionBar(toolbar) |
|
|
|
setSupportActionBar(toolbar) |
|
|
|
|
|
|
|
initUriScheme() |
|
|
|
initRecyclerView() |
|
|
|
initRecyclerView() |
|
|
|
initSearchView() |
|
|
|
initSearchView() |
|
|
|
initLiveDataBookSource() |
|
|
|
initLiveDataBookSource() |
|
|
@ -101,6 +103,20 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity |
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun initUriScheme() { |
|
|
|
|
|
|
|
intent.data?.let{ |
|
|
|
|
|
|
|
when(it.path) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"/importonline" -> { |
|
|
|
|
|
|
|
it.getQueryParameter("src")?.let{ |
|
|
|
|
|
|
|
viewModel.importSource(it) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> {toast("格式不对")} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initRecyclerView() { |
|
|
|
private fun initRecyclerView() { |
|
|
|
ATH.applyEdgeEffectColor(recycler_view) |
|
|
|
ATH.applyEdgeEffectColor(recycler_view) |
|
|
|
recycler_view.layoutManager = LinearLayoutManager(this) |
|
|
|
recycler_view.layoutManager = LinearLayoutManager(this) |
|
|
|