aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java3
-rw-r--r--app/src/main/res/layout/item_paging_3_load_state.xml2
4 files changed, 9 insertions, 8 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java
index e23dc4dd..0c094f4f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java
@@ -4,7 +4,6 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -14,6 +13,8 @@ import androidx.paging.LoadState;
import androidx.paging.LoadStateAdapter;
import androidx.recyclerview.widget.RecyclerView;
+import com.google.android.material.button.MaterialButton;
+
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
@@ -43,7 +44,7 @@ public class Paging3LoadingStateAdapter extends LoadStateAdapter<Paging3LoadingS
private ProgressBar mProgressBar;
private RelativeLayout mErrorView;
private TextView mErrorMsg;
- private Button mRetry;
+ private MaterialButton mRetry;
LoadStateViewHolder(@NonNull View itemView, @NonNull View.OnClickListener retryCallback) {
super(itemView);
@@ -55,6 +56,8 @@ public class Paging3LoadingStateAdapter extends LoadStateAdapter<Paging3LoadingS
mErrorMsg.setText(mErrorStringId);
mErrorMsg.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
+ mRetry.setBackgroundColor(mCustomThemeWrapper.getColorPrimaryLightTheme());
+ mRetry.setTextColor(mCustomThemeWrapper.getButtonTextColor());
mRetry.setOnClickListener(retryCallback);
mErrorView.setOnClickListener(retryCallback);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index df1f36ee..51d893f8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -14,7 +14,6 @@ import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -138,7 +137,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private int mPostType;
private int mPostLayout;
private int mDefaultLinkPostLayout;
- private int mColorPrimaryLightTheme;
private int mColorAccent;
private int mCardViewBackgroundColor;
private int mReadPostCardViewBackgroundColor;
@@ -169,7 +167,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private int mUpvotedColor;
private int mDownvotedColor;
private int mVoteAndReplyUnavailableVoteButtonColor;
- private int mButtonTextColor;
private int mPostIconAndInfoColor;
private int mDividerColor;
private int mHideReadPostsIndex = 0;
@@ -284,7 +281,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mPostLayout = postLayout;
mDefaultLinkPostLayout = Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.DEFAULT_LINK_POST_LAYOUT_KEY, "-1"));
- mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorAccent = customThemeWrapper.getColorAccent();
mCardViewBackgroundColor = customThemeWrapper.getCardViewBackgroundColor();
mReadPostCardViewBackgroundColor = customThemeWrapper.getReadPostCardViewBackgroundColor();
@@ -315,7 +311,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mUpvotedColor = customThemeWrapper.getUpvoted();
mDownvotedColor = customThemeWrapper.getDownvoted();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableButtonColor();
- mButtonTextColor = customThemeWrapper.getButtonTextColor();
mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor();
mDividerColor = customThemeWrapper.getDividerColor();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index 3c32e1be..ba317c36 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -1157,12 +1157,15 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mSwipeRefreshLayout.setRefreshing(refreshLoadState instanceof LoadState.Loading);
if (refreshLoadState instanceof LoadState.NotLoading) {
if (refreshLoadState.getEndOfPaginationReached() && mAdapter.getItemCount() < 1) {
+ hasPost = false;
if (isInLazyMode) {
stopLazyMode();
}
mFetchPostInfoLinearLayout.setOnClickListener(null);
showErrorView(R.string.no_posts);
+ } else {
+ hasPost = true;
}
} else if (refreshLoadState instanceof LoadState.Error) {
mFetchPostInfoLinearLayout.setOnClickListener(view -> refresh());
diff --git a/app/src/main/res/layout/item_paging_3_load_state.xml b/app/src/main/res/layout/item_paging_3_load_state.xml
index 321b8e14..4256b33b 100644
--- a/app/src/main/res/layout/item_paging_3_load_state.xml
+++ b/app/src/main/res/layout/item_paging_3_load_state.xml
@@ -30,7 +30,7 @@
android:textSize="?attr/font_18"
android:fontFamily="?attr/font_family" />
- <Button
+ <com.google.android.material.button.MaterialButton
android:id="@+id/retry_button_item_paging_3_load_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"