This commit is contained in:
tom79 2020-03-27 18:23:30 +01:00
parent 128358466f
commit a3f4d8e6d5
6 changed files with 24 additions and 37 deletions

View File

@ -57,7 +57,6 @@ import java.util.regex.Pattern;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
import app.fedilab.android.client.Entities.Account;
import app.fedilab.android.client.Entities.AccountAdmin;
@ -520,26 +519,6 @@ public class API {
JSONObject resobj = jsonArray.getJSONObject(i);
Status status = parseStatuses(context, resobj);
if( action != null) {
try {
RetrieveFeedsAsyncTask.Type type;
if (action == filterFor.PUBLIC){
type = RetrieveFeedsAsyncTask.Type.PUBLIC;
}else if( action == filterFor.LOCAL){
type = RetrieveFeedsAsyncTask.Type.LOCAL;
}else{
type = RetrieveFeedsAsyncTask.Type.HOME;
}
boolean show_account_boosts= true;
boolean show_account_replies = true;
if( action == filterFor.STATUSES_ACCOUNT ){
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
show_account_boosts = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_BOOSTS, true);
show_account_replies = sharedpreferences.getBoolean(Helper.SHOW_ACCOUNT_REPLIES, true);
}
status.setDisplayed(Helper.filterToots(status, type, action == filterFor.STATUSES_ACCOUNT, show_account_boosts, show_account_replies));
} catch (Exception ignored) {}
}
i++;
statuses.add(status);
}

View File

@ -177,7 +177,6 @@ public class Status implements Parcelable {
private boolean isBoostAnimated = false, isFavAnimated = false;
private String scheduled_at;
private String contentType;
private boolean displayed = true;
private boolean isNotice = false;
private Poll poll = null;
@ -254,7 +253,6 @@ public class Status implements Parcelable {
this.scheduled_at = in.readString();
this.contentType = in.readString();
this.showSpoiler = in.readByte() != 0;
this.displayed = in.readByte() != 0;
this.isNotice = in.readByte() != 0;
this.poll = in.readParcelable(Poll.class.getClassLoader());
this.media_height = in.readInt();
@ -1351,7 +1349,6 @@ public class Status implements Parcelable {
dest.writeString(this.scheduled_at);
dest.writeString(this.contentType);
dest.writeByte(this.showSpoiler ? (byte) 1 : (byte) 0);
dest.writeByte(this.displayed ? (byte) 1 : (byte) 0);
dest.writeByte(this.isNotice ? (byte) 1 : (byte) 0);
dest.writeParcelable(this.poll, flags);
dest.writeInt(this.media_height);
@ -2018,11 +2015,4 @@ public class Status implements Parcelable {
this.reactions = reactions;
}
public boolean isDisplayed() {
return displayed;
}
public void setDisplayed(boolean displayed) {
this.displayed = displayed;
}
}

View File

@ -17,6 +17,7 @@ package app.fedilab.android.drawers;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -40,6 +41,7 @@ import app.fedilab.android.R;
import app.fedilab.android.activities.ShowAccountActivity;
import app.fedilab.android.activities.ShowConversationActivity;
import app.fedilab.android.activities.SlideMediaActivity;
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
import app.fedilab.android.client.API;
import app.fedilab.android.client.APIResponse;
import app.fedilab.android.client.Entities.Attachment;
@ -110,7 +112,12 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
@Override
public int getItemViewType(int position) {
if (!statuses.get(position).isDisplayed())
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)
return HIDDEN_STATUS;
else
return DISPLAYED_STATUS;

View File

@ -351,7 +351,11 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
@Override
public int getItemViewType(int position) {
if (!statuses.get(position).isDisplayed())
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)
return HIDDEN_STATUS;
else
return DISPLAYED_STATUS;

View File

@ -564,7 +564,14 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
@Override
public int getItemViewType(int position) {
if (type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && type != RetrieveFeedsAsyncTask.Type.NEWS && type != RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS && !statuses.get(position).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;
}
if (statuses.get(position).isFocused() && type == RetrieveFeedsAsyncTask.Type.CONTEXT && statuses.get(position).getViewType() != CONSOLE_STATUS)
@ -573,9 +580,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED && type == RetrieveFeedsAsyncTask.Type.CONTEXT) {
return COMPACT_STATUS;
} else {
if (instanceType == null || (instanceType.compareTo("NITTER") != 0 && type != RetrieveFeedsAsyncTask.Type.ANNOUNCEMENTS)) {
if( instanceType == null || instanceType.compareTo("NITTER") != 0 ) {
return statuses.get(position).getViewType();
} else {
}else{
return COMPACT_STATUS;
}
}

View File

@ -34,7 +34,7 @@ public class MastalabAutoCompleteTextView extends androidx.appcompat.widget.AppC
final Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
final float defaultEmojiSize = fontMetrics.descent - fontMetrics.ascent;
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
emoji = sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, true);
emoji = sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, false);
if (attrs == null) {
emojiSize = defaultEmojiSize;
} else {