The text now begones if the item is filtered!
This commit is contained in:
parent
891016c8a8
commit
cbae5c4192
|
@ -73,7 +73,7 @@ public class CacheController{
|
||||||
status.hasGapAfter=((flags & POST_FLAG_GAP_AFTER)!=0);
|
status.hasGapAfter=((flags & POST_FLAG_GAP_AFTER)!=0);
|
||||||
newMaxID=status.id;
|
newMaxID=status.id;
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(status))
|
if(filter.matches(status) && status.filterRevealed)
|
||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
result.add(status);
|
result.add(status);
|
||||||
|
|
|
@ -149,6 +149,10 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
||||||
return strippedText;
|
return strippedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFilterRevealed(boolean filterRevealed) {
|
||||||
|
this.filterRevealed = filterRevealed;
|
||||||
|
}
|
||||||
|
|
||||||
public static Status ofFake(String id, String text, Instant createdAt) {
|
public static Status ofFake(String id, String text, Instant createdAt) {
|
||||||
Status s = new Status();
|
Status s = new Status();
|
||||||
s.id = id;
|
s.id = id;
|
||||||
|
|
|
@ -293,25 +293,16 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBind(HeaderStatusDisplayItem item){
|
public void onBind(HeaderStatusDisplayItem item){
|
||||||
|
if(item.status.filterRevealed){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
name.setText(item.parsedName);
|
name.setText(item.parsedName);
|
||||||
username.setText('@'+item.user.acct);
|
username.setText('@'+item.user.acct);
|
||||||
botIcon.setVisibility(item.user.bot ? View.VISIBLE : View.GONE);
|
botIcon.setVisibility(item.user.bot ? View.VISIBLE : View.GONE);
|
||||||
botIcon.setColorFilter(username.getCurrentTextColor());
|
botIcon.setColorFilter(username.getCurrentTextColor());
|
||||||
separator.setVisibility(View.VISIBLE);
|
separator.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
// if(item.user.bot){
|
|
||||||
// SpannableStringBuilder ssb = new SpannableStringBuilder();
|
|
||||||
// ssb.append('@'+item.user.acct);
|
|
||||||
// ssb.append(" ");
|
|
||||||
// Drawable botIcon=username.getResources().getDrawable(R.drawable.ic_bot, itemView.getContext().getTheme()).mutate();
|
|
||||||
// botIcon.setBounds(0, 0, botIcon.getIntrinsicWidth(), botIcon.getIntrinsicHeight());
|
|
||||||
// botIcon.setTint(username.getCurrentTextColor());
|
|
||||||
// ssb.append(itemView.getContext().getString(R.string.manually_approves_followers), new ImageSpan(botIcon, ImageSpan.ALIGN_BASELINE), 0);
|
|
||||||
// username.setPaddingRelative(0,0,16,0);
|
|
||||||
// username.setText(ssb);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// username.setCompoundDrawablesWithIntrinsicBounds(item.user.bot ? R.drawable.ic_fluent_bot_24_filled : 0, 0, 0, 0);
|
|
||||||
|
|
||||||
if (item.scheduledStatus!=null)
|
if (item.scheduledStatus!=null)
|
||||||
if (item.scheduledStatus.scheduledAt.isAfter(CreateStatus.DRAFTS_AFTER_INSTANT)) {
|
if (item.scheduledStatus.scheduledAt.isAfter(CreateStatus.DRAFTS_AFTER_INSTANT)) {
|
||||||
|
|
|
@ -114,22 +114,34 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
|
||||||
@Override
|
@Override
|
||||||
public void onBind(TextStatusDisplayItem item){
|
public void onBind(TextStatusDisplayItem item){
|
||||||
if(!item.status.filterRevealed){
|
if(!item.status.filterRevealed){
|
||||||
// text.setVisibility(View.GONE);
|
text.setVisibility(View.GONE);
|
||||||
// spoilerTitle.setVisibility(View.GONE);
|
spoilerTitle.setVisibility(View.GONE);
|
||||||
// spoilerTitleInline.setVisibility(View.GONE);
|
spoilerTitleInline.setVisibility(View.GONE);
|
||||||
// spoilerHeader.setVisibility(View.GONE);
|
spoilerHeader.setVisibility(View.GONE);
|
||||||
// spoilerOverlay.setVisibility(View.GONE);
|
spoilerOverlay.setVisibility(View.GONE);
|
||||||
// borderTop.setVisibility(View.GONE);
|
borderTop.setVisibility(View.GONE);
|
||||||
// borderBottom.setVisibility(View.GONE);
|
borderBottom.setVisibility(View.GONE);
|
||||||
// textWrap.setVisibility(View.GONE);
|
textWrap.setVisibility(View.GONE);
|
||||||
// translateWrap.setVisibility(View.GONE);
|
translateWrap.setVisibility(View.GONE);
|
||||||
// translateButton.setVisibility(View.GONE);
|
translateButton.setVisibility(View.GONE);
|
||||||
// translateInfo.setVisibility(View.GONE);
|
translateInfo.setVisibility(View.GONE);
|
||||||
// translateProgress.setVisibility(View.GONE);
|
translateProgress.setVisibility(View.GONE);
|
||||||
itemView.setVisibility(View.GONE);
|
// itemView.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
itemView.setVisibility(View.VISIBLE);
|
text.setVisibility(View.VISIBLE);
|
||||||
|
spoilerTitle.setVisibility(View.VISIBLE);
|
||||||
|
spoilerTitleInline.setVisibility(View.VISIBLE);
|
||||||
|
spoilerHeader.setVisibility(View.VISIBLE);
|
||||||
|
spoilerOverlay.setVisibility(View.VISIBLE);
|
||||||
|
borderTop.setVisibility(View.VISIBLE);
|
||||||
|
borderBottom.setVisibility(View.VISIBLE);
|
||||||
|
textWrap.setVisibility(View.VISIBLE);
|
||||||
|
// translateWrap.setVisibility(View.VISIBLE);
|
||||||
|
// translateButton.setVisibility(View.VISIBLE);
|
||||||
|
// translateInfo.setVisibility(View.VISIBLE);
|
||||||
|
// translateProgress.setVisibility(View.VISIBLE);
|
||||||
|
// itemView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
text.setText(item.translated
|
text.setText(item.translated
|
||||||
? HtmlParser.parse(item.translation.content, item.status.emojis, item.status.mentions, item.status.tags, item.parentFragment.getAccountID())
|
? HtmlParser.parse(item.translation.content, item.status.emojis, item.status.mentions, item.status.tags, item.parentFragment.getAccountID())
|
||||||
|
|
|
@ -31,15 +31,17 @@ public class StatusFilterPredicate implements Predicate<Status>{
|
||||||
.filter(filter->filter.expiresAt==null||filter.expiresAt.isAfter(Instant.now()))
|
.filter(filter->filter.expiresAt==null||filter.expiresAt.isAfter(Instant.now()))
|
||||||
.anyMatch(filter->filter.filterAction==Filter.FilterAction.HIDE);
|
.anyMatch(filter->filter.filterAction==Filter.FilterAction.HIDE);
|
||||||
|
|
||||||
// boolean filteredWithWarning=status.filtered.stream()
|
boolean filteredWithWarning=status.filtered.stream()
|
||||||
// .map(filterResult->filterResult.filter)
|
.map(filterResult->filterResult.filter)
|
||||||
// .filter(filter->filter.expiresAt==null||filter.expiresAt.isAfter(Instant.now()))
|
.filter(filter->filter.expiresAt==null||filter.expiresAt.isAfter(Instant.now()))
|
||||||
// .anyMatch(filter->filter.filterAction==Filter.FilterAction.WARN);
|
.anyMatch(filter->filter.filterAction==Filter.FilterAction.WARN);
|
||||||
//
|
|
||||||
// if(filteredWithWarning){
|
if(filteredWithWarning){
|
||||||
// status.filterRevealed = false;
|
status.setFilterRevealed(false);
|
||||||
// }
|
}else{
|
||||||
return !matches;
|
return !matches;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
for(Filter filter:filters){
|
for(Filter filter:filters){
|
||||||
if(filter.matches(status))
|
if(filter.matches(status))
|
||||||
|
|
Loading…
Reference in New Issue