Loading app/src/main/java/app/fedilab/android/BaseMainActivity.java +123 −103 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -220,11 +221,13 @@ 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); 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); Loading @@ -232,12 +235,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt snackbar .setAction(getString(R.string.open_draft), view -> { Intent intentCompose = new Intent(context, ComposeActivity.class); intentCompose.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft); 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(); } }); } } }; Loading @@ -246,13 +257,15 @@ 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); 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 (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { 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 Loading Loading @@ -296,20 +309,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt return true; }); } } else if (b.getBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, false)) { } else if (bundle.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); } 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 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); 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); }); Loading @@ -334,6 +347,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt sendAction(context, Helper.ARG_STATUS_UPDATED, statusSent, null); } } }); } } }; Loading Loading @@ -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); 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); Loading app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java +21 −16 Original line number Diff line number Diff line Loading @@ -120,9 +120,13 @@ 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); 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) { Loading @@ -132,7 +136,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana if (focusX != -2) { attachment.focus = focusX + "," + focusY; } composeAdapter.notifyItemChanged(position); break; } Loading @@ -141,6 +144,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana position++; } } }); } } }; private boolean promptSaveDraft; Loading app/src/main/java/app/fedilab/android/mastodon/activities/HashTagActivity.java +29 −15 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -158,11 +159,15 @@ 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); 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); }); }); } @Override Loading @@ -188,14 +193,19 @@ 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); 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 { new Thread(() -> { Loading Loading @@ -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); 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) { Loading app/src/main/java/app/fedilab/android/mastodon/activities/MastodonListActivity.java +33 −19 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -307,14 +309,18 @@ 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); 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(); alert.show(); Loading Loading @@ -343,14 +349,18 @@ 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); 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 { popupAddListBinding.addList.setError(getString(R.string.not_valid_list_name)); Loading Loading @@ -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); 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(); Loading app/src/main/java/app/fedilab/android/mastodon/activities/MediaActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading Loading
app/src/main/java/app/fedilab/android/BaseMainActivity.java +123 −103 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -220,11 +221,13 @@ 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); 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); Loading @@ -232,12 +235,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt snackbar .setAction(getString(R.string.open_draft), view -> { Intent intentCompose = new Intent(context, ComposeActivity.class); intentCompose.putExtra(Helper.ARG_STATUS_DRAFT, statusDraft); 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(); } }); } } }; Loading @@ -246,13 +257,15 @@ 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); 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 (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { 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 Loading Loading @@ -296,20 +309,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt return true; }); } } else if (b.getBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, false)) { } else if (bundle.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); } 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 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); 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); }); Loading @@ -334,6 +347,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt sendAction(context, Helper.ARG_STATUS_UPDATED, statusSent, null); } } }); } } }; Loading Loading @@ -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); 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); Loading
app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java +21 −16 Original line number Diff line number Diff line Loading @@ -120,9 +120,13 @@ 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); 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) { Loading @@ -132,7 +136,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana if (focusX != -2) { attachment.focus = focusX + "," + focusY; } composeAdapter.notifyItemChanged(position); break; } Loading @@ -141,6 +144,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana position++; } } }); } } }; private boolean promptSaveDraft; Loading
app/src/main/java/app/fedilab/android/mastodon/activities/HashTagActivity.java +29 −15 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -158,11 +159,15 @@ 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); 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); }); }); } @Override Loading @@ -188,14 +193,19 @@ 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); 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 { new Thread(() -> { Loading Loading @@ -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); 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) { Loading
app/src/main/java/app/fedilab/android/mastodon/activities/MastodonListActivity.java +33 −19 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -307,14 +309,18 @@ 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); 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(); alert.show(); Loading Loading @@ -343,14 +349,18 @@ 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); 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 { popupAddListBinding.addList.setError(getString(R.string.not_valid_list_name)); Loading Loading @@ -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); 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(); Loading
app/src/main/java/app/fedilab/android/mastodon/activities/MediaActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -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); Loading