修改代码

old
zlj 5 years ago
parent fe9f81045f
commit fc7d0c6dc3
  1. 9
      app/src/main/java/com/novel/read/activity/NovelBookDetailActivity.kt
  2. 4
      app/src/main/java/com/novel/read/activity/NovelBookTypeListActivity.kt
  3. 4
      app/src/main/java/com/novel/read/activity/NovelMainActivity.kt
  4. 4
      app/src/main/java/com/novel/read/activity/NovelRankListActivity.kt
  5. 8
      app/src/main/java/com/novel/read/activity/NovelReadActivity.kt
  6. 4
      app/src/main/java/com/novel/read/activity/NovelRecommendBookListActivity.kt
  7. 4
      app/src/main/java/com/novel/read/activity/NovelSearchActivity.kt
  8. 13
      app/src/main/java/com/novel/read/activity/NovelSettingActivity.kt
  9. 2
      app/src/main/java/com/novel/read/http/AccountManager.kt

@ -29,19 +29,15 @@ import kotlinx.android.synthetic.main.activity_book_detail.*
import org.litepal.LitePal import org.litepal.LitePal
import java.util.* import java.util.*
class NovelBookDetailActivity : NovelBaseActivity(), View.OnClickListener { class NovelBookDetailActivity(override val layoutId: Int = R.layout.activity_book_detail) : NovelBaseActivity(), View.OnClickListener {
private lateinit var mAdapter: LoveLyAdapter private lateinit var mAdapter: LoveLyAdapter
private val mList = ArrayList<RecommendBookResp.BookBean>() private val mList = ArrayList<RecommendBookResp.BookBean>()
private var mBookId: Int = 0 private var mBookId: Int = 0
private var isCollected = false private var isCollected = false
private var mCollBookBean: CollBookBean? = null private var mCollBookBean: CollBookBean? = null
private lateinit var mProgressDialog: ProgressDialog private lateinit var mProgressDialog: ProgressDialog
override val layoutId: Int get() = R.layout.activity_book_detail
override fun initView() { override fun initView() {
mBookId = intent.getIntExtra(Constant.Bundle.BookId, 0) mBookId = intent.getIntExtra(Constant.Bundle.BookId, 0)
rlv_lovely.layoutManager = LinearLayoutManager(this) rlv_lovely.layoutManager = LinearLayoutManager(this)
@ -76,8 +72,7 @@ class NovelBookDetailActivity : NovelBaseActivity(), View.OnClickListener {
} else { } else {
mProgressDialog.setTitle("正在添加到书架中") mProgressDialog.setTitle("正在添加到书架中")
mProgressDialog.show() mProgressDialog.show()
AccountManager.getInstance() AccountManager.getInstance().getBookArticle(mBookId.toString())
.getBookArticle(mBookId.toString(), "2", "1", "100000")
} }
R.id.tv_start_read -> R.id.tv_start_read ->

@ -15,7 +15,7 @@ import com.squareup.otto.Subscribe
import kotlinx.android.synthetic.main.activity_book_type_list.* import kotlinx.android.synthetic.main.activity_book_type_list.*
import java.util.* import java.util.*
class NovelBookTypeListActivity : NovelBaseActivity() { class NovelBookTypeListActivity(override val layoutId: Int = R.layout.activity_book_type_list) : NovelBaseActivity() {
private var mList: MutableList<SearchResp.BookBean> = ArrayList() private var mList: MutableList<SearchResp.BookBean> = ArrayList()
private lateinit var mAdapter: BookListAdapter private lateinit var mAdapter: BookListAdapter
@ -24,8 +24,6 @@ class NovelBookTypeListActivity : NovelBaseActivity() {
private var page: Int = 1 private var page: Int = 1
private var loadSize: Int = 0 private var loadSize: Int = 0
override val layoutId: Int get() = R.layout.activity_book_type_list
override fun initView() { override fun initView() {
EventManager.instance.registerSubscriber(this) EventManager.instance.registerSubscriber(this)

@ -24,7 +24,7 @@ import com.novel.read.utlis.SpUtil
import com.squareup.otto.Subscribe import com.squareup.otto.Subscribe
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
class NovelMainActivity : NovelBaseActivity() { class NovelMainActivity(override val layoutId: Int = R.layout.activity_main) : NovelBaseActivity() {
private lateinit var mCurrentFrag: Fragment private lateinit var mCurrentFrag: Fragment
private lateinit var mMainFragment: BookFragment private lateinit var mMainFragment: BookFragment
@ -35,8 +35,6 @@ class NovelMainActivity : NovelBaseActivity() {
//记录用户首次点击返回键的时间 //记录用户首次点击返回键的时间
private var firstTime: Long = 0 private var firstTime: Long = 0
override val layoutId: Int get() = R.layout.activity_main
override fun initView() { override fun initView() {
mCurrentFrag = Fragment() mCurrentFrag = Fragment()
mMainFragment = BookFragment.newInstance() mMainFragment = BookFragment.newInstance()

@ -18,7 +18,7 @@ import java.util.*
/** /**
* 推荐fragment中点击更多跳转来的 * 推荐fragment中点击更多跳转来的
*/ */
class NovelRankListActivity : NovelBaseActivity() { class NovelRankListActivity(override val layoutId: Int= R.layout.activity_rank_list) : NovelBaseActivity() {
private lateinit var mAdapter: RankListAdapter private lateinit var mAdapter: RankListAdapter
private var mList: MutableList<RankByUpdateResp.BookBean> = ArrayList() private var mList: MutableList<RankByUpdateResp.BookBean> = ArrayList()
@ -27,8 +27,6 @@ class NovelRankListActivity : NovelBaseActivity() {
private var type: String = "" private var type: String = ""
private var sex: String = "" private var sex: String = ""
override val layoutId: Int get() = R.layout.activity_rank_list
override fun initView() { override fun initView() {
rlv_book_list.layoutManager = LinearLayoutManager(this) rlv_book_list.layoutManager = LinearLayoutManager(this)
mAdapter = RankListAdapter(mList, rlv_book_list) mAdapter = RankListAdapter(mList, rlv_book_list)

@ -161,18 +161,16 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
toggleMenu(false) toggleMenu(false)
} }
Log.e(TAG, "mBookId: $mBookId")
if (isCollected) { if (isCollected) {
mPageLoader.collBook.bookChapters = mPageLoader.collBook.bookChapters = BookRepository.getInstance().getBookChaptersInRx(mBookId)
BookRepository.getInstance().getBookChaptersInRx(mBookId)
// 刷新章节列表 // 刷新章节列表
mPageLoader.refreshChapterList() mPageLoader.refreshChapterList()
// 如果是网络小说并被标记更新的,则从网络下载目录 // 如果是网络小说并被标记更新的,则从网络下载目录
if (mCollBook.isUpdate && !mCollBook.isLocal) { if (mCollBook.isUpdate && !mCollBook.isLocal) {
AccountManager.getInstance().getBookArticle(mBookId, "2", "1", "10000") AccountManager.getInstance().getBookArticle(mBookId)
} }
} else { } else {
AccountManager.getInstance().getBookArticle(mBookId, "2", "1", "10000") AccountManager.getInstance().getBookArticle(mBookId)
} }
} }

@ -12,9 +12,7 @@ import com.novel.read.widget.VpTabLayout
import kotlinx.android.synthetic.main.activity_recommend_book_list.* import kotlinx.android.synthetic.main.activity_recommend_book_list.*
import java.util.* import java.util.*
class NovelRecommendBookListActivity : NovelBaseActivity() { class NovelRecommendBookListActivity(override val layoutId: Int= R.layout.activity_recommend_book_list) : NovelBaseActivity() {
override val layoutId: Int get() = R.layout.activity_recommend_book_list
override fun initView() { override fun initView() {
val fragmentList = ArrayList<Fragment>() val fragmentList = ArrayList<Fragment>()

@ -32,7 +32,7 @@ import kotlinx.android.synthetic.main.title_search.*
import org.litepal.LitePal import org.litepal.LitePal
import java.util.* import java.util.*
class NovelSearchActivity : NovelBaseActivity() { class NovelSearchActivity(override val layoutId: Int= R.layout.activity_search) : NovelBaseActivity() {
private val mHotList = ArrayList<String>() private val mHotList = ArrayList<String>()
private lateinit var mHotAdapter: HotAdapter private lateinit var mHotAdapter: HotAdapter
@ -46,8 +46,6 @@ class NovelSearchActivity : NovelBaseActivity() {
private var page = 1 private var page = 1
private var loadSize: Int = 0 private var loadSize: Int = 0
override val layoutId: Int get() = R.layout.activity_search
override fun initView() { override fun initView() {
EventManager.instance.registerSubscriber(this) EventManager.instance.registerSubscriber(this)

@ -21,12 +21,10 @@ import com.novel.read.utlis.VersionUtil
import com.squareup.otto.Subscribe import com.squareup.otto.Subscribe
import kotlinx.android.synthetic.main.activity_setting.* import kotlinx.android.synthetic.main.activity_setting.*
class NovelSettingActivity : NovelBaseActivity(), View.OnClickListener { class NovelSettingActivity(override val layoutId: Int = R.layout.activity_setting) : NovelBaseActivity(), View.OnClickListener {
private var resp: VersionResp? = null private var resp: VersionResp? = null
override val layoutId: Int get() = R.layout.activity_setting
override fun initView() { override fun initView() {
EventManager.instance.registerSubscriber(this) EventManager.instance.registerSubscriber(this)
} }
@ -63,12 +61,7 @@ class NovelSettingActivity : NovelBaseActivity(), View.OnClickListener {
AlertDialog.Builder(this) AlertDialog.Builder(this)
.setTitle(getString(R.string.clear_cache)) .setTitle(getString(R.string.clear_cache))
.setCancelable(true) .setCancelable(true)
.setMultiChoiceItems( .setMultiChoiceItems(arrayOf(getString(R.string.clear_cache), getString(R.string.clear_book)), selected) { _, which, isChecked -> selected[which] = isChecked }
arrayOf(
getString(R.string.clear_cache),
getString(R.string.clear_book)
), selected
) { _, which, isChecked -> selected[which] = isChecked }
.setPositiveButton(getString(R.string.sure)) { dialog, _ -> .setPositiveButton(getString(R.string.sure)) { dialog, _ ->
Thread { Thread {
CleanCacheUtils.getInstance() CleanCacheUtils.getInstance()
@ -89,7 +82,7 @@ class NovelSettingActivity : NovelBaseActivity(), View.OnClickListener {
}.start() }.start()
dialog.dismiss() dialog.dismiss()
} }
.setNegativeButton(getString(R.string.cancel)) { dialog, which -> dialog.dismiss() } .setNegativeButton(getString(R.string.cancel)) { dialog, _ -> dialog.dismiss() }
.create().show() .create().show()
} }
R.id.tv_check -> R.id.tv_check ->

@ -86,7 +86,7 @@ class AccountManager private constructor() {
call.enqueue(ServiceCallback(HotSearchEvent::class.java)) call.enqueue(ServiceCallback(HotSearchEvent::class.java))
} }
fun getBookArticle(bookId: String, hasContent: String, page: String, limit: String) { fun getBookArticle(bookId: String, hasContent: String="2", page: String="1", limit: String="100000") {
val map = HashMap<String, String>() val map = HashMap<String, String>()
map["book_id"] = bookId map["book_id"] = bookId
map["has_content"] = hasContent map["has_content"] = hasContent

Loading…
Cancel
Save