Some fixes

This commit is contained in:
tom79 2020-03-28 09:17:54 +01:00
parent f4f865a149
commit 507a58b024
2 changed files with 22 additions and 13 deletions

View File

@ -57,6 +57,8 @@ import app.fedilab.android.sqlite.Sqlite;
import app.fedilab.android.sqlite.StatusCacheDAO;
import es.dmoral.toasty.Toasty;
import static android.content.Context.MODE_PRIVATE;
/**
* Created by Thomas on 14/01/2019.
@ -112,15 +114,18 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
@Override
public int getItemViewType(int position) {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean show_account_boosts = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_BOOSTS, true);
boolean show_account_replies = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_REPLIES, true);
boolean isDisplayed = Helper.filterToots(statuses.get(position), RetrieveFeedsAsyncTask.Type.ART, context instanceof ShowAccountActivity, show_account_boosts, show_account_replies);
if (!isDisplayed)
boolean show_account_boosts = false;
boolean show_account_replies = false;
if (context instanceof ShowAccountActivity) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
show_account_boosts = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_BOOSTS, true);
show_account_replies = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_REPLIES, true);
}
if (!Helper.filterToots(statuses.get(position), RetrieveFeedsAsyncTask.Type.ART, context instanceof ShowAccountActivity, show_account_boosts, show_account_replies)) {
return HIDDEN_STATUS;
else
} else {
return DISPLAYED_STATUS;
}
}
@NonNull

View File

@ -351,14 +351,18 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
@Override
public int getItemViewType(int position) {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean show_account_boosts = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_BOOSTS, true);
boolean show_account_replies = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_REPLIES, true);
boolean isDisplayed = Helper.filterToots(statuses.get(position), type, context instanceof ShowAccountActivity, show_account_boosts, show_account_replies);
if (!isDisplayed)
boolean show_account_boosts = false;
boolean show_account_replies = false;
if (context instanceof ShowAccountActivity) {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
show_account_boosts = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_BOOSTS, true);
show_account_replies = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_REPLIES, true);
}
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && type != RetrieveFeedsAsyncTask.Type.NEWS && !Helper.filterToots(statuses.get(position), type, context instanceof ShowAccountActivity, show_account_boosts, show_account_replies)) {
return HIDDEN_STATUS;
else
} else {
return DISPLAYED_STATUS;
}
}
@NonNull