Some improvements
This commit is contained in:
parent
886c8bedc8
commit
a20c79d9fc
|
@ -125,6 +125,6 @@ dependencies {
|
|||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||
|
||||
|
||||
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-2'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-2'
|
||||
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ import app.fedilab.android.services.BackupStatusService;
|
|||
import app.fedilab.android.services.LiveNotificationService;
|
||||
import app.fedilab.android.sqlite.AccountDAO;
|
||||
import app.fedilab.android.sqlite.Sqlite;
|
||||
import app.fedilab.android.sqlite.TempMuteDAO;
|
||||
import app.fedilab.android.sqlite.TimelineCacheDAO;
|
||||
import app.fedilab.android.sqlite.TimelinesDAO;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
@ -177,6 +178,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
private static boolean notificationChecked = false;
|
||||
public static HashMap<String, Integer> poll_limits = new HashMap<>();
|
||||
private Instance instanceClass;
|
||||
public static List<String> mutedAccount = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -1287,6 +1289,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}
|
||||
});
|
||||
|
||||
mutedAccount = new TempMuteDAO(getApplicationContext(), db).getAllTimeMuted(account);
|
||||
|
||||
}
|
||||
|
||||
private void manageTimelineList(boolean displayed){
|
||||
|
|
|
@ -118,7 +118,7 @@ public class GroupActivity extends BaseActivity implements OnRetrieveFeedsInterf
|
|||
textviewNoAction = findViewById(R.id.no_action);
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
statusListAdapter = new StatusListAdapter(GroupActivity.this, RetrieveFeedsAsyncTask.Type.GNU_GROUP_TIMELINE, null, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.GNU_GROUP_TIMELINE, null, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
setTitle(String.format("!%s", groupname));
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte
|
|||
textviewNoAction = findViewById(R.id.no_action);
|
||||
mainLoader.setVisibility(View.VISIBLE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
statusListAdapter = new StatusListAdapter(HashTagActivity.this, RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.TAG, null, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
setTitle(String.format("#%s", tag));
|
||||
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
|
|
|
@ -115,7 +115,7 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
|
|||
nextElementLoader.setVisibility(View.GONE);
|
||||
boolean isOnWifi = Helper.isOnWIFI(ListActivity.this);
|
||||
|
||||
statusListAdapter = new StatusListAdapter(ListActivity.this, RetrieveFeedsAsyncTask.Type.LIST, null, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.LIST, null, isOnWifi, this.statuses);
|
||||
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
mLayoutManager = new LinearLayoutManager(ListActivity.this);
|
||||
|
|
|
@ -172,7 +172,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
boolean isOnWifi = Helper.isOnWIFI(OwnerStatusActivity.this);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||
statusListAdapter = new StatusListAdapter(OwnerStatusActivity.this, RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.CACHE_STATUS, userId, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
mLayoutManager = new LinearLayoutManager(OwnerStatusActivity.this);
|
||||
lv_status.setLayoutManager(mLayoutManager);
|
||||
|
|
|
@ -772,7 +772,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
|||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
boolean isOnWifi = Helper.isOnWIFI(PeertubeActivity.this);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(PeertubeActivity.this, RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, statuses);
|
||||
StatusListAdapter statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE, userId, isOnWifi, statuses);
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
|
||||
lv_comments.setLayoutManager(mLayoutManager);
|
||||
lv_comments.setNestedScrollingEnabled(false);
|
||||
|
|
|
@ -223,7 +223,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
show_replies = true;
|
||||
statuses = new ArrayList<>();
|
||||
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
|
||||
statusListAdapter = new StatusListAdapter(getApplicationContext(), RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.USER, accountId, isOnWifi, this.statuses);
|
||||
|
||||
showMediaOnly = false;
|
||||
showPinned = false;
|
||||
|
|
|
@ -246,7 +246,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetriev
|
|||
statuses.add(initialStatus);
|
||||
else
|
||||
statuses.add(detailsStatus);
|
||||
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, 0, null, isOnWifi, statuses);
|
||||
statusListAdapter = new StatusListAdapter(0, null, isOnWifi, statuses);
|
||||
|
||||
final LinearLayoutManager mLayoutManager;
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
|
@ -389,7 +389,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetriev
|
|||
for(Status status: context.getAncestors()){
|
||||
statuses.add(0,status);
|
||||
}
|
||||
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, (statuses.size()-1-i), null, isOnWifi, statuses);
|
||||
statusListAdapter = new StatusListAdapter((statuses.size()-1-i), null, isOnWifi, statuses);
|
||||
statusListAdapter.setConversationPosition((statuses.size()-1-i));
|
||||
final LinearLayoutManager mLayoutManager;
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
|
|
|
@ -4802,6 +4802,7 @@ public class API {
|
|||
} catch (JSONException ignored) {} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
status.setViewType(context);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,12 @@ import app.fedilab.android.helper.Helper;
|
|||
import app.fedilab.android.interfaces.OnRetrieveEmojiInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveImageInterface;
|
||||
|
||||
import static android.content.Context.MODE_PRIVATE;
|
||||
import static app.fedilab.android.drawers.StatusListAdapter.HIDDEN_STATUS;
|
||||
import static app.fedilab.android.drawers.StatusListAdapter.COMPACT_STATUS;
|
||||
import static app.fedilab.android.drawers.StatusListAdapter.CONSOLE_STATUS;
|
||||
import static app.fedilab.android.drawers.StatusListAdapter.DISPLAYED_STATUS;
|
||||
import static app.fedilab.android.drawers.StatusListAdapter.FOCUSED_STATUS;
|
||||
import static app.fedilab.android.helper.Helper.THEME_BLACK;
|
||||
import static app.fedilab.android.helper.Helper.THEME_DARK;
|
||||
import static app.fedilab.android.helper.Helper.THEME_LIGHT;
|
||||
|
@ -154,7 +160,8 @@ public class Status implements Parcelable{
|
|||
|
||||
private int warningFetched = -1;
|
||||
private List<String> imageURL;
|
||||
|
||||
private int viewType;
|
||||
private boolean isFocused = false;
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
|
@ -219,6 +226,9 @@ public class Status implements Parcelable{
|
|||
dest.writeByte(this.shortReply ? (byte) 1 : (byte) 0);
|
||||
dest.writeInt(this.warningFetched);
|
||||
dest.writeStringList(this.imageURL);
|
||||
dest.writeInt(this.viewType);
|
||||
dest.writeByte(this.isFocused ? (byte) 1 : (byte) 0);
|
||||
|
||||
}
|
||||
|
||||
protected Status(Parcel in) {
|
||||
|
@ -285,6 +295,8 @@ public class Status implements Parcelable{
|
|||
this.shortReply = in.readByte() != 0;
|
||||
this.warningFetched = in.readInt();
|
||||
this.imageURL = in.createStringArrayList();
|
||||
this.viewType = in.readInt();
|
||||
this.isFocused = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public static final Creator<Status> CREATOR = new Creator<Status>() {
|
||||
|
@ -1649,4 +1661,31 @@ public class Status implements Parcelable{
|
|||
this.imageURL = imageURL;
|
||||
}
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
|
||||
public void setViewType(Context context) {
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
boolean isCompactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
|
||||
boolean isConsoleMode = sharedpreferences.getBoolean(Helper.SET_CONSOLE_MODE, false);
|
||||
if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && type != RetrieveFeedsAsyncTask.Type.NEWS && !Helper.filterToots(context, this, type))
|
||||
this.viewType = HIDDEN_STATUS;
|
||||
else {
|
||||
if( isCompactMode)
|
||||
this.viewType = COMPACT_STATUS;
|
||||
else if( isConsoleMode)
|
||||
this.viewType = CONSOLE_STATUS;
|
||||
else
|
||||
this.viewType = DISPLAYED_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFocused() {
|
||||
return isFocused;
|
||||
}
|
||||
|
||||
public void setFocused(boolean focused) {
|
||||
isFocused = focused;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2181,6 +2181,7 @@ public class GNUAPI {
|
|||
e.printStackTrace();
|
||||
|
||||
}
|
||||
status.setViewType(context);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
|
|||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
|
||||
if( !Helper.filterToots(context, statuses.get(position), timedMute, null))
|
||||
if( !Helper.filterToots(context, statuses.get(position), null))
|
||||
return HIDDEN_STATUS;
|
||||
else
|
||||
return DISPLAYED_STATUS;
|
||||
|
|
|
@ -176,7 +176,7 @@ public class PixelfedListAdapter extends RecyclerView.Adapter implements OnPostA
|
|||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
|
||||
if( !Helper.filterToots(context, statuses.get(position), timedMute, null))
|
||||
if( !Helper.filterToots(context, statuses.get(position), null))
|
||||
return HIDDEN_STATUS;
|
||||
else
|
||||
return DISPLAYED_STATUS;
|
||||
|
|
|
@ -53,6 +53,7 @@ import android.text.method.LinkMovementMethod;
|
|||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -196,11 +197,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
private StatusListAdapter statusListAdapter;
|
||||
private RetrieveFeedsAsyncTask.Type type;
|
||||
private String targetedId;
|
||||
private final int HIDDEN_STATUS = 0;
|
||||
private static final int DISPLAYED_STATUS = 1;
|
||||
static final int FOCUSED_STATUS = 2;
|
||||
private static final int COMPACT_STATUS = 3;
|
||||
private static final int CONSOLE_STATUS = 4;
|
||||
public static final int HIDDEN_STATUS = 0;
|
||||
public static final int DISPLAYED_STATUS = 1;
|
||||
public static final int FOCUSED_STATUS = 2;
|
||||
public static final int COMPACT_STATUS = 3;
|
||||
public static final int CONSOLE_STATUS = 4;
|
||||
private int conversationPosition;
|
||||
private List<String> timedMute;
|
||||
private boolean redraft;
|
||||
|
@ -252,6 +253,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
mRecyclerView = recyclerView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void startUpdateTimer() {
|
||||
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
|
@ -269,48 +273,38 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
}
|
||||
}
|
||||
|
||||
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
public StatusListAdapter(RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
super();
|
||||
this.context = context;
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
statusListAdapter = this;
|
||||
this.type = type;
|
||||
this.targetedId = targetedId;
|
||||
redraft = false;
|
||||
lstHolders = new ArrayList<>();
|
||||
|
||||
startUpdateTimer();
|
||||
}
|
||||
|
||||
public StatusListAdapter(Context context, TagTimeline tagTimeline, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
public StatusListAdapter(TagTimeline tagTimeline, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
super();
|
||||
this.context = context;
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
statusListAdapter = this;
|
||||
this.type = RetrieveFeedsAsyncTask.Type.TAG;
|
||||
this.targetedId = targetedId;
|
||||
redraft = false;
|
||||
this.tagTimeline = tagTimeline;
|
||||
lstHolders = new ArrayList<>();
|
||||
startUpdateTimer();
|
||||
}
|
||||
|
||||
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
this.context = context;
|
||||
public StatusListAdapter(int position, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||
this.statuses = statuses;
|
||||
this.isOnWifi = isOnWifi;
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
statusListAdapter = this;
|
||||
this.type = RetrieveFeedsAsyncTask.Type.CONTEXT;
|
||||
this.conversationPosition = position;
|
||||
this.targetedId = targetedId;
|
||||
redraft = false;
|
||||
lstHolders = new ArrayList<>();
|
||||
startUpdateTimer();
|
||||
|
||||
}
|
||||
|
||||
|
@ -607,6 +601,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
@Override
|
||||
public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) {
|
||||
super.onViewAttachedToWindow(holder);
|
||||
context = holder.itemView.getContext();
|
||||
Log.v(Helper.TAG,"ctx1: " + context);
|
||||
if( type != RetrieveFeedsAsyncTask.Type.ART && type != RetrieveFeedsAsyncTask.Type.PIXELFED && (tagTimeline == null || !tagTimeline.isART()) && (holder.getItemViewType() == DISPLAYED_STATUS || holder.getItemViewType() == COMPACT_STATUS|| holder.getItemViewType() == CONSOLE_STATUS)) {
|
||||
final ViewHolder viewHolder = (ViewHolder) holder;
|
||||
// Bug workaround for losing text selection ability, see:
|
||||
|
@ -853,27 +849,17 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
boolean isCompactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
|
||||
boolean isConsoleMode = sharedpreferences.getBoolean(Helper.SET_CONSOLE_MODE, false);
|
||||
if( !isConsoleMode && type == RetrieveFeedsAsyncTask.Type.CONTEXT && position == conversationPosition)
|
||||
return FOCUSED_STATUS;
|
||||
else if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && type != RetrieveFeedsAsyncTask.Type.NEWS && !Helper.filterToots(context, statuses.get(position), timedMute, type))
|
||||
return HIDDEN_STATUS;
|
||||
else {
|
||||
if( isCompactMode)
|
||||
return COMPACT_STATUS;
|
||||
else if( isConsoleMode)
|
||||
return CONSOLE_STATUS;
|
||||
else
|
||||
return DISPLAYED_STATUS;
|
||||
}
|
||||
return statuses.get(position).getViewType();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
context = parent.getContext();
|
||||
layoutInflater = LayoutInflater.from(this.context);
|
||||
Log.v(Helper.TAG,"ctx3: " + context);
|
||||
startUpdateTimer();
|
||||
if( viewType == DISPLAYED_STATUS)
|
||||
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_status, parent, false));
|
||||
else if(viewType == COMPACT_STATUS)
|
||||
|
@ -893,10 +879,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
|
||||
context = viewHolder.itemView.getContext();
|
||||
Log.v(Helper.TAG,"ctx2: " + context);
|
||||
if( viewHolder.getItemViewType() != HIDDEN_STATUS ) {
|
||||
|
||||
|
||||
final ViewHolder holder = (ViewHolder) viewHolder;
|
||||
synchronized (lock) {
|
||||
lstHolders.add(holder);
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
|
|||
statuses = apiResponse.getStatuses();
|
||||
if( statuses != null && statuses.size() > 0) {
|
||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
|
||||
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
lv_status.setLayoutManager(mLayoutManager);
|
||||
}else {
|
||||
|
@ -136,7 +136,7 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
|
|||
new StatusCacheDAO(context, db).removeAllStatus(StatusCacheDAO.STATUS_CACHE);
|
||||
statuses = new ArrayList<>();
|
||||
statuses.clear();
|
||||
statusListAdapter = new StatusListAdapter(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, statuses);
|
||||
statusListAdapter = new StatusListAdapter(RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, isOnWifi, statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
textviewNoAction.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -64,6 +64,7 @@ public class DisplayMediaFragment extends Fragment implements OnRetrieveFeedsInt
|
|||
private SharedPreferences sharedpreferences;
|
||||
private ArrayList<Status> statuses;
|
||||
private ImageAdapter gridAdaper;
|
||||
private RecyclerView gridview;
|
||||
|
||||
public DisplayMediaFragment(){
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ public class DisplayMediaFragment extends Fragment implements OnRetrieveFeedsInt
|
|||
|
||||
statuses = new ArrayList<>();
|
||||
gridAdaper = new ImageAdapter(context, statuses);
|
||||
RecyclerView gridview = rootView.findViewById(R.id.gridview_media);
|
||||
gridview = rootView.findViewById(R.id.gridview_media);
|
||||
|
||||
gridview.setAdapter(gridAdaper);
|
||||
|
||||
|
@ -150,6 +151,14 @@ public class DisplayMediaFragment extends Fragment implements OnRetrieveFeedsInt
|
|||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if(gridview != null) {
|
||||
gridview.setAdapter(null);
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
|
|
@ -267,6 +267,14 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if( lv_notifications != null) {
|
||||
lv_notifications.setAdapter(null);
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
|
|
@ -167,6 +167,14 @@ public class DisplaySearchTagsFragment extends Fragment implements OnRetrieveSea
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if( lv_search_tags != null) {
|
||||
lv_search_tags.setAdapter(null);
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
|
|
@ -33,7 +33,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -109,7 +108,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
private boolean showMediaOnly, showPinned, showReply;
|
||||
private Intent streamingFederatedIntent, streamingLocalIntent;
|
||||
LinearLayoutManager mLayoutManager;
|
||||
boolean firstTootsLoaded;
|
||||
private boolean firstTootsLoaded;
|
||||
private String userId, instance;
|
||||
private SharedPreferences sharedpreferences;
|
||||
private boolean isSwipped;
|
||||
|
@ -192,7 +191,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, context!=null?Helper.getLiveInstance(context):null);
|
||||
Account account = new AccountDAO(context, db).getUniqAccount(userId, instance);
|
||||
mutedAccount = new TempMuteDAO(context, db).getAllTimeMuted(account);
|
||||
|
||||
|
||||
//For Home timeline, fetch stored values for bookmark and last read toot
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME) {
|
||||
|
@ -207,12 +206,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
List<TagTimeline> tagTimelines = new SearchDAO(context, db).getTimelineInfo(tag);
|
||||
if( tagTimelines != null && tagTimelines.size() > 0) {
|
||||
tagTimeline = tagTimelines.get(0);
|
||||
statusListAdapter = new StatusListAdapter(context, tagTimeline, targetedId, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(tagTimeline, targetedId, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
}
|
||||
}else{
|
||||
BaseMainActivity.displayPeertube = null;
|
||||
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, this.statuses);
|
||||
statusListAdapter = new StatusListAdapter(type, targetedId, isOnWifi, this.statuses);
|
||||
lv_status.setAdapter(statusListAdapter);
|
||||
}
|
||||
}else if( instanceType.equals("PEERTUBE")){
|
||||
|
@ -664,6 +663,14 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if( lv_status != null) {
|
||||
lv_status.setAdapter(null);
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
@ -727,7 +734,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
* Called from main activity in onResume to retrieve missing toots (home timeline)
|
||||
* @param sinceId String
|
||||
*/
|
||||
public void retrieveMissingToots(String sinceId){
|
||||
private void retrieveMissingToots(String sinceId){
|
||||
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME)
|
||||
asyncTask = new RetrieveFeedsAfterBookmarkAsyncTask(context, null, false,DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -841,12 +848,19 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
*/
|
||||
public void refreshFilter(){
|
||||
|
||||
if( instanceType.equals("MASTODON") || instanceType.equals("MISSKEY")|| instanceType.equals("GNU"))
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
else if( instanceType.equals("PIXELFED"))
|
||||
pixelfedListAdapter.notifyDataSetChanged();
|
||||
else if( instanceType.equals("ART"))
|
||||
artListAdapter.notifyDataSetChanged();
|
||||
switch (instanceType) {
|
||||
case "MASTODON":
|
||||
case "MISSKEY":
|
||||
case "GNU":
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
case "PIXELFED":
|
||||
pixelfedListAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
case "ART":
|
||||
artListAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1087,7 +1101,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
|
||||
@Override
|
||||
public void onActionDone(ManageListsAsyncTask.action actionType, APIResponse apiResponse, int statusCode) {
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
//Discards 404 - error which can often happen due to toots which have been deleted
|
||||
|
|
|
@ -221,6 +221,7 @@ import okhttp3.OkHttpClient;
|
|||
import okhttp3.TlsVersion;
|
||||
|
||||
import static android.content.Context.DOWNLOAD_SERVICE;
|
||||
import static app.fedilab.android.activities.BaseMainActivity.mutedAccount;
|
||||
import static com.koushikdutta.async.util.StreamUtility.copyStream;
|
||||
import static app.fedilab.android.activities.BaseMainActivity.filters;
|
||||
|
||||
|
@ -3553,7 +3554,7 @@ public class Helper {
|
|||
return emojiCount/2;
|
||||
}
|
||||
|
||||
public static boolean filterToots(Context context, Status status, List<String> timedMute, RetrieveFeedsAsyncTask.Type type){
|
||||
public static boolean filterToots(Context context, Status status, RetrieveFeedsAsyncTask.Type type){
|
||||
String filter;
|
||||
if( status == null)
|
||||
return true;
|
||||
|
@ -3624,7 +3625,7 @@ public class Helper {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (timedMute != null && timedMute.size() > 0 && timedMute.contains(status.getAccount().getId()))
|
||||
if (mutedAccount != null && mutedAccount.size() > 0 && mutedAccount.contains(status.getAccount().getId()))
|
||||
return false;
|
||||
if( status.isNotice())
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue