mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
Fix NullPointerException in PostFilter.mergePostFilter. Minor bugs fixed in CommentsListingFragment.
This commit is contained in:
parent
370e02c311
commit
efd8d1c080
@ -254,6 +254,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
|
||||
}
|
||||
|
||||
private void bindView(Resources resources) {
|
||||
if (mActivity != null && !mActivity.isFinishing() && !mActivity.isDestroyed()) {
|
||||
mLinearLayoutManager = new LinearLayoutManager(mActivity);
|
||||
mCommentRecyclerView.setLayoutManager(mLinearLayoutManager);
|
||||
|
||||
@ -329,6 +330,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
|
||||
|
||||
mSwipeRefreshLayout.setOnRefreshListener(() -> mCommentViewModel.refresh());
|
||||
}
|
||||
}
|
||||
|
||||
public void changeSortType(SortType sortType) {
|
||||
mCommentViewModel.changeSortType(sortType);
|
||||
|
@ -212,10 +212,10 @@ public class PostFilter implements Parcelable {
|
||||
}
|
||||
|
||||
public static PostFilter mergePostFilter(List<PostFilter> postFilterList) {
|
||||
PostFilter postFilter = new PostFilter();
|
||||
if (postFilterList.size() == 1) {
|
||||
return postFilterList.get(0);
|
||||
}
|
||||
PostFilter postFilter = new PostFilter();
|
||||
StringBuilder stringBuilder;
|
||||
postFilter.name = "Merged";
|
||||
for (PostFilter p : postFilterList) {
|
||||
@ -229,30 +229,39 @@ public class PostFilter implements Parcelable {
|
||||
postFilter.onlyNSFW = p.onlyNSFW ? p.onlyNSFW : postFilter.onlyNSFW;
|
||||
postFilter.onlySpoiler = p.onlySpoiler ? p.onlySpoiler : postFilter.onlySpoiler;
|
||||
|
||||
postFilter.postTitleExcludesRegex = p.postTitleExcludesRegex.equals("") ? postFilter.postTitleExcludesRegex : p.postTitleExcludesRegex;
|
||||
stringBuilder = new StringBuilder(postFilter.postTitleExcludesStrings);
|
||||
if (p.postTitleExcludesRegex != null && !p.postTitleExcludesRegex.equals("")) {
|
||||
postFilter.postTitleExcludesRegex = p.postTitleExcludesRegex;
|
||||
}
|
||||
|
||||
if (p.postTitleExcludesStrings != null && !p.postTitleExcludesStrings.equals("")) {
|
||||
stringBuilder = new StringBuilder(postFilter.postTitleExcludesStrings == null ? "" : postFilter.postTitleExcludesStrings);
|
||||
stringBuilder.append(",").append(p.postTitleExcludesStrings);
|
||||
postFilter.postTitleExcludesStrings = stringBuilder.toString();
|
||||
}
|
||||
|
||||
postFilter.excludeSubreddits = p.excludeSubreddits.equals("") ? postFilter.excludeSubreddits : p.postTitleExcludesRegex;
|
||||
stringBuilder = new StringBuilder(postFilter.excludeSubreddits);
|
||||
if (p.excludeSubreddits != null && !p.excludeSubreddits.equals("")) {
|
||||
stringBuilder = new StringBuilder(postFilter.excludeSubreddits == null ? "" : postFilter.excludeSubreddits);
|
||||
stringBuilder.append(",").append(p.excludeSubreddits);
|
||||
postFilter.excludeSubreddits = stringBuilder.toString();
|
||||
}
|
||||
|
||||
postFilter.excludeUsers = p.excludeUsers.equals("") ? postFilter.excludeUsers : p.postTitleExcludesRegex;
|
||||
stringBuilder = new StringBuilder(postFilter.excludeUsers);
|
||||
if (p.excludeUsers != null && !p.excludeUsers.equals("")) {
|
||||
stringBuilder = new StringBuilder(postFilter.excludeUsers == null ? "" : postFilter.excludeUsers);
|
||||
stringBuilder.append(",").append(p.excludeUsers);
|
||||
postFilter.excludeUsers = stringBuilder.toString();
|
||||
}
|
||||
|
||||
postFilter.containFlairs = p.containFlairs.equals("") ? postFilter.containFlairs : p.postTitleExcludesRegex;
|
||||
stringBuilder = new StringBuilder(postFilter.containFlairs);
|
||||
if (p.containFlairs != null && !p.containFlairs.equals("")) {
|
||||
stringBuilder = new StringBuilder(postFilter.containFlairs == null ? "" : postFilter.containFlairs);
|
||||
stringBuilder.append(",").append(p.containFlairs);
|
||||
postFilter.containFlairs = stringBuilder.toString();
|
||||
}
|
||||
|
||||
postFilter.excludeFlairs = p.excludeFlairs.equals("") ? postFilter.excludeFlairs : p.postTitleExcludesRegex;
|
||||
stringBuilder = new StringBuilder(postFilter.excludeFlairs);
|
||||
if (p.excludeFlairs != null && !p.excludeFlairs.equals("")) {
|
||||
stringBuilder = new StringBuilder(postFilter.excludeFlairs == null ? "" : postFilter.excludeFlairs);
|
||||
stringBuilder.append(",").append(p.excludeFlairs);
|
||||
postFilter.excludeFlairs = stringBuilder.toString();
|
||||
}
|
||||
|
||||
postFilter.containTextType = p.containTextType || postFilter.containTextType;
|
||||
postFilter.containLinkType = p.containLinkType || postFilter.containLinkType;
|
||||
|
Loading…
Reference in New Issue
Block a user