Its a step closer to working

This commit is contained in:
LucasGGamerM 2023-01-28 17:33:05 -03:00
parent ea8a4ae487
commit 891016c8a8
5 changed files with 80 additions and 2 deletions

View File

@ -502,6 +502,17 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
revealSpoiler(status, holder.getItemID());
}
protected void revealFiltered(Status status, String itemID){
status.filterRevealed =true;
TextStatusDisplayItem.Holder text=findHolderOfType(itemID, TextStatusDisplayItem.Holder.class);
if(text!=null)
adapter.notifyItemChanged(text.getAbsoluteAdapterPosition()-getMainAdapterOffset());
HeaderStatusDisplayItem.Holder header=findHolderOfType(itemID, HeaderStatusDisplayItem.Holder.class);
if(header!=null)
header.rebind();
updateImagesSpoilerState(status, itemID);
}
protected void revealSpoiler(Status status, String itemID){
status.spoilerRevealed=true;
TextStatusDisplayItem.Holder text=findHolderOfType(itemID, TextStatusDisplayItem.Holder.class);

View File

@ -61,7 +61,7 @@ public class Status extends BaseModel implements DisplayItemsParent{
public transient boolean spoilerRevealed;
public transient boolean hasGapAfter;
public transient boolean showFiltered = true;
public transient boolean filterRevealed = true;
private transient String strippedText;
@Override

View File

@ -113,6 +113,24 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
@Override
public void onBind(TextStatusDisplayItem item){
if(!item.status.filterRevealed){
// text.setVisibility(View.GONE);
// spoilerTitle.setVisibility(View.GONE);
// spoilerTitleInline.setVisibility(View.GONE);
// spoilerHeader.setVisibility(View.GONE);
// spoilerOverlay.setVisibility(View.GONE);
// borderTop.setVisibility(View.GONE);
// borderBottom.setVisibility(View.GONE);
// textWrap.setVisibility(View.GONE);
// translateWrap.setVisibility(View.GONE);
// translateButton.setVisibility(View.GONE);
// translateInfo.setVisibility(View.GONE);
// translateProgress.setVisibility(View.GONE);
itemView.setVisibility(View.GONE);
return;
}else{
itemView.setVisibility(View.VISIBLE);
}
text.setText(item.translated
? HtmlParser.parse(item.translation.content, item.status.emojis, item.status.mentions, item.status.tags, item.parentFragment.getAccountID())
: item.text);

View File

@ -29,7 +29,16 @@ public class StatusFilterPredicate implements Predicate<Status>{
boolean matches=status.filtered.stream()
.map(filterResult->filterResult.filter)
.filter(filter->filter.expiresAt==null||filter.expiresAt.isAfter(Instant.now()))
.anyMatch(filter->filter.filterAction==Filter.FilterAction.HIDE || filter.filterAction==Filter.FilterAction.WARN);
.anyMatch(filter->filter.filterAction==Filter.FilterAction.HIDE);
// boolean filteredWithWarning=status.filtered.stream()
// .map(filterResult->filterResult.filter)
// .filter(filter->filter.expiresAt==null||filter.expiresAt.isAfter(Instant.now()))
// .anyMatch(filter->filter.filterAction==Filter.FilterAction.WARN);
//
// if(filteredWithWarning){
// status.filterRevealed = false;
// }
return !matches;
}
for(Filter filter:filters){

View File

@ -143,4 +143,44 @@
</org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:visibility="visible"
android:gravity="center_vertical"
android:id="@+id/filter_spoiler"
android:layoutDirection="locale">
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="8dp"
android:paddingVertical="8dp"
android:gravity="center_vertical"
android:textColor="?android:textColorPrimary"
android:textSize="16sp" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_weight="0"
android:layout_marginEnd="16dp"
android:maxWidth="140dp"
android:background="@drawable/bg_button_new_posts"
android:elevation="0dp"
android:ellipsize="middle"
android:fontFamily="sans-serif-medium"
android:singleLine="true"
android:stateListAnimator="@null"
android:textColor="?android:textColorPrimary"
android:textSize="16sp"
tools:text="@string/sk_color_palette_pink" />
</LinearLayout>
</RelativeLayout>