Error handling for loading posts now works again. Don't show refresh button as an icon. Rewrite some code.

This commit is contained in:
Alex Ning
2018-12-29 13:38:18 +08:00
parent 93a9ad9ece
commit b7e1d92c7e
14 changed files with 251 additions and 299 deletions

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relative_layout_footer_progress_bar_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/retry_button_footer_progress_bar_item"
android:text="@string/load_data_failed"
android:textSize="18sp" />
<Button
android:id="@+id/retry_button_footer_progress_bar_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:text="@string/retry" />
</RelativeLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/progress_bar_footer_progress_bar_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:layout_centerHorizontal="true" />
</RelativeLayout>

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linear_layout_footer_progress_bar_item"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progress_bar_footer_progress_bar_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:layout_gravity="center" />
<RelativeLayout
android:id="@+id/relative_layout_footer_progress_bar_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/retry_button_footer_progress_bar_item"
android:layout_alignParentStart="true"
android:text="@string/load_data_failed"
android:textSize="18sp"
android:layout_centerVertical="true" />
<Button
android:id="@+id/retry_button_footer_progress_bar_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@color/colorAccent"
android:text="@string/retry" />
</RelativeLayout>
</LinearLayout>

View File

@@ -8,5 +8,5 @@
android:orderInCategory="1"
android:title="@string/action_refresh"
android:icon="@drawable/ic_refresh_white_24dp"
app:showAsAction="always" />
app:showAsAction="never" />
</menu>