Remove unused variables.

This commit is contained in:
Alex Ning 2021-09-06 23:19:13 +08:00
parent 0b8e8076fc
commit 01e1103d3d
4 changed files with 9 additions and 8 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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());

View File

@ -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"