mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix duplicated messages in threads
This commit is contained in:
		
							parent
							
								
									dbc118064c
								
							
						
					
					
						commit
						86dc5d2f13
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -55,6 +55,7 @@ public class FragmentMastodonContext extends Fragment {
 | 
			
		|||
    private StatusesVM statusesVM;
 | 
			
		||||
    private List<Status> statuses;
 | 
			
		||||
    private StatusAdapter statusAdapter;
 | 
			
		||||
    private boolean refresh;
 | 
			
		||||
    //Handle actions that can be done in other fragments
 | 
			
		||||
    private final BroadcastReceiver receive_action = new BroadcastReceiver() {
 | 
			
		||||
        @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -154,6 +155,7 @@ public class FragmentMastodonContext extends Fragment {
 | 
			
		|||
        focusedStatus = null;
 | 
			
		||||
        pullToRefresh = false;
 | 
			
		||||
        focusedStatusURI = null;
 | 
			
		||||
        refresh = true;
 | 
			
		||||
        if (getArguments() != null) {
 | 
			
		||||
            focusedStatus = (Status) getArguments().getSerializable(Helper.ARG_STATUS);
 | 
			
		||||
            remote_instance = getArguments().getString(Helper.ARG_REMOTE_INSTANCE, null);
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +184,7 @@ public class FragmentMastodonContext extends Fragment {
 | 
			
		|||
        binding.recyclerView.setLayoutManager(mLayoutManager);
 | 
			
		||||
        binding.recyclerView.setAdapter(statusAdapter);
 | 
			
		||||
        binding.swipeContainer.setOnRefreshListener(() -> {
 | 
			
		||||
            if (this.statuses.size() > 0) {
 | 
			
		||||
            if (this.statuses.size() > 0 && !refresh) {
 | 
			
		||||
                binding.swipeContainer.setRefreshing(true);
 | 
			
		||||
                pullToRefresh = true;
 | 
			
		||||
                statusesVM.getContext(user_instance, user_token, focusedStatus.id)
 | 
			
		||||
| 
						 | 
				
			
			@ -229,7 +231,7 @@ public class FragmentMastodonContext extends Fragment {
 | 
			
		|||
     * @param context {@link Context}
 | 
			
		||||
     */
 | 
			
		||||
    private void initializeContextView(final Context context) {
 | 
			
		||||
 | 
			
		||||
        refresh = false;
 | 
			
		||||
        if (context == null) {
 | 
			
		||||
            Helper.sendToastMessage(requireActivity(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue