Skip to content

Commit 93ba4c3

Browse files
author
Ashwini Kumar
committed
Fix footer issue on pagination
1 parent 7cbc6bc commit 93ba4c3

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

app/src/main/java/com/android/tvmaze/shows/ShowsStateViewHolder.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.view.ViewGroup
55
import androidx.core.view.isVisible
66
import androidx.paging.LoadState
77
import androidx.recyclerview.widget.RecyclerView
8-
import com.android.tvmaze.R
98
import com.android.tvmaze.databinding.NetworkFailureListItemBinding
109

1110
class ShowsStateViewHolder(
@@ -26,9 +25,8 @@ class ShowsStateViewHolder(
2625

2726
companion object {
2827
fun create(parent: ViewGroup, retry: () -> Unit): ShowsStateViewHolder {
29-
val view = LayoutInflater.from(parent.context)
30-
.inflate(R.layout.network_failure_list_item, parent, false)
31-
val binding = NetworkFailureListItemBinding.bind(view)
28+
val layoutInflater = LayoutInflater.from(parent.context)
29+
val binding = NetworkFailureListItemBinding.inflate(layoutInflater, parent, false)
3230
return ShowsStateViewHolder(binding, retry)
3331
}
3432
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414

1515
<androidx.recyclerview.widget.RecyclerView
1616
android:id="@+id/shows"
17-
android:layout_width="match_parent"
18-
android:layout_height="wrap_content"
17+
android:layout_width="0dp"
18+
android:layout_height="0dp"
19+
android:scrollbars="vertical"
1920
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
21+
app:layout_constraintBottom_toBottomOf="parent"
22+
app:layout_constraintEnd_toEndOf="parent"
2023
app:layout_constraintLeft_toLeftOf="parent"
24+
app:layout_constraintStart_toStartOf="parent"
2125
app:layout_constraintTop_toBottomOf="@id/toolbar"
2226
tools:listitem="@layout/show_list_item" />
2327

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,32 @@
2222
android:id="@+id/error_group"
2323
android:layout_width="match_parent"
2424
android:layout_height="wrap_content"
25-
app:constraint_referenced_ids="retry, error_msg" />
25+
android:visibility="gone"
26+
app:constraint_referenced_ids="retry, error_msg"
27+
tools:visibility="visible" />
2628

2729
<TextView
2830
android:id="@+id/error_msg"
2931
android:layout_width="wrap_content"
3032
android:layout_height="wrap_content"
31-
android:layout_marginTop="16dp"
33+
android:gravity="center"
3234
android:textColor="@color/red"
3335
android:textSize="14sp"
3436
android:textStyle="bold"
35-
app:layout_constraintBaseline_toBaselineOf="@id/retry"
36-
app:layout_constraintHorizontal_bias="0"
37+
app:layout_constraintBottom_toBottomOf="parent"
3738
app:layout_constraintLeft_toLeftOf="parent"
38-
app:layout_constraintRight_toLeftOf="@id/retry"
39+
app:layout_constraintRight_toRightOf="parent"
3940
app:layout_constraintTop_toTopOf="parent"
40-
tools:text="No Internet Connection " />
41+
tools:text="No Internet Connection. Please check your internet connection and try again " />
4142

4243
<Button
4344
android:id="@+id/retry"
4445
android:layout_width="wrap_content"
4546
android:layout_height="wrap_content"
4647
android:text="@string/retry"
4748
app:layout_constraintBottom_toBottomOf="parent"
49+
app:layout_constraintLeft_toLeftOf="parent"
4850
app:layout_constraintRight_toRightOf="parent"
49-
app:layout_constraintTop_toTopOf="parent" />
51+
app:layout_constraintTop_toBottomOf="@id/error_msg" />
5052
</androidx.constraintlayout.widget.ConstraintLayout>
5153
</layout>

0 commit comments

Comments
 (0)