diff options
author | Thomas <tschneider.ac@gmail.com> | 2024-01-11 17:05:35 +0100 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2024-01-11 17:05:35 +0100 |
commit | 09a8b6c43ca0c6a2711ada32f97170bce1f88b2a (patch) | |
tree | 52688007d3a7256af22bfe3c059fe8fe8e82d146 | |
parent | b052547cc4862255589bfe565971b9edee14c904 (diff) |
Broadcast
19 files changed, 653 insertions, 445 deletions
diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java index c16fccb0d..6531aa633 100644 --- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java @@ -79,6 +79,7 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.ViewModelProvider; +import androidx.multidex.BuildConfig; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.navigation.ui.AppBarConfiguration; @@ -220,24 +221,34 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt private final BroadcastReceiver broadcast_error_message = new BroadcastReceiver() { @Override public void onReceive(android.content.Context context, Intent intent) { - Bundle b = intent.getExtras(); - if (b != null) { - if (b.getBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, false)) { - String errorMessage = b.getString(Helper.RECEIVE_ERROR_MESSAGE); - StatusDraft statusDraft = (StatusDraft) b.getSerializable(Helper.ARG_STATUS_DRAFT); - Snackbar snackbar = Snackbar.make(binding.getRoot(), errorMessage, 5000); - View snackbarView = snackbar.getView(); - TextView textView = snackbarView.findViewById(com.google.android.material.R.id.snackbar_text); - textView.setMaxLines(5); - snackbar - .setAction(getString(R.string.open_draft), view -> { - Intent intentCompose = new Intent(context, ComposeActivity.class); - intentCompose.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft); - intentCompose.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(intentCompose); - }) - .show(); - } + Bundle args = intent.getExtras(); + if (args != null) { + long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1); + new CachedBundle(BaseMainActivity.this).getBundle(bundleId, currentAccount, bundle -> { + if (bundle.getBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, false)) { + String errorMessage = bundle.getString(Helper.RECEIVE_ERROR_MESSAGE); + StatusDraft statusDraft = (StatusDraft) bundle.getSerializable(Helper.ARG_STATUS_DRAFT); + Snackbar snackbar = Snackbar.make(binding.getRoot(), errorMessage, 5000); + View snackbarView = snackbar.getView(); + TextView textView = snackbarView.findViewById(com.google.android.material.R.id.snackbar_text); + textView.setMaxLines(5); + snackbar + .setAction(getString(R.string.open_draft), view -> { + Intent intentCompose = new Intent(context, ComposeActivity.class); + Bundle args2 = new Bundle(); + args2.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft); + new CachedBundle(BaseMainActivity.this).insertBundle(args2, currentAccount, bundleId2 -> { + Bundle bundle2 = new Bundle(); + bundle2.putLong(Helper.ARG_INTENT_ID, bundleId2); + intentCompose.putExtras(bundle2); + intentCompose.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intentCompose); + }); + }) + .show(); + } + }); + } } }; @@ -246,94 +257,98 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt private final BroadcastReceiver broadcast_data = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - Bundle b = intent.getExtras(); - if (b != null) { - if (b.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) { - List<MastodonList> mastodonLists = (List<MastodonList>) b.getSerializable(Helper.RECEIVE_MASTODON_LIST); - redrawPinned(mastodonLists); - } - if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { - bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView); - if (bottomMenu != null) { - //ManageClick on bottom menu items - if (binding.bottomNavView.findViewById(R.id.nav_home) != null) { - binding.bottomNavView.findViewById(R.id.nav_home).setOnLongClickListener(view -> { - int position = BottomMenu.getPosition(bottomMenu, R.id.nav_home); - if (position >= 0) { - manageFilters(position); - } - return false; - }); - } - if (binding.bottomNavView.findViewById(R.id.nav_local) != null) { - binding.bottomNavView.findViewById(R.id.nav_local).setOnLongClickListener(view -> { - int position = BottomMenu.getPosition(bottomMenu, R.id.nav_local); + Bundle args = intent.getExtras(); + if (args != null) { + long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1); + new CachedBundle(BaseMainActivity.this).getBundle(bundleId, currentAccount, bundle -> { + if (bundle.getBoolean(Helper.RECEIVE_REDRAW_TOPBAR, false)) { + List<MastodonList> mastodonLists = (List<MastodonList>) bundle.getSerializable(Helper.RECEIVE_MASTODON_LIST); + redrawPinned(mastodonLists); + } + if (bundle.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { + bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView); + if (bottomMenu != null) { + //ManageClick on bottom menu items + if (binding.bottomNavView.findViewById(R.id.nav_home) != null) { + binding.bottomNavView.findViewById(R.id.nav_home).setOnLongClickListener(view -> { + int position = BottomMenu.getPosition(bottomMenu, R.id.nav_home); + if (position >= 0) { + manageFilters(position); + } + return false; + }); + } + if (binding.bottomNavView.findViewById(R.id.nav_local) != null) { + binding.bottomNavView.findViewById(R.id.nav_local).setOnLongClickListener(view -> { + int position = BottomMenu.getPosition(bottomMenu, R.id.nav_local); + if (position >= 0) { + manageFilters(position); + } + return false; + }); + } + if (binding.bottomNavView.findViewById(R.id.nav_public) != null) { + binding.bottomNavView.findViewById(R.id.nav_public).setOnLongClickListener(view -> { + int position = BottomMenu.getPosition(bottomMenu, R.id.nav_public); + if (position >= 0) { + manageFilters(position); + } + return false; + }); + } + binding.bottomNavView.setOnItemSelectedListener(item -> { + int itemId = item.getItemId(); + int position = BottomMenu.getPosition(bottomMenu, itemId); if (position >= 0) { - manageFilters(position); + if (binding.viewPager.getCurrentItem() == position) { + scrollToTop(); + } else { + binding.viewPager.setCurrentItem(position, false); + } } - return false; + return true; }); } - if (binding.bottomNavView.findViewById(R.id.nav_public) != null) { - binding.bottomNavView.findViewById(R.id.nav_public).setOnLongClickListener(view -> { - int position = BottomMenu.getPosition(bottomMenu, R.id.nav_public); - if (position >= 0) { - manageFilters(position); + } else if (bundle.getBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, false)) { + recreate(); + } else if (bundle.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) { + Status statusSent = (Status) bundle.getSerializable(Helper.RECEIVE_STATUS_ACTION); + String statusEditId = bundle.getString(Helper.ARG_EDIT_STATUS_ID, null); + Snackbar.make(binding.displaySnackBar, getString(R.string.message_has_been_sent), Snackbar.LENGTH_LONG) + .setAction(getString(R.string.display), view -> { + Intent intentContext = new Intent(BaseMainActivity.this, ContextActivity.class); + Bundle args2 = new Bundle(); + args2.putSerializable(Helper.ARG_STATUS, statusSent); + new CachedBundle(BaseMainActivity.this).insertBundle(args2, currentAccount, bundleId2 -> { + Bundle bundle2 = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId2); + intentContext.putExtras(bundle2); + intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intentContext); + }); + }) + .show(); + //The message was edited, we need to update the timeline + if (statusEditId != null) { + //Update message in cache + new Thread(() -> { + StatusCache statusCache = new StatusCache(); + statusCache.instance = BaseMainActivity.currentInstance; + statusCache.user_id = BaseMainActivity.currentUserID; + statusCache.status = statusSent; + statusCache.status_id = statusEditId; + try { + new StatusCache(BaseMainActivity.this).updateIfExists(statusCache); + } catch (DBException e) { + e.printStackTrace(); } - return false; - }); + }).start(); + //Update timelines + sendAction(context, Helper.ARG_STATUS_UPDATED, statusSent, null); } - binding.bottomNavView.setOnItemSelectedListener(item -> { - int itemId = item.getItemId(); - int position = BottomMenu.getPosition(bottomMenu, itemId); - if (position >= 0) { - if (binding.viewPager.getCurrentItem() == position) { - scrollToTop(); - } else { - binding.viewPager.setCurrentItem(position, false); - } - } - return true; - }); } - } else if (b.getBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, false)) { - recreate(); - } else if (b.getBoolean(Helper.RECEIVE_NEW_MESSAGE, false)) { - Status statusSent = (Status) b.getSerializable(Helper.RECEIVE_STATUS_ACTION); - String statusEditId = b.getString(Helper.ARG_EDIT_STATUS_ID, null); - Snackbar.make(binding.displaySnackBar, getString(R.string.message_has_been_sent), Snackbar.LENGTH_LONG) - .setAction(getString(R.string.display), view -> { - Intent intentContext = new Intent(BaseMainActivity.this, ContextActivity.class); - Bundle args = new Bundle(); - args.putSerializable(Helper.ARG_STATUS, statusSent); - new CachedBundle(BaseMainActivity.this).insertBundle(args, currentAccount, bundleId -> { - Bundle bundle = new Bundle(); - bundle.putLong(Helper.ARG_INTENT_ID, bundleId); - intentContext.putExtras(bundle); - intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intentContext); - }); - }) - .show(); - //The message was edited, we need to update the timeline - if (statusEditId != null) { - //Update message in cache - new Thread(() -> { - StatusCache statusCache = new StatusCache(); - statusCache.instance = BaseMainActivity.currentInstance; - statusCache.user_id = BaseMainActivity.currentUserID; - statusCache.status = statusSent; - statusCache.status_id = statusEditId; - try { - new StatusCache(BaseMainActivity.this).updateIfExists(statusCache); - } catch (DBException e) { - e.printStackTrace(); - } - }).start(); - //Update timelines - sendAction(context, Helper.ARG_STATUS_UPDATED, statusSent, null); - } - } + }); + } } }; @@ -707,12 +722,17 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt } viewPager.setCurrentItem(position); } - Bundle b = new Bundle(); - b.putBoolean(ARG_REFRESH_NOTFICATION, true); + Bundle args = new Bundle(); + args.putBoolean(ARG_REFRESH_NOTFICATION, true); Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); intentBC.setPackage(BuildConfig.APPLICATION_ID); - intentBC.putExtras(b); - activity.sendBroadcast(intentBC); + new CachedBundle(activity).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intentBC.putExtras(bundle); + activity.sendBroadcast(intentBC); + }); + } }, 1000); intent.removeExtra(Helper.INTENT_ACTION); diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java index 3b0893428..6e5dc8e04 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java @@ -120,26 +120,31 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana private final BroadcastReceiver imageReceiver = new BroadcastReceiver() { @Override public void onReceive(android.content.Context context, Intent intent) { - String imgpath = intent.getStringExtra("imgpath"); - float focusX = intent.getFloatExtra("focusX", -2); - float focusY = intent.getFloatExtra("focusY", -2); - if (imgpath != null) { - int position = 0; - for (Status status : statusList) { - if (status.media_attachments != null && status.media_attachments.size() > 0) { - for (Attachment attachment : status.media_attachments) { - if (attachment.local_path != null && attachment.local_path.equalsIgnoreCase(imgpath)) { - if (focusX != -2) { - attachment.focus = focusX + "," + focusY; + Bundle args = intent.getExtras(); + if (args != null) { + long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1); + new CachedBundle(ComposeActivity.this).getBundle(bundleId, currentAccount, bundle -> { + String imgpath = bundle.getString("imgpath"); + float focusX = bundle.getFloat("focusX", -2); + float focusY = bundle.getFloat("focusY", -2); + if (imgpath != null) { + int position = 0; + for (Status status : statusList) { + if (status.media_attachments != null && status.media_attachments.size() > 0) { + for (Attachment attachment : status.media_attachments) { + if (attachment.local_path != null && attachment.local_path.equalsIgnoreCase(imgpath)) { + if (focusX != -2) { + attachment.focus = focusX + "," + focusY; + } + composeAdapter.notifyItemChanged(position); + break; + } } - - composeAdapter.notifyItemChanged(position); - break; } + position++; } } - position++; - } + }); } } }; diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/HashTagActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/HashTagActivity.java index 94d8b0e92..8cf93a411 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/HashTagActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/HashTagActivity.java @@ -41,6 +41,7 @@ import app.fedilab.android.activities.MainActivity; import app.fedilab.android.databinding.ActivityHashtagBinding; import app.fedilab.android.mastodon.client.entities.api.Filter; import app.fedilab.android.mastodon.client.entities.api.Status; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.client.entities.app.Pinned; import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline; import app.fedilab.android.mastodon.client.entities.app.StatusDraft; @@ -158,10 +159,14 @@ public class HashTagActivity extends BaseActivity { List<Status> statuses = new ArrayList<>(); statuses.add(status); statusDraft.statusDraftList = statuses; - Bundle _b = new Bundle(); - _b.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft); - intentToot.putExtras(_b); - startActivity(intentToot); + Bundle args = new Bundle(); + args.putSerializable(Helper.ARG_STATUS_DRAFT, statusDraft); + new CachedBundle(HashTagActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundleCached = new Bundle(); + bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId); + intentToot.putExtras(bundleCached); + startActivity(intentToot); + }); }); } @@ -188,13 +193,18 @@ public class HashTagActivity extends BaseActivity { } pinnedTag = false; invalidateOptionsMenu(); - Bundle b = new Bundle(); - b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); + Bundle args = new Bundle(); + args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); Intent intentBD = new Intent(Helper.BROADCAST_DATA); - intentBD.putExtras(b); - intentBD.setPackage(BuildConfig.APPLICATION_ID); - sendBroadcast(intentBD); - dialog.dismiss(); + new CachedBundle(HashTagActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intentBD.putExtras(bundle); + intentBD.setPackage(BuildConfig.APPLICATION_ID); + sendBroadcast(intentBD); + dialog.dismiss(); + }); + }); unpinConfirm.show(); } else { @@ -243,12 +253,16 @@ public class HashTagActivity extends BaseActivity { } else { new Pinned(HashTagActivity.this).insertPinned(pinned); } - Bundle b = new Bundle(); - b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); + Bundle args = new Bundle(); + args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); Intent intentBD = new Intent(Helper.BROADCAST_DATA); - intentBD.putExtras(b); - intentBD.setPackage(BuildConfig.APPLICATION_ID); - sendBroadcast(intentBD); + new CachedBundle(HashTagActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intentBD.putExtras(bundle); + intentBD.setPackage(BuildConfig.APPLICATION_ID); + sendBroadcast(intentBD); + }); pinnedTag = true; invalidateOptionsMenu(); } catch (DBException e) { diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/MastodonListActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/MastodonListActivity.java index 2e4873742..929b80385 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/MastodonListActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/MastodonListActivity.java @@ -15,6 +15,8 @@ package app.fedilab.android.mastodon.activities; * see <http://www.gnu.org/licenses>. */ +import static app.fedilab.android.BaseMainActivity.currentAccount; + import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; @@ -45,12 +47,12 @@ import java.util.Objects; import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BuildConfig; import app.fedilab.android.R; -import app.fedilab.android.activities.MainActivity; import app.fedilab.android.databinding.ActivityListBinding; import app.fedilab.android.databinding.PopupAddListBinding; import app.fedilab.android.databinding.PopupManageAccountsListBinding; import app.fedilab.android.mastodon.client.entities.api.Account; import app.fedilab.android.mastodon.client.entities.api.MastodonList; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.client.entities.app.Pinned; import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline; import app.fedilab.android.mastodon.client.entities.app.Timeline; @@ -175,7 +177,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0) .observe(MastodonListActivity.this, accounts -> { if (accounts != null && accounts.size() > 0) { - accountsVM.muteAccountsHome(MainActivity.currentAccount, accounts); + accountsVM.muteAccountsHome(currentAccount, accounts); } }); dialog.dismiss(); @@ -307,13 +309,17 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis } else { binding.notContent.setVisibility(View.GONE); } - Bundle b = new Bundle(); - b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); + Bundle args = new Bundle(); + args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); Intent intentBD = new Intent(Helper.BROADCAST_DATA); - b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList); - intentBD.putExtras(b); - intentBD.setPackage(BuildConfig.APPLICATION_ID); - sendBroadcast(intentBD); + args.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList); + new CachedBundle(MastodonListActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intentBD.putExtras(bundle); + intentBD.setPackage(BuildConfig.APPLICATION_ID); + sendBroadcast(intentBD); + }); }); alt_bld.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss()); AlertDialog alert = alt_bld.create(); @@ -343,13 +349,17 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis } else { Toasty.error(MastodonListActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show(); } - Bundle b = new Bundle(); - b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); + Bundle args = new Bundle(); + args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); Intent intentBD = new Intent(Helper.BROADCAST_DATA); - b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList); - intentBD.putExtras(b); - intentBD.setPackage(BuildConfig.APPLICATION_ID); - sendBroadcast(intentBD); + args.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList); + new CachedBundle(MastodonListActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intentBD.putExtras(bundle); + intentBD.setPackage(BuildConfig.APPLICATION_ID); + sendBroadcast(intentBD); + }); }); dialog.dismiss(); } else { @@ -392,12 +402,16 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis new Thread(() -> { try { new Pinned(MastodonListActivity.this).updatePinned(pinned); - Bundle b = new Bundle(); - b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); + Bundle args = new Bundle(); + args.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); Intent intentBD = new Intent(Helper.BROADCAST_DATA); - intentBD.putExtras(b); - intentBD.setPackage(BuildConfig.APPLICATION_ID); - sendBroadcast(intentBD); + new CachedBundle(MastodonListActivity.this).insertBundle(args, currentAccount, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intentBD.putExtras(bundle); + intentBD.setPackage(BuildConfig.APPLICATION_ID); + sendBroadcast(intentBD); + }); } catch ( DBException e) { e.printStackTrace(); diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/MediaActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/MediaActivity.java index 718081abc..8c9dae7f3 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/MediaActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/MediaActivity.java @@ -84,10 +84,10 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload private final BroadcastReceiver onDownloadComplete = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { + long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if (downloadID == id) { DownloadManager manager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE); - assert manager != null; Uri uri = manager.getUriForDownloadedFile(downloadID); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java index 44240c6f4..9be0b1ee7 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/ProfileActivity.java @@ -135,23 +135,14 @@ public class ProfileActivity extends BaseActivity { Bundle args = intent.getExtras(); if (args != null) { long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1); - if (bundleId != -1) { - new CachedBundle(ProfileActivity.this).getBundle(bundleId, currentAccount, bundle -> { - Account accountReceived = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT); - if (bundle.getBoolean(Helper.RECEIVE_REDRAW_PROFILE, false) && accountReceived != null) { |