refactor(filter/AltText): set filter title
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.joinmastodon.android.model;
|
||||
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.MastodonApp;
|
||||
import org.joinmastodon.android.R;
|
||||
import org.jsoup.internal.StringUtil;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@@ -8,9 +10,10 @@ import java.util.EnumSet;
|
||||
public class AltTextFilter extends LegacyFilter {
|
||||
|
||||
public AltTextFilter(FilterAction filterAction, EnumSet<FilterContext> filterContexts) {
|
||||
this.filterAction = filterAction;
|
||||
isRemote = false;
|
||||
context = filterContexts;
|
||||
this.filterAction=filterAction;
|
||||
this.title=MastodonApp.context.getString(R.string.sk_no_alt_text);
|
||||
this.isRemote=false;
|
||||
this.context=filterContexts;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,14 +8,11 @@ import android.widget.TextView;
|
||||
|
||||
import org.joinmastodon.android.R;
|
||||
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.Status;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// Mind the gap!
|
||||
public class WarningFilteredStatusDisplayItem extends StatusDisplayItem{
|
||||
public boolean loading;
|
||||
public List<StatusDisplayItem> filteredItems;
|
||||
@@ -24,8 +21,8 @@ public class WarningFilteredStatusDisplayItem extends StatusDisplayItem{
|
||||
public WarningFilteredStatusDisplayItem(String parentID, BaseStatusListFragment<?> parentFragment, Status status, List<StatusDisplayItem> filteredItems, LegacyFilter applyingFilter){
|
||||
super(parentID, parentFragment);
|
||||
this.status=status;
|
||||
this.filteredItems = filteredItems;
|
||||
this.applyingFilter = applyingFilter;
|
||||
this.filteredItems=filteredItems;
|
||||
this.applyingFilter=applyingFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,15 +40,15 @@ public class WarningFilteredStatusDisplayItem extends StatusDisplayItem{
|
||||
super(context, R.layout.display_item_warning, parent);
|
||||
warningWrap=findViewById(R.id.warning_wrap);
|
||||
showBtn=findViewById(R.id.reveal_btn);
|
||||
showBtn.setOnClickListener(i -> item.parentFragment.onWarningClick(this));
|
||||
showBtn.setOnClickListener(i->item.parentFragment.onWarningClick(this));
|
||||
itemView.setOnClickListener(v->item.parentFragment.onWarningClick(this));
|
||||
text=findViewById(R.id.text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBind(WarningFilteredStatusDisplayItem item) {
|
||||
filteredItems = item.filteredItems;
|
||||
String title = item.applyingFilter instanceof AltTextFilter ? item.parentFragment.getString(R.string.sk_no_alt_text) : item.applyingFilter.title;
|
||||
public void onBind(WarningFilteredStatusDisplayItem item){
|
||||
filteredItems=item.filteredItems;
|
||||
String title=item.applyingFilter.title;
|
||||
text.setText(item.parentFragment.getString(R.string.sk_filtered, title));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user