Skip to content

Commit

Permalink
fix: view laggy
Browse files Browse the repository at this point in the history
  • Loading branch information
std-microblock committed Feb 5, 2024
1 parent c6d1d50 commit 93d3232
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ class RecyclerAdapterStickerList(private val act: MainActivity) :
.into(holder.imageView)
holder.videoCard.visibility = View.GONE
holder.imageView.visibility = View.VISIBLE
holder.videoView.stopPlayback()
}
"webm" -> {
holder.videoView.setVideoURI(Uri.fromFile(File(s.preview.url)))
holder.videoView.setVideoPath(s.preview.url)
holder.videoView.start()
holder.videoView.setOnPreparedListener {
it.isLooping = true
it.setVolume(0f, 0f)
}
holder.videoView.setOnErrorListener { mp, what, extra ->
YLog.error("VideoView error: $what, $extra")
Expand All @@ -121,6 +123,7 @@ class RecyclerAdapterStickerList(private val act: MainActivity) :
holder.imageView.setImageResource(R.drawable.ic_launcher_background)
holder.imageView.visibility = View.VISIBLE
holder.videoCard.visibility = View.GONE
holder.videoView.stopPlayback()
}
}

Expand Down Expand Up @@ -352,6 +355,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
super.onScrollStateChanged(recyclerView, newState)
}
})
binding.stickerManageView.javaClass.getDeclaredField("mMaxFlingVelocity").let {
it.isAccessible = true
it.set(binding.stickerManageView, 1000)
}


stickerList.observe(this) {
runOnUiThread {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
android:orientation="vertical"
android:paddingHorizontal="20dp"
android:paddingVertical="20dp"
android:visibility="visible">
android:visibility="gone">

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
Expand Down

0 comments on commit 93d3232

Please sign in to comment.