Set app Id when sending BroadCasts

update_14
Thomas 11 months ago
parent 9225ec35b5
commit 25e42fc7da

@ -177,7 +177,6 @@ dependencies {
implementation 'androidx.browser:browser:1.7.0' implementation 'androidx.browser:browser:1.7.0'
implementation 'androidx.documentfile:documentfile:1.0.1' implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'com.github.amoskorir:avatarimagegenerator:1.5.0' implementation 'com.github.amoskorir:avatarimagegenerator:1.5.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'com.google.android.exoplayer:extension-mediasession:2.19.1' implementation 'com.google.android.exoplayer:extension-mediasession:2.19.1'
implementation "com.github.mabbas007:TagsEditText:1.0.5" implementation "com.github.mabbas007:TagsEditText:1.0.5"
implementation "net.gotev:uploadservice:4.9.2" implementation "net.gotev:uploadservice:4.9.2"

@ -28,7 +28,7 @@ import android.view.View;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@ -38,6 +38,7 @@ import org.jetbrains.annotations.NotNull;
import java.io.IOException; import java.io.IOException;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityPeertubeBinding; import app.fedilab.android.databinding.ActivityPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseBarActivity; import app.fedilab.android.mastodon.activities.BaseBarActivity;
@ -124,7 +125,8 @@ public class BasePeertubeActivity extends BaseBarActivity {
if (PeertubeBaseMainActivity.chromecastActivated) { if (PeertubeBaseMainActivity.chromecastActivated) {
b.putInt("displayed", 0); b.putInt("displayed", 0);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(BasePeertubeActivity.this).sendBroadcast(intentBC); intentBC.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBC);
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> { Runnable myRunnable = () -> {
binding.doubleTapPlayerView.setVisibility(View.VISIBLE); binding.doubleTapPlayerView.setVisibility(View.VISIBLE);
@ -136,7 +138,8 @@ public class BasePeertubeActivity extends BaseBarActivity {
b.putInt("displayed", 1); b.putInt("displayed", 1);
b.putSerializable("castedTube", peertube); b.putSerializable("castedTube", peertube);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(BasePeertubeActivity.this).sendBroadcast(intentBC); intentBC.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBC);
try { try {
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> { Runnable myRunnable = () -> {

@ -26,7 +26,7 @@ import android.os.Looper;
import android.view.View; import android.view.View;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
@ -36,6 +36,7 @@ import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityMainPeertubeBinding; import app.fedilab.android.databinding.ActivityMainPeertubeBinding;
import app.fedilab.android.mastodon.activities.BaseActivity; import app.fedilab.android.mastodon.activities.BaseActivity;
@ -70,7 +71,8 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putInt("displayed", 0); b.putInt("displayed", 0);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(PeertubeBaseMainActivity.this).sendBroadcast(intentBC); intentBC.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBC);
}); });
binding.castTogglePlay.setOnClickListener(v -> { binding.castTogglePlay.setOnClickListener(v -> {

@ -80,7 +80,7 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.navigation.NavController; import androidx.navigation.NavController;
import androidx.navigation.Navigation; import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.AppBarConfiguration;
@ -694,8 +694,9 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putBoolean(ARG_REFRESH_NOTFICATION, true); b.putBoolean(ARG_REFRESH_NOTFICATION, true);
Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION);
intentBC.setPackage(BuildConfig.APPLICATION_ID);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(activity).sendBroadcast(intentBC); activity.sendBroadcast(intentBC);
} }
}, 1000); }, 1000);
intent.removeExtra(Helper.INTENT_ACTION); intent.removeExtra(Helper.INTENT_ACTION);

@ -49,7 +49,7 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.work.Data; import androidx.work.Data;

@ -32,7 +32,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@ -43,6 +43,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.AccountFieldItemBinding; import app.fedilab.android.databinding.AccountFieldItemBinding;
import app.fedilab.android.databinding.ActivityEditProfileBinding; import app.fedilab.android.databinding.ActivityEditProfileBinding;
@ -270,7 +271,8 @@ public class EditProfileActivity extends BaseBarActivity {
b.putSerializable(Helper.ARG_ACCOUNT, account); b.putSerializable(Helper.ARG_ACCOUNT, account);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(EditProfileActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
} }
private Intent prepareIntent() { private Intent prepareIntent() {

@ -28,7 +28,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityHashtagBinding; import app.fedilab.android.databinding.ActivityHashtagBinding;
@ -192,7 +193,8 @@ public class HashTagActivity extends BaseActivity {
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(HashTagActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
dialog.dismiss(); dialog.dismiss();
}); });
unpinConfirm.show(); unpinConfirm.show();
@ -246,7 +248,8 @@ public class HashTagActivity extends BaseActivity {
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(HashTagActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
pinnedTag = true; pinnedTag = true;
invalidateOptionsMenu(); invalidateOptionsMenu();
} catch (DBException e) { } catch (DBException e) {

@ -30,7 +30,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -41,6 +41,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityListBinding; import app.fedilab.android.databinding.ActivityListBinding;
@ -290,7 +291,8 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList); b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(MastodonListActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
}); });
alt_bld.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss()); alt_bld.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
AlertDialog alert = alt_bld.create(); AlertDialog alert = alt_bld.create();
@ -325,7 +327,8 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList); b.putSerializable(Helper.RECEIVE_MASTODON_LIST, mastodonListList);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(MastodonListActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
}); });
dialog.dismiss(); dialog.dismiss();
} else { } else {
@ -372,7 +375,8 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(MastodonListActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
} catch ( } catch (
DBException e) { DBException e) {
e.printStackTrace(); e.printStackTrace();

@ -57,7 +57,7 @@ import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat; import androidx.core.app.ActivityOptionsCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -79,6 +79,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityProfileBinding; import app.fedilab.android.databinding.ActivityProfileBinding;
@ -904,7 +905,8 @@ public class ProfileActivity extends BaseActivity {
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(ProfileActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
}); });
} catch (DBException e) { } catch (DBException e) {
e.printStackTrace(); e.printStackTrace();

@ -31,7 +31,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -43,6 +43,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityReorderTabsBinding; import app.fedilab.android.databinding.ActivityReorderTabsBinding;
@ -288,7 +289,8 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(ReorderTimelinesActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
}); });
} else { } else {
runOnUiThread(() -> Toasty.warning(ReorderTimelinesActivity.this, getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show()); runOnUiThread(() -> Toasty.warning(ReorderTimelinesActivity.this, getString(R.string.toast_instance_unavailable), Toast.LENGTH_LONG).show());
@ -376,14 +378,16 @@ public class ReorderTimelinesActivity extends BaseBarActivity implements OnStart
b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true); b.putBoolean(Helper.RECEIVE_REDRAW_TOPBAR, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(ReorderTimelinesActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
} }
if (bottomChanges) { if (bottomChanges) {
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putBoolean(Helper.RECEIVE_REDRAW_BOTTOM, true); b.putBoolean(Helper.RECEIVE_REDRAW_BOTTOM, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(ReorderTimelinesActivity.this).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentBD);
} }
} }

@ -33,7 +33,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;

@ -26,10 +26,11 @@ import android.widget.ArrayAdapter;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityAdminDomainblockBinding; import app.fedilab.android.databinding.ActivityAdminDomainblockBinding;
@ -108,7 +109,8 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
Toasty.error(AdminDomainBlockActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); Toasty.error(AdminDomainBlockActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
} }
Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK, adminDomainBlockResult); Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK, adminDomainBlockResult);
LocalBroadcastManager.getInstance(AdminDomainBlockActivity.this).sendBroadcast(intent); intent.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intent);
finish(); finish();
} }
); );
@ -136,7 +138,8 @@ public class AdminDomainBlockActivity extends BaseBarActivity {
adminVM.deleteDomain(MainActivity.currentInstance, MainActivity.currentToken, adminDomainBlock.id) adminVM.deleteDomain(MainActivity.currentInstance, MainActivity.currentToken, adminDomainBlock.id)
.observe(AdminDomainBlockActivity.this, adminDomainBlockResult -> { .observe(AdminDomainBlockActivity.this, adminDomainBlockResult -> {
Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE, adminDomainBlock); Intent intent = new Intent(Helper.BROADCAST_DATA).putExtra(Helper.ARG_ADMIN_DOMAINBLOCK_DELETE, adminDomainBlock);
LocalBroadcastManager.getInstance(AdminDomainBlockActivity.this).sendBroadcast(intent); intent.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intent);
finish(); finish();
} }
); );

@ -89,7 +89,7 @@ import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -857,6 +857,7 @@ public class Helper {
b.putString(RECEIVE_TOAST_CONTENT, content); b.putString(RECEIVE_TOAST_CONTENT, content);
intentBC.setAction(Helper.RECEIVE_TOAST_MESSAGE); intentBC.setAction(Helper.RECEIVE_TOAST_MESSAGE);
intentBC.putExtras(b); intentBC.putExtras(b);
intentBC.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBC); context.sendBroadcast(intentBC);
} }
@ -1498,7 +1499,8 @@ public class Helper {
b.putBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, true); b.putBoolean(Helper.RECEIVE_RECREATE_ACTIVITY, true);
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(activity).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
activity.sendBroadcast(intentBD);
} }
public static void showKeyboard(Context context, View view) { public static void showKeyboard(Context context, View view) {

@ -22,7 +22,7 @@ import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.exifinterface.media.ExifInterface; import androidx.exifinterface.media.ExifInterface;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.transition.ChangeBounds; import androidx.transition.ChangeBounds;
import androidx.transition.TransitionManager; import androidx.transition.TransitionManager;
@ -39,6 +39,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.ActivityEditImageBinding; import app.fedilab.android.databinding.ActivityEditImageBinding;
import app.fedilab.android.mastodon.helper.CirclesDrawingView; import app.fedilab.android.mastodon.helper.CirclesDrawingView;
@ -327,7 +328,8 @@ public class EditImageActivity extends BaseActivity implements OnPhotoEditorList
intentImage.putExtra("focusY", focusY); intentImage.putExtra("focusY", focusY);
} }
LocalBroadcastManager.getInstance(EditImageActivity.this).sendBroadcast(intentImage); intentImage.setPackage(BuildConfig.APPLICATION_ID);
sendBroadcast(intentImage);
finish(); finish();
} }
} }

@ -31,7 +31,7 @@ import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.work.Data; import androidx.work.Data;
import androidx.work.ForegroundInfo; import androidx.work.ForegroundInfo;
@ -51,6 +51,7 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.mastodon.client.endpoints.MastodonStatusesService; import app.fedilab.android.mastodon.client.endpoints.MastodonStatusesService;
import app.fedilab.android.mastodon.client.entities.api.Attachment; import app.fedilab.android.mastodon.client.entities.api.Attachment;
@ -228,7 +229,8 @@ public class ComposeWorker extends Worker {
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, context.getString(R.string.media_cannot_be_uploaded)); b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, context.getString(R.string.media_cannot_be_uploaded));
b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft); b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
return; return;
} }
if (statuses.get(i).local_only) { if (statuses.get(i).local_only) {
@ -312,7 +314,8 @@ public class ComposeWorker extends Worker {
} }
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err); b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
return; return;
} }
} catch (IOException e) { } catch (IOException e) {
@ -323,7 +326,8 @@ public class ComposeWorker extends Worker {
Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE); Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE);
b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, e.getMessage()); b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, e.getMessage());
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
return; return;
} }
} else { } else {
@ -377,7 +381,8 @@ public class ComposeWorker extends Worker {
Intent intentBD = new Intent(Helper.BROADCAST_DATA); Intent intentBD = new Intent(Helper.BROADCAST_DATA);
b.putSerializable(Helper.RECEIVE_STATUS_ACTION, firstSendMessage); b.putSerializable(Helper.RECEIVE_STATUS_ACTION, firstSendMessage);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBD);
} }
} }

@ -57,6 +57,7 @@ import android.os.Looper;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -87,7 +88,7 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -121,6 +122,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import app.fedilab.android.BaseMainActivity; import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.DrawerFetchMoreBinding; import app.fedilab.android.databinding.DrawerFetchMoreBinding;
@ -2784,7 +2786,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} }
Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION); Intent intentBC = new Intent(Helper.RECEIVE_STATUS_ACTION);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC); intentBC.setPackage(BuildConfig.APPLICATION_ID);
context.sendBroadcast(intentBC);
} }

@ -30,7 +30,7 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import java.util.ArrayList; import java.util.ArrayList;

@ -50,7 +50,7 @@ import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.work.Data; import androidx.work.Data;

@ -31,7 +31,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;

@ -27,6 +27,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -36,7 +37,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -94,6 +95,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras(); Bundle b = intent.getExtras();
Log.v(Helper.TAG, "onReceive: " + b);
if (b != null) { if (b != null) {
Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION); Status receivedStatus = (Status) b.getSerializable(Helper.ARG_STATUS_ACTION);
String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED); String delete_statuses_for_user = b.getString(Helper.ARG_STATUS_ACCOUNT_ID_DELETED);

@ -61,7 +61,7 @@ import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;

@ -17,7 +17,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.ListPreference; import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference; import androidx.preference.MultiSelectListPreference;
import androidx.preference.Preference; import androidx.preference.Preference;
@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.peertube.activities.MyAccountActivity; import app.fedilab.android.peertube.activities.MyAccountActivity;
import app.fedilab.android.peertube.activities.PeertubeMainActivity; import app.fedilab.android.peertube.activities.PeertubeMainActivity;
@ -247,7 +248,8 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putInt("state_asked", set_cast_choice.isChecked() ? 1 : 0); b.putInt("state_asked", set_cast_choice.isChecked() ? 1 : 0);
intentBC.putExtras(b); intentBC.putExtras(b);
LocalBroadcastManager.getInstance(requireActivity()).sendBroadcast(intentBC); intentBC.setPackage(BuildConfig.APPLICATION_ID);
requireActivity().sendBroadcast(intentBC);
} }
if (key.compareTo(getString(R.string.set_video_language_choice)) == 0) { if (key.compareTo(getString(R.string.set_video_language_choice)) == 0) {
MultiSelectListPreference set_video_language_choice = findPreference(getString(R.string.set_video_language_choice)); MultiSelectListPreference set_video_language_choice = findPreference(getString(R.string.set_video_language_choice));

@ -57,7 +57,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.avatarfirst.avatargenlib.AvatarGenerator; import com.avatarfirst.avatargenlib.AvatarGenerator;
@ -83,6 +83,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import app.fedilab.android.BuildConfig;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.mastodon.client.entities.app.BaseAccount; import app.fedilab.android.mastodon.client.entities.app.BaseAccount;
import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.exception.DBException;
@ -632,7 +633,8 @@ public class Helper {
b.putBoolean(app.fedilab.android.mastodon.helper.Helper.RECEIVE_RECREATE_PEERTUBE_ACTIVITY, true); b.putBoolean(app.fedilab.android.mastodon.helper.Helper.RECEIVE_RECREATE_PEERTUBE_ACTIVITY, true);
Intent intentBD = new Intent(app.fedilab.android.mastodon.helper.Helper.BROADCAST_DATA); Intent intentBD = new Intent(app.fedilab.android.mastodon.helper.Helper.BROADCAST_DATA);
intentBD.putExtras(b); intentBD.putExtras(b);
LocalBroadcastManager.getInstance(activity).sendBroadcast(intentBD); intentBD.setPackage(BuildConfig.APPLICATION_ID);
activity.sendBroadcast(intentBD);
} }
public static int getAttColor(Context context, int attColor) { public static int getAttColor(Context context, int attColor) {

Loading…
Cancel
Save