Fix timeline breaking due to newly introduced variables in utils classes
This commit is contained in:
parent
73dc85a115
commit
95976d6869
|
@ -146,6 +146,7 @@ public class TimelineFragment extends SFragment implements
|
||||||
private boolean didLoadEverythingBottom;
|
private boolean didLoadEverythingBottom;
|
||||||
|
|
||||||
private boolean alwaysShowSensitiveMedia;
|
private boolean alwaysShowSensitiveMedia;
|
||||||
|
private boolean collapseLongStatusContent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TimelineCases timelineCases() {
|
protected TimelineCases timelineCases() {
|
||||||
|
@ -158,7 +159,11 @@ public class TimelineFragment extends SFragment implements
|
||||||
public StatusViewData apply(Either<Placeholder, Status> input) {
|
public StatusViewData apply(Either<Placeholder, Status> input) {
|
||||||
Status status = input.getAsRightOrNull();
|
Status status = input.getAsRightOrNull();
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
return ViewDataUtils.statusToViewData(status, alwaysShowSensitiveMedia);
|
return ViewDataUtils.statusToViewData(
|
||||||
|
status,
|
||||||
|
alwaysShowSensitiveMedia,
|
||||||
|
collapseLongStatusContent
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
Placeholder placeholder = input.getAsLeft();
|
Placeholder placeholder = input.getAsLeft();
|
||||||
return new StatusViewData.Placeholder(placeholder.id, false);
|
return new StatusViewData.Placeholder(placeholder.id, false);
|
||||||
|
@ -262,6 +267,8 @@ public class TimelineFragment extends SFragment implements
|
||||||
filterRemoveRegexMatcher = Pattern.compile(regexFilter, Pattern.CASE_INSENSITIVE)
|
filterRemoveRegexMatcher = Pattern.compile(regexFilter, Pattern.CASE_INSENSITIVE)
|
||||||
.matcher("");
|
.matcher("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collapseLongStatusContent = preferences.getBoolean("collapseLongStatuses", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSwipeRefreshLayout() {
|
private void setupSwipeRefreshLayout() {
|
||||||
|
@ -687,7 +694,12 @@ public class TimelineFragment extends SFragment implements
|
||||||
case "alwaysShowSensitiveMedia": {
|
case "alwaysShowSensitiveMedia": {
|
||||||
//it is ok if only newly loaded statuses are affected, no need to fully refresh
|
//it is ok if only newly loaded statuses are affected, no need to fully refresh
|
||||||
alwaysShowSensitiveMedia = sharedPreferences.getBoolean("alwaysShowSensitiveMedia", false);
|
alwaysShowSensitiveMedia = sharedPreferences.getBoolean("alwaysShowSensitiveMedia", false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case "collapseLongStatuses":
|
||||||
|
// As for "always show sensitive media" settings, only apply this to newer posts
|
||||||
|
collapseLongStatusContent = sharedPreferences.getBoolean("collapseLongStatuses", true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
private String thisThreadsStatusId;
|
private String thisThreadsStatusId;
|
||||||
private Card card;
|
private Card card;
|
||||||
private boolean alwaysShowSensitiveMedia;
|
private boolean alwaysShowSensitiveMedia;
|
||||||
|
private boolean collapseLongStatusContent;
|
||||||
|
|
||||||
private int statusIndex = 0;
|
private int statusIndex = 0;
|
||||||
|
|
||||||
|
@ -98,7 +99,11 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
new PairedList<>(new Function<Status, StatusViewData.Concrete>() {
|
new PairedList<>(new Function<Status, StatusViewData.Concrete>() {
|
||||||
@Override
|
@Override
|
||||||
public StatusViewData.Concrete apply(Status input) {
|
public StatusViewData.Concrete apply(Status input) {
|
||||||
return ViewDataUtils.statusToViewData(input, alwaysShowSensitiveMedia);
|
return ViewDataUtils.statusToViewData(
|
||||||
|
input,
|
||||||
|
alwaysShowSensitiveMedia,
|
||||||
|
collapseLongStatusContent
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -154,6 +159,7 @@ public final class ViewThreadFragment extends SFragment implements
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(
|
||||||
getActivity());
|
getActivity());
|
||||||
alwaysShowSensitiveMedia = preferences.getBoolean("alwaysShowSensitiveMedia", false);
|
alwaysShowSensitiveMedia = preferences.getBoolean("alwaysShowSensitiveMedia", false);
|
||||||
|
collapseLongStatusContent = preferences.getBoolean("collapseLongStatuses", true);
|
||||||
boolean mediaPreviewEnabled = preferences.getBoolean("mediaPreviewEnabled", true);
|
boolean mediaPreviewEnabled = preferences.getBoolean("mediaPreviewEnabled", true);
|
||||||
adapter.setMediaPreviewEnabled(mediaPreviewEnabled);
|
adapter.setMediaPreviewEnabled(mediaPreviewEnabled);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
Loading…
Reference in New Issue