|
|
@ -32,6 +32,7 @@ import io.legado.app.utils.visible |
|
|
|
import kotlinx.android.synthetic.main.activity_book_info.* |
|
|
|
import kotlinx.android.synthetic.main.activity_book_info.* |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
import org.jetbrains.anko.startActivity |
|
|
|
|
|
|
|
import org.jetbrains.anko.startActivityForResult |
|
|
|
import org.jetbrains.anko.toast |
|
|
|
import org.jetbrains.anko.toast |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -41,6 +42,9 @@ class BookInfoActivity : |
|
|
|
ChapterListAdapter.CallBack, |
|
|
|
ChapterListAdapter.CallBack, |
|
|
|
ChangeSourceDialog.CallBack { |
|
|
|
ChangeSourceDialog.CallBack { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val requestCodeChapterList = 568 |
|
|
|
|
|
|
|
private val requestCodeSourceEdit = 562 |
|
|
|
|
|
|
|
|
|
|
|
override val viewModel: BookInfoViewModel |
|
|
|
override val viewModel: BookInfoViewModel |
|
|
|
get() = getViewModel(BookInfoViewModel::class.java) |
|
|
|
get() = getViewModel(BookInfoViewModel::class.java) |
|
|
|
|
|
|
|
|
|
|
@ -70,7 +74,10 @@ class BookInfoActivity : |
|
|
|
R.id.menu_edit -> { |
|
|
|
R.id.menu_edit -> { |
|
|
|
if (viewModel.inBookshelf) { |
|
|
|
if (viewModel.inBookshelf) { |
|
|
|
viewModel.bookData.value?.let { |
|
|
|
viewModel.bookData.value?.let { |
|
|
|
startActivity<BookInfoEditActivity>(Pair("bookUrl", it.bookUrl)) |
|
|
|
startActivityForResult<BookInfoEditActivity>( |
|
|
|
|
|
|
|
requestCodeSourceEdit, |
|
|
|
|
|
|
|
Pair("bookUrl", it.bookUrl) |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
toast(R.string.after_add_bookshelf) |
|
|
|
toast(R.string.after_add_bookshelf) |
|
|
@ -284,8 +291,11 @@ class BookInfoActivity : |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
if (resultCode == Activity.RESULT_OK) { |
|
|
|
when (requestCode) { |
|
|
|
|
|
|
|
requestCodeSourceEdit -> if (resultCode == Activity.RESULT_OK) { |
|
|
|
viewModel.initData(intent) |
|
|
|
viewModel.initData(intent) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |