Commit 0c88bda6 authored by jyx's avatar jyx

代码优化

parent e6050513
......@@ -8,7 +8,6 @@ import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.View
import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.SimpleItemAnimator
import com.duben.dayplaylet.R
......@@ -34,7 +33,6 @@ import com.duben.dayplaylet.ui.widgets.DialogListener
import com.duben.dayplaylet.ui.widgets.RedPkgAwardDialog
import com.duben.dayplaylet.ui.widgets.WithDrawSucDialog
import com.duben.dayplaylet.utils.UIUtils
import com.duben.library.utils.GlideUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.fragment_redpkg.*
import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent
......@@ -451,5 +449,24 @@ class RedpkgFragment : LazyLoadBaseFragment(), View.OnClickListener, RedpkgView
mWithDrawSucDialog?.show()
}
// 滚动到未领取的红包位置
private fun scrollToRedpkg() {
mMsgAdapter?.let {
if (it.data.size <= 0) return
var scrollPosition = 0
for (i in it.data.size - 1 downTo 0) {
if (it.data[i].itemType == 2 && !it.data[i].data.isGetRedpkg) {
scrollPosition = i
break
}
}
ry_redpkg.smoothScrollToPosition(scrollPosition)
}
}
override fun onResume() {
super.onResume()
scrollToRedpkg()
}
}
\ No newline at end of file
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