Commit b17c8adc authored by jyx's avatar jyx

优化样式

parent 7f90e6c6
...@@ -127,11 +127,11 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView { ...@@ -127,11 +127,11 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
label_tv.text = data.author label_tv.text = data.author
if (data.isCollect == 1) { if (data.isCollect == 1) {
tab_iv_bookshelf.setImageResource(R.mipmap.bookshelf) tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect_s)
tab_tv_bookshelf.text = "已收藏" tab_tv_bookshelf.text = "已收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.color_goldenrod)) tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.color_goldenrod))
} else { } else {
tab_iv_bookshelf.setImageResource(R.mipmap.bookshelf) tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect)
tab_tv_bookshelf.text = "收藏" tab_tv_bookshelf.text = "收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.black)) tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.black))
} }
...@@ -140,12 +140,12 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView { ...@@ -140,12 +140,12 @@ class BookReadActivity : BaseActivity(), View.OnClickListener, BookReadView {
private fun setIsCollect(collect: Boolean) { private fun setIsCollect(collect: Boolean) {
isCollect = collect isCollect = collect
if (isCollect) { if (isCollect) {
tab_iv_bookshelf.setImageResource(R.mipmap.bookshelf) tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect_s)
tab_tv_bookshelf.text = "已收藏" tab_tv_bookshelf.text = "已收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.color_goldenrod)) tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.color_goldenrod))
readPresenter.collect(bookId) readPresenter.collect(bookId)
} else { } else {
tab_iv_bookshelf.setImageResource(R.mipmap.bookshelf) tab_iv_bookshelf.setImageResource(R.mipmap.ic_book_collect)
tab_tv_bookshelf.text = "收藏" tab_tv_bookshelf.text = "收藏"
tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.black)) tab_tv_bookshelf.setTextColor(ContextCompat.getColor(this, R.color.black))
readPresenter.cancelCollect(bookId) readPresenter.cancelCollect(bookId)
......
...@@ -19,7 +19,6 @@ import com.mints.enjoyboxjia.ui.adapter.SearchBookAdapter ...@@ -19,7 +19,6 @@ import com.mints.enjoyboxjia.ui.adapter.SearchBookAdapter
import com.mints.enjoyboxjia.ui.adapter.SearchHistoryAdapter import com.mints.enjoyboxjia.ui.adapter.SearchHistoryAdapter
import com.mints.enjoyboxjia.ui.adapter.SearchHotBookAdapter import com.mints.enjoyboxjia.ui.adapter.SearchHotBookAdapter
import com.mints.enjoyboxjia.utils.AppPreferencesManager import com.mints.enjoyboxjia.utils.AppPreferencesManager
import com.mints.enjoyboxjia.utils.LogUtil
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener import com.scwang.smartrefresh.layout.listener.OnRefreshListener
...@@ -108,6 +107,9 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView, ...@@ -108,6 +107,9 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView,
R.id.iv_clear -> { R.id.iv_clear -> {
clearSearchHistory() clearSearchHistory()
} }
R.id.iv_change -> {
searchPresenter.getHotBook()
}
} }
} }
...@@ -117,6 +119,7 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView, ...@@ -117,6 +119,7 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView,
iv_left_icon.setOnClickListener(this) iv_left_icon.setOnClickListener(this)
btn_search.setOnClickListener(this) btn_search.setOnClickListener(this)
iv_clear.setOnClickListener(this) iv_clear.setOnClickListener(this)
iv_change.setOnClickListener(this)
et_search.addTextChangedListener(object : TextWatcher { et_search.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
...@@ -145,7 +148,7 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView, ...@@ -145,7 +148,7 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView,
override fun getHotBookSuc(data: BookListBean) { override fun getHotBookSuc(data: BookListBean) {
searchHotBookData.clear() searchHotBookData.clear()
searchHotBookData.addAll(data.records) searchHotBookData.addAll(data.records)
searchHotBookAdapter?.setNewInstance(searchHotBookData) searchHotBookAdapter?.setList(searchHotBookData)
} }
override fun getHotBookFail() { override fun getHotBookFail() {
...@@ -165,7 +168,7 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView, ...@@ -165,7 +168,7 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView,
srl_show.finishRefresh(true) srl_show.finishRefresh(true)
searchBookData.clear() searchBookData.clear()
searchBookData.addAll(data.records) searchBookData.addAll(data.records)
searchBookAdapter?.setNewInstance(data.records) searchBookAdapter?.setList(data.records)
} else { } else {
if (data.records.size < searchPageSize) { if (data.records.size < searchPageSize) {
srl_show.finishLoadMoreWithNoMoreData() srl_show.finishLoadMoreWithNoMoreData()
...@@ -183,7 +186,6 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView, ...@@ -183,7 +186,6 @@ class BookSearchActivity : BaseActivity(), View.OnClickListener, BookSearchView,
} }
private fun addSearchHistory(str: String) { private fun addSearchHistory(str: String) {
LogUtil.d("XXXXXXXXXX", str)
var searchHistory = AppPreferencesManager.get().getString(BOOK_SEARCH_HISTORY, "") var searchHistory = AppPreferencesManager.get().getString(BOOK_SEARCH_HISTORY, "")
searchHistory += ",$str" searchHistory += ",$str"
AppPreferencesManager.get().put(BOOK_SEARCH_HISTORY, searchHistory) AppPreferencesManager.get().put(BOOK_SEARCH_HISTORY, searchHistory)
......
...@@ -146,27 +146,15 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe ...@@ -146,27 +146,15 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
} }
} }
override fun onFragmentResume() {
// if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_TWO) {
// if (AntiShake.check(banner?.id)) return
// banner?.start()
// if (TextUtils.isEmpty(userManager?.userID)) {
// //获取游客登录数据
// bookCityPresenter.userLogin()
// } else {
// bookCityPresenter.getBannerBook()
// bookCityPresenter.getHotBook()
// bookCityPresenter.getNewBook()
// }
// }
}
override fun getHotBookSuc(data: BookListBean) { override fun getHotBookSuc(data: BookListBean) {
hotBookData.clear() hotBookData.clear()
hotBookData.addAll(data.records) hotBookData.addAll(data.records)
hotBookData.removeAt(0) hotBookData.removeAt(0)
hotBookAdapter?.addHeaderView(getHotHeader(data.records[0]))
hotBookAdapter?.setNewInstance(hotBookData) hotBookAdapter?.let {
it.setHeaderView(getHotHeader(data.records[0]))
it.setList(hotBookData)
}
} }
override fun getHotBookFail() {} override fun getHotBookFail() {}
...@@ -174,7 +162,7 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe ...@@ -174,7 +162,7 @@ class BookCityFragment : LazyLoadBaseFragment(), BookCityView, View.OnClickListe
override fun getNewBookSuc(data: BookListBean) { override fun getNewBookSuc(data: BookListBean) {
newBookData.clear() newBookData.clear()
newBookData.addAll(data.records) newBookData.addAll(data.records)
newBookAdapter?.setNewInstance(newBookData) newBookAdapter?.setList(newBookData)
} }
override fun getNewBookFail() {} override fun getNewBookFail() {}
......
...@@ -134,7 +134,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis ...@@ -134,7 +134,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
shelfBookData.clear() shelfBookData.clear()
shelfBookData.addAll(data.records) shelfBookData.addAll(data.records)
shelfBookData.add(BookBean()) shelfBookData.add(BookBean())
bookShelfAdapter?.setNewInstance(shelfBookData) bookShelfAdapter?.setList(shelfBookData)
bookShelfAdapter?.setEditStyle(false) bookShelfAdapter?.setEditStyle(false)
} else { } else {
bookshelf_empty.visibility = View.VISIBLE bookshelf_empty.visibility = View.VISIBLE
...@@ -148,7 +148,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis ...@@ -148,7 +148,7 @@ class BookShelfFragment : LazyLoadBaseFragment(), BookShelfView, View.OnClickLis
override fun getArticleLikeSuc(data: BookListBean) { override fun getArticleLikeSuc(data: BookListBean) {
likeBookData.clear() likeBookData.clear()
likeBookData.addAll(data.records) likeBookData.addAll(data.records)
likeBookAdapter?.setNewInstance(likeBookData) likeBookAdapter?.setList(likeBookData)
} }
override fun getArticleLikeFail() { override fun getArticleLikeFail() {
......
...@@ -67,6 +67,8 @@ ...@@ -67,6 +67,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:drawableStart="@mipmap/ic_author"
android:drawablePadding="2dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/color_378eff" android:textColor="@color/color_378eff"
...@@ -144,7 +146,7 @@ ...@@ -144,7 +146,7 @@
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:contentDescription="@null" android:contentDescription="@null"
android:src="@drawable/selector_tab_bookshelf" /> android:paddingTop="2dp" />
<TextView <TextView
android:id="@+id/tab_tv_bookshelf" android:id="@+id/tab_tv_bookshelf"
...@@ -169,7 +171,7 @@ ...@@ -169,7 +171,7 @@
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:contentDescription="@null" android:contentDescription="@null"
android:src="@drawable/selector_tab_bookshelf" /> android:src="@mipmap/ic_book_setting" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -193,7 +195,7 @@ ...@@ -193,7 +195,7 @@
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:contentDescription="@null" android:contentDescription="@null"
android:src="@drawable/selector_tab_bookshelf" /> android:src="@mipmap/ic_book_share" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
android:id="@+id/iv_clear" android:id="@+id/iv_clear"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@mipmap/ic_text_clear" /> android:src="@mipmap/ic_rubbish" />
</LinearLayout> </LinearLayout>
...@@ -147,7 +147,10 @@ ...@@ -147,7 +147,10 @@
android:id="@+id/iv_change" android:id="@+id/iv_change"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="换一换" /> android:drawableStart="@mipmap/ic_change"
android:drawablePadding="6dp"
android:text="换一换"
android:textColor="@color/gray" />
</LinearLayout> </LinearLayout>
......
...@@ -69,7 +69,10 @@ ...@@ -69,7 +69,10 @@
android:id="@+id/iv_change_hot" android:id="@+id/iv_change_hot"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="换一换" /> android:drawableStart="@mipmap/ic_change"
android:drawablePadding="6dp"
android:text="换一换"
android:textColor="@color/gray" />
</LinearLayout> </LinearLayout>
...@@ -110,7 +113,10 @@ ...@@ -110,7 +113,10 @@
android:id="@+id/iv_change_new" android:id="@+id/iv_change_new"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="换一换" /> android:drawableStart="@mipmap/ic_change"
android:drawablePadding="6dp"
android:text="换一换"
android:textColor="@color/gray" />
</LinearLayout> </LinearLayout>
......
...@@ -142,7 +142,10 @@ ...@@ -142,7 +142,10 @@
android:id="@+id/iv_change" android:id="@+id/iv_change"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="换一换" /> android:drawableStart="@mipmap/ic_change"
android:drawablePadding="6dp"
android:text="换一换"
android:textColor="@color/gray" />
</LinearLayout> </LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment