Skip to content

Commit ed45b7e

Browse files
committed
修复头像加载,去除收藏
1 parent ff8e0a1 commit ed45b7e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

app/src/main/kotlin/com/rayfantasy/icode/ui/activity/ReplyActivity.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import org.jetbrains.anko.support.v4.onRefresh
2323
import org.jetbrains.anko.toast
2424

2525
class ReplyActivity : ActivityBindingStatus() {
26+
companion object{
27+
const val LOAD_ONCE = 5
28+
}
2629
private var id: Int = 1
2730
private lateinit var adapter: ReplyListAdapter
2831
private val isRefreshing: Boolean
@@ -83,7 +86,7 @@ class ReplyActivity : ActivityBindingStatus() {
8386
//生成加载条件,目前加载5个,方便测试
8487

8588
val condition = "WHERE ${if (!refresh && adapter.replyList.isNotEmpty()) "createat < ${adapter.replyList.last().createAt} " else ""}good_id=$id " +
86-
"ORDER BY createat DESC LIMIT 0, 5"
89+
"ORDER BY createat DESC LIMIT 0, $LOAD_ONCE"
8790
request = PostUtil.findReply(condition, {
8891
reply_swip.isRefreshing = false
8992
request = null

app/src/main/kotlin/com/rayfantasy/icode/ui/adapter/BlockAdapter.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BlockAdapter(ctx: Context, val codeGood: CodeGood, var blocks: List<CodeG
4646

4747
}
4848

49-
override fun getItemCount() = blocks.size + 2
49+
override fun getItemCount() = blocks.size + 1
5050

5151
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when (viewType) {
5252
CodeGood.BlockType.CODE -> CodeViewHolder(parent.inflate(R.layout.item_block_code) as ViewGroup, highlightTheme)
@@ -57,7 +57,7 @@ class BlockAdapter(ctx: Context, val codeGood: CodeGood, var blocks: List<CodeG
5757

5858
}
5959

60-
override fun getItemViewType(position: Int) = if (position == 0) TITLE_VIEW else if (position == blocks.size+1) FAVORITE_VIEW else {
60+
override fun getItemViewType(position: Int) = if (position == 0) TITLE_VIEW/* else if (position == blocks.size+1) FAVORITE_VIEW */else {
6161
blocks[position - 1].blockType
6262
}
6363

app/src/main/res/layout/item_block_title.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
android:layout_width="match_parent"
66
android:layout_height="wrap_content">
77
<ImageView
8-
android:layout_width="wrap_content"
9-
android:layout_height="wrap_content"
8+
android:layout_width="@dimen/profile_pic_size"
9+
android:layout_height="@dimen/profile_pic_size"
1010
android:src="@mipmap/ic_user_black"
1111
android:id="@+id/block_userIcon"
1212
android:layout_marginLeft="10dp"

0 commit comments

Comments
 (0)