mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	Fix non updated counter with cache
This commit is contained in:
		
							parent
							
								
									2da0b1bba8
								
							
						
					
					
						commit
						3d2b1b6b7d
					
				
					 5 changed files with 13 additions and 6 deletions
				
			
		| 
						 | 
					@ -53,14 +53,12 @@ public class ContextActivity extends BaseActivity {
 | 
				
			||||||
    public static boolean displayCW;
 | 
					    public static boolean displayCW;
 | 
				
			||||||
    public static Resources.Theme theme;
 | 
					    public static Resources.Theme theme;
 | 
				
			||||||
    Fragment currentFragment;
 | 
					    Fragment currentFragment;
 | 
				
			||||||
    private Status focusedStatus;
 | 
					 | 
				
			||||||
    private ActivityConversationBinding binding;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void onCreate(Bundle savedInstanceState) {
 | 
					    protected void onCreate(Bundle savedInstanceState) {
 | 
				
			||||||
        super.onCreate(savedInstanceState);
 | 
					        super.onCreate(savedInstanceState);
 | 
				
			||||||
        ThemeHelper.applyTheme(this);
 | 
					        ThemeHelper.applyTheme(this);
 | 
				
			||||||
        binding = ActivityConversationBinding.inflate(getLayoutInflater());
 | 
					        app.fedilab.android.databinding.ActivityConversationBinding binding = ActivityConversationBinding.inflate(getLayoutInflater());
 | 
				
			||||||
        setContentView(binding.getRoot());
 | 
					        setContentView(binding.getRoot());
 | 
				
			||||||
        setSupportActionBar(binding.toolbar);
 | 
					        setSupportActionBar(binding.toolbar);
 | 
				
			||||||
        ActionBar actionBar = getSupportActionBar();
 | 
					        ActionBar actionBar = getSupportActionBar();
 | 
				
			||||||
| 
						 | 
					@ -78,7 +76,7 @@ public class ContextActivity extends BaseActivity {
 | 
				
			||||||
        Bundle b = getIntent().getExtras();
 | 
					        Bundle b = getIntent().getExtras();
 | 
				
			||||||
        final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ContextActivity.this);
 | 
					        final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ContextActivity.this);
 | 
				
			||||||
        displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false);
 | 
					        displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false);
 | 
				
			||||||
        focusedStatus = null; // or other values
 | 
					        Status focusedStatus = null; // or other values
 | 
				
			||||||
        if (b != null)
 | 
					        if (b != null)
 | 
				
			||||||
            focusedStatus = (Status) b.getSerializable(Helper.ARG_STATUS);
 | 
					            focusedStatus = (Status) b.getSerializable(Helper.ARG_STATUS);
 | 
				
			||||||
        if (focusedStatus == null || currentAccount == null || currentAccount.mastodon_account == null) {
 | 
					        if (focusedStatus == null || currentAccount == null || currentAccount.mastodon_account == null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1474,11 +1474,11 @@ public class Helper {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, channelId)
 | 
					        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, channelId)
 | 
				
			||||||
                .setSmallIcon(R.drawable.ic_notification).setTicker(message);
 | 
					                .setSmallIcon(R.drawable.ic_notification).setTicker(message);
 | 
				
			||||||
        if (notifType == NotifType.MENTION) {
 | 
					      /*  if (notifType == NotifType.MENTION) {
 | 
				
			||||||
            if (message.length() > 500) {
 | 
					            if (message.length() > 500) {
 | 
				
			||||||
                message = message.substring(0, 499) + "…";
 | 
					                message = message.substring(0, 499) + "…";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }*/
 | 
				
			||||||
        notificationBuilder.setGroup(account.mastodon_account.acct + "@" + account.instance)
 | 
					        notificationBuilder.setGroup(account.mastodon_account.acct + "@" + account.instance)
 | 
				
			||||||
                .setContentIntent(pIntent)
 | 
					                .setContentIntent(pIntent)
 | 
				
			||||||
                .setContentText(message);
 | 
					                .setContentText(message);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,8 +69,11 @@ public class FragmentMastodonContext extends Fragment {
 | 
				
			||||||
                    int position = getPosition(receivedStatus);
 | 
					                    int position = getPosition(receivedStatus);
 | 
				
			||||||
                    if (position >= 0) {
 | 
					                    if (position >= 0) {
 | 
				
			||||||
                        statuses.get(position).reblog = receivedStatus.reblog;
 | 
					                        statuses.get(position).reblog = receivedStatus.reblog;
 | 
				
			||||||
 | 
					                        statuses.get(position).reblogged = receivedStatus.reblogged;
 | 
				
			||||||
                        statuses.get(position).favourited = receivedStatus.favourited;
 | 
					                        statuses.get(position).favourited = receivedStatus.favourited;
 | 
				
			||||||
                        statuses.get(position).bookmarked = receivedStatus.bookmarked;
 | 
					                        statuses.get(position).bookmarked = receivedStatus.bookmarked;
 | 
				
			||||||
 | 
					                        statuses.get(position).reblogs_count = receivedStatus.reblogs_count;
 | 
				
			||||||
 | 
					                        statuses.get(position).favourites_count = receivedStatus.favourites_count;
 | 
				
			||||||
                        statusAdapter.notifyItemChanged(position);
 | 
					                        statusAdapter.notifyItemChanged(position);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else if (delete_statuses_for_user != null && statusAdapter != null) {
 | 
					                } else if (delete_statuses_for_user != null && statusAdapter != null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,8 +76,11 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
 | 
				
			||||||
                    if (position >= 0) {
 | 
					                    if (position >= 0) {
 | 
				
			||||||
                        if (notificationList.get(position).status != null) {
 | 
					                        if (notificationList.get(position).status != null) {
 | 
				
			||||||
                            notificationList.get(position).status.reblog = receivedStatus.reblog;
 | 
					                            notificationList.get(position).status.reblog = receivedStatus.reblog;
 | 
				
			||||||
 | 
					                            notificationList.get(position).status.reblogged = receivedStatus.reblogged;
 | 
				
			||||||
                            notificationList.get(position).status.favourited = receivedStatus.favourited;
 | 
					                            notificationList.get(position).status.favourited = receivedStatus.favourited;
 | 
				
			||||||
                            notificationList.get(position).status.bookmarked = receivedStatus.bookmarked;
 | 
					                            notificationList.get(position).status.bookmarked = receivedStatus.bookmarked;
 | 
				
			||||||
 | 
					                            notificationList.get(position).status.favourites_count = receivedStatus.favourites_count;
 | 
				
			||||||
 | 
					                            notificationList.get(position).status.reblogs_count = receivedStatus.reblogs_count;
 | 
				
			||||||
                            notificationAdapter.notifyItemChanged(position);
 | 
					                            notificationAdapter.notifyItemChanged(position);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,8 +92,11 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
 | 
				
			||||||
                    int position = getPosition(receivedStatus);
 | 
					                    int position = getPosition(receivedStatus);
 | 
				
			||||||
                    if (position >= 0) {
 | 
					                    if (position >= 0) {
 | 
				
			||||||
                        statuses.get(position).reblog = receivedStatus.reblog;
 | 
					                        statuses.get(position).reblog = receivedStatus.reblog;
 | 
				
			||||||
 | 
					                        statuses.get(position).reblogged = receivedStatus.reblogged;
 | 
				
			||||||
                        statuses.get(position).favourited = receivedStatus.favourited;
 | 
					                        statuses.get(position).favourited = receivedStatus.favourited;
 | 
				
			||||||
                        statuses.get(position).bookmarked = receivedStatus.bookmarked;
 | 
					                        statuses.get(position).bookmarked = receivedStatus.bookmarked;
 | 
				
			||||||
 | 
					                        statuses.get(position).reblogs_count = receivedStatus.reblogs_count;
 | 
				
			||||||
 | 
					                        statuses.get(position).favourites_count = receivedStatus.favourites_count;
 | 
				
			||||||
                        statusAdapter.notifyItemChanged(position);
 | 
					                        statusAdapter.notifyItemChanged(position);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } else if (delete_statuses_for_user != null && statusAdapter != null) {
 | 
					                } else if (delete_statuses_for_user != null && statusAdapter != null) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue