refactor(filter/AltText): set filter title

This commit is contained in:
FineFindus
2024-07-25 13:18:55 +02:00
parent 1bb288e565
commit af33c593b5
2 changed files with 28 additions and 28 deletions

View File

@@ -1,6 +1,8 @@
package org.joinmastodon.android.model; package org.joinmastodon.android.model;
import org.joinmastodon.android.GlobalUserPreferences; import org.joinmastodon.android.GlobalUserPreferences;
import org.joinmastodon.android.MastodonApp;
import org.joinmastodon.android.R;
import org.jsoup.internal.StringUtil; import org.jsoup.internal.StringUtil;
import java.util.EnumSet; import java.util.EnumSet;
@@ -9,8 +11,9 @@ public class AltTextFilter extends LegacyFilter {
public AltTextFilter(FilterAction filterAction, EnumSet<FilterContext> filterContexts) { public AltTextFilter(FilterAction filterAction, EnumSet<FilterContext> filterContexts) {
this.filterAction=filterAction; this.filterAction=filterAction;
isRemote = false; this.title=MastodonApp.context.getString(R.string.sk_no_alt_text);
context = filterContexts; this.isRemote=false;
this.context=filterContexts;
} }
@Override @Override

View File

@@ -8,14 +8,11 @@ import android.widget.TextView;
import org.joinmastodon.android.R; import org.joinmastodon.android.R;
import org.joinmastodon.android.fragments.BaseStatusListFragment; import org.joinmastodon.android.fragments.BaseStatusListFragment;
import org.joinmastodon.android.model.AltTextFilter;
import org.joinmastodon.android.model.Filter;
import org.joinmastodon.android.model.LegacyFilter; import org.joinmastodon.android.model.LegacyFilter;
import org.joinmastodon.android.model.Status; import org.joinmastodon.android.model.Status;
import java.util.List; import java.util.List;
// Mind the gap!
public class WarningFilteredStatusDisplayItem extends StatusDisplayItem{ public class WarningFilteredStatusDisplayItem extends StatusDisplayItem{
public boolean loading; public boolean loading;
public List<StatusDisplayItem> filteredItems; public List<StatusDisplayItem> filteredItems;
@@ -51,7 +48,7 @@ public class WarningFilteredStatusDisplayItem extends StatusDisplayItem{
@Override @Override
public void onBind(WarningFilteredStatusDisplayItem item){ public void onBind(WarningFilteredStatusDisplayItem item){
filteredItems=item.filteredItems; filteredItems=item.filteredItems;
String title = item.applyingFilter instanceof AltTextFilter ? item.parentFragment.getString(R.string.sk_no_alt_text) : item.applyingFilter.title; String title=item.applyingFilter.title;
text.setText(item.parentFragment.getString(R.string.sk_filtered, title)); text.setText(item.parentFragment.getString(R.string.sk_filtered, title));
} }