Skip to content

Commit

Permalink
Removed unnecessary layout
Browse files Browse the repository at this point in the history
  • Loading branch information
litetex committed Sep 10, 2021
1 parent 123d8fe commit f260cc3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
14 changes: 7 additions & 7 deletions app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
!recyclerView.canScrollVertically(-1)
) {

if (feedBinding.newItemsLoadedLayout.isVisible) {
if (feedBinding.newItemsLoadedButton.isVisible) {
hideNewItemsLoaded(true)
}
}
Expand Down Expand Up @@ -619,8 +619,8 @@ class FeedFragment : BaseStateFragment<FeedState>() {
}

private fun showNewItemsLoaded() {
feedBinding.newItemsLoadedLayout.clearAnimation()
feedBinding.newItemsLoadedLayout
feedBinding.newItemsLoadedButton.clearAnimation()
feedBinding.newItemsLoadedButton
.slideUp(
250L,
delay = 100,
Expand All @@ -636,20 +636,20 @@ class FeedFragment : BaseStateFragment<FeedState>() {
}

private fun hideNewItemsLoaded(animate: Boolean, delay: Long = 0) {
feedBinding.newItemsLoadedLayout.clearAnimation()
feedBinding.newItemsLoadedButton.clearAnimation()
if (animate) {
feedBinding.newItemsLoadedLayout.animate(
feedBinding.newItemsLoadedButton.animate(
false,
200,
delay = delay,
execOnEnd = {
// Make the layout invisible so that the onScroll toTop method
// only does necessary work
feedBinding?.newItemsLoadedLayout?.isVisible = false
feedBinding?.newItemsLoadedButton?.isVisible = false
}
)
} else {
feedBinding.newItemsLoadedLayout.isVisible = false
feedBinding.newItemsLoadedButton.isVisible = false
}
}

Expand Down
26 changes: 8 additions & 18 deletions app/src/main/res/layout/fragment_feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,15 @@

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/new_items_loaded_layout"
android:layout_width="match_parent"
<Button
android:id="@+id/new_items_loaded_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"
tools:visibility="visible">

<Button
android:id="@+id/new_items_loaded_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/feed_new_items"
android:textSize="12sp"
android:theme="@style/ServiceColoredButton"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_alignBottom="@id/swipeRefreshLayout"
android:layout_centerHorizontal="true"
android:text="@string/feed_new_items"
android:textSize="12sp"
android:theme="@style/ServiceColoredButton" />

<LinearLayout
android:id="@+id/loading_panel_root"
Expand Down

0 comments on commit f260cc3

Please sign in to comment.