mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-26 03:09:04 +00:00
prevent scroll to top from showing when it shouldn't
fix zero state Changelog: changed
This commit is contained in:
parent
3310ac6008
commit
e1abb7f8ae
5 changed files with 14 additions and 13 deletions
|
@ -1155,7 +1155,6 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
|
||||||
|
|
||||||
if (segment.isMainView) {
|
if (segment.isMainView) {
|
||||||
var transaction = supportFragmentManager.beginTransaction();
|
var transaction = supportFragmentManager.beginTransaction();
|
||||||
transaction.setReorderingAllowed(true)
|
|
||||||
if (segment.topBar != null) {
|
if (segment.topBar != null) {
|
||||||
if (segment.topBar != fragCurrent.topBar) {
|
if (segment.topBar != fragCurrent.topBar) {
|
||||||
transaction = transaction
|
transaction = transaction
|
||||||
|
|
|
@ -101,6 +101,8 @@ class ShortsFragment : MainFragment() {
|
||||||
viewPager?.adapter?.notifyDataSetChanged()
|
viewPager?.adapter?.notifyDataSetChanged()
|
||||||
viewPager?.currentItem = 0
|
viewPager?.currentItem = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateZeroState()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateMainView(
|
override fun onCreateMainView(
|
||||||
|
@ -201,7 +203,7 @@ class ShortsFragment : MainFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateZeroState() {
|
private fun updateZeroState() {
|
||||||
if (mainShorts.isEmpty()) {
|
if (mainShorts.isEmpty() && !isChannelShortsMode && loadPagerTask == null) {
|
||||||
zeroState.visibility = View.VISIBLE
|
zeroState.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
zeroState.visibility = View.GONE
|
zeroState.visibility = View.GONE
|
||||||
|
|
|
@ -3018,7 +3018,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
}
|
}
|
||||||
else if(isOverlayed) {
|
else if(isOverlayed) {
|
||||||
_playerProgress.layoutParams = _playerProgress.layoutParams.apply {
|
_playerProgress.layoutParams = _playerProgress.layoutParams.apply {
|
||||||
(this as MarginLayoutParams).bottomMargin = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -6f, resources.displayMetrics).toInt();
|
(this as MarginLayoutParams).bottomMargin = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -2f, resources.displayMetrics).toInt();
|
||||||
};
|
};
|
||||||
_playerProgress.elevation = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, resources.displayMetrics);
|
_playerProgress.elevation = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, resources.displayMetrics);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,15 +68,7 @@ class CommentsList : ConstraintLayout {
|
||||||
UIDialogs.showGeneralRetryErrorDialog(context, it.message ?: "", it, { loadNextPage() });
|
UIDialogs.showGeneralRetryErrorDialog(context, it.message ?: "", it, { loadNextPage() });
|
||||||
};
|
};
|
||||||
|
|
||||||
private val _scrollListener = object : RecyclerView.OnScrollListener() {
|
private val _scrollListener: RecyclerView.OnScrollListener
|
||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
|
||||||
onScrolled();
|
|
||||||
|
|
||||||
val totalScrollDistance = recyclerView.computeVerticalScrollOffset()
|
|
||||||
_layoutScrollToTop.visibility = if (totalScrollDistance > recyclerView.height) View.VISIBLE else View.GONE
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private var _loader: (suspend () -> IPager<IPlatformComment>)? = null;
|
private var _loader: (suspend () -> IPager<IPlatformComment>)? = null;
|
||||||
private val _adapterComments: InsertedViewAdapterWithLoader<CommentViewHolder>;
|
private val _adapterComments: InsertedViewAdapterWithLoader<CommentViewHolder>;
|
||||||
|
@ -131,6 +123,14 @@ class CommentsList : ConstraintLayout {
|
||||||
_llmReplies = LinearLayoutManager(context);
|
_llmReplies = LinearLayoutManager(context);
|
||||||
_recyclerComments.layoutManager = _llmReplies;
|
_recyclerComments.layoutManager = _llmReplies;
|
||||||
_recyclerComments.adapter = _adapterComments;
|
_recyclerComments.adapter = _adapterComments;
|
||||||
|
_scrollListener = object : RecyclerView.OnScrollListener() {
|
||||||
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
|
onScrolled();
|
||||||
|
|
||||||
|
_layoutScrollToTop.visibility = if (_llmReplies.findFirstCompletelyVisibleItemPosition() > 5) View.VISIBLE else View.GONE
|
||||||
|
}
|
||||||
|
};
|
||||||
_recyclerComments.addOnScrollListener(_scrollListener);
|
_recyclerComments.addOnScrollListener(_scrollListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/bottom_bar_buttons"
|
android:id="@+id/bottom_bar_buttons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="52dp"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue