Loading app/src/main/java/app/fedilab/android/BaseMainActivity.java +6 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package app.fedilab.android; import static app.fedilab.android.BaseMainActivity.status.DISCONNECTED; import static app.fedilab.android.BaseMainActivity.status.UNKNOWN; import static app.fedilab.android.mastodon.helper.CacheHelper.deleteDir; import static app.fedilab.android.mastodon.helper.Helper.ARG_REFRESH_NOTFICATION; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE; Loading Loading @@ -672,6 +673,11 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt } viewPager.setCurrentItem(position); } Bundle b = new Bundle(); b.putBoolean(ARG_REFRESH_NOTFICATION, true); Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); intentBC.putExtras(b); LocalBroadcastManager.getInstance(activity).sendBroadcast(intentBC); } }, 1000); intent.removeExtra(Helper.INTENT_ACTION); Loading app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java +2 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,8 @@ public class Helper { public static final String RECEIVE_REDRAW_BOTTOM = "RECEIVE_REDRAW_BOTTOM"; public static final String RECEIVE_STATUS_ACTION = "RECEIVE_STATUS_ACTION"; public static final String RECEIVE_REFRESH_NOTIFICATIONS_ACTION = "RECEIVE_REFRESH_NOTIFICATIONS_ACTION"; public static final String RECEIVE_ERROR_MESSAGE = "RECEIVE_ERROR_MESSAGE"; public static final String RECEIVE_RECREATE_ACTIVITY = "RECEIVE_RECREATE_ACTIVITY"; Loading app/src/main/java/app/fedilab/android/mastodon/helper/NotificationsHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -379,7 +379,7 @@ public class NotificationsHelper { Helper.NotifType finalNotifType = notifType; String finalMessage = message; String finalTitle = title; StatusAdapter.sendAction(context, Helper.ARG_REFRESH_NOTFICATION, null, null); StatusAdapter.sendAction(context, Helper.RECEIVE_REFRESH_NOTIFICATIONS_ACTION, null, null); Runnable myRunnable = () -> Glide.with(context) .asBitmap() .load(finalNotificationUrl != null ? finalNotificationUrl : R.drawable.fedilab_logo_bubbles) Loading app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -2726,10 +2726,10 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> b.putSerializable(type, status); } if (id != null) { b.putSerializable(type, id); b.putString(type, id); } if (type == ARG_TIMELINE_REFRESH_ALL) { b.putSerializable(ARG_TIMELINE_REFRESH_ALL, true); b.putBoolean(ARG_TIMELINE_REFRESH_ALL, true); } Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); intentBC.putExtras(b); Loading app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonNotification.java +5 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,10 @@ public class FragmentMastodonNotification extends Fragment implements Notificati if (b != null) { Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); String delete_all_for_account_id = b.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID); if (receivedStatus != null && notificationAdapter != null) { boolean refreshNotifications = b.getBoolean(Helper.ARG_REFRESH_NOTFICATION, false); if (refreshNotifications) { scrollToTop(); } else if (receivedStatus != null && notificationAdapter != null) { int position = getPosition(receivedStatus); if (position >= 0) { if (notificationList.get(position).status != null) { Loading Loading @@ -203,7 +206,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati aggregateNotification = false; LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION)); LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_refresh, new IntentFilter(Helper.ARG_REFRESH_NOTFICATION)); LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_refresh, new IntentFilter(Helper.RECEIVE_REFRESH_NOTIFICATIONS_ACTION)); return root; } Loading Loading
app/src/main/java/app/fedilab/android/BaseMainActivity.java +6 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package app.fedilab.android; import static app.fedilab.android.BaseMainActivity.status.DISCONNECTED; import static app.fedilab.android.BaseMainActivity.status.UNKNOWN; import static app.fedilab.android.mastodon.helper.CacheHelper.deleteDir; import static app.fedilab.android.mastodon.helper.Helper.ARG_REFRESH_NOTFICATION; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE; Loading Loading @@ -672,6 +673,11 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt } viewPager.setCurrentItem(position); } Bundle b = new Bundle(); b.putBoolean(ARG_REFRESH_NOTFICATION, true); Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); intentBC.putExtras(b); LocalBroadcastManager.getInstance(activity).sendBroadcast(intentBC); } }, 1000); intent.removeExtra(Helper.INTENT_ACTION); Loading
app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java +2 −0 Original line number Diff line number Diff line Loading @@ -194,6 +194,8 @@ public class Helper { public static final String RECEIVE_REDRAW_BOTTOM = "RECEIVE_REDRAW_BOTTOM"; public static final String RECEIVE_STATUS_ACTION = "RECEIVE_STATUS_ACTION"; public static final String RECEIVE_REFRESH_NOTIFICATIONS_ACTION = "RECEIVE_REFRESH_NOTIFICATIONS_ACTION"; public static final String RECEIVE_ERROR_MESSAGE = "RECEIVE_ERROR_MESSAGE"; public static final String RECEIVE_RECREATE_ACTIVITY = "RECEIVE_RECREATE_ACTIVITY"; Loading
app/src/main/java/app/fedilab/android/mastodon/helper/NotificationsHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -379,7 +379,7 @@ public class NotificationsHelper { Helper.NotifType finalNotifType = notifType; String finalMessage = message; String finalTitle = title; StatusAdapter.sendAction(context, Helper.ARG_REFRESH_NOTFICATION, null, null); StatusAdapter.sendAction(context, Helper.RECEIVE_REFRESH_NOTIFICATIONS_ACTION, null, null); Runnable myRunnable = () -> Glide.with(context) .asBitmap() .load(finalNotificationUrl != null ? finalNotificationUrl : R.drawable.fedilab_logo_bubbles) Loading
app/src/main/java/app/fedilab/android/mastodon/ui/drawer/StatusAdapter.java +2 −2 Original line number Diff line number Diff line Loading @@ -2726,10 +2726,10 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> b.putSerializable(type, status); } if (id != null) { b.putSerializable(type, id); b.putString(type, id); } if (type == ARG_TIMELINE_REFRESH_ALL) { b.putSerializable(ARG_TIMELINE_REFRESH_ALL, true); b.putBoolean(ARG_TIMELINE_REFRESH_ALL, true); } Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); intentBC.putExtras(b); Loading
app/src/main/java/app/fedilab/android/mastodon/ui/fragment/timeline/FragmentMastodonNotification.java +5 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,10 @@ public class FragmentMastodonNotification extends Fragment implements Notificati if (b != null) { Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); String delete_all_for_account_id = b.getString(Helper.ARG_DELETE_ALL_FOR_ACCOUNT_ID); if (receivedStatus != null && notificationAdapter != null) { boolean refreshNotifications = b.getBoolean(Helper.ARG_REFRESH_NOTFICATION, false); if (refreshNotifications) { scrollToTop(); } else if (receivedStatus != null && notificationAdapter != null) { int position = getPosition(receivedStatus); if (position >= 0) { if (notificationList.get(position).status != null) { Loading Loading @@ -203,7 +206,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati aggregateNotification = false; LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION)); LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_refresh, new IntentFilter(Helper.ARG_REFRESH_NOTFICATION)); LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_refresh, new IntentFilter(Helper.RECEIVE_REFRESH_NOTIFICATIONS_ACTION)); return root; } Loading