Search in sources :

Example 21 with LocalBroadcastManager

use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.

the class GraphActivity method unregisterReceivers.

private void unregisterReceivers() {
    LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
    broadcastManager.unregisterReceiver(updatedReceiver);
    broadcastManager.unregisterReceiver(createdReceiver);
}
Also used : LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager)

Example 22 with LocalBroadcastManager

use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.

the class TableActivity method onPause.

@Override
protected void onPause() {
    super.onPause();
    LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
    broadcastManager.unregisterReceiver(receiver);
}
Also used : LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager)

Example 23 with LocalBroadcastManager

use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.

the class NewStationNotificationService method onStartCommand.

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    BroadcastReceiver receiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            update();
        }
    };
    try {
        LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
        broadcastManager.registerReceiver(receiver, new IntentFilter(SexyTopo.NEW_STATION_CREATED_EVENT));
    } catch (Exception exception) {
        FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
        crashlytics.recordException(exception);
        Log.e(exception);
    }
    return START_REDELIVER_INTENT;
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager) FirebaseCrashlytics(com.google.firebase.crashlytics.FirebaseCrashlytics)

Example 24 with LocalBroadcastManager

use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.

the class CalibrationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_calibration);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    BroadcastReceiver updatedCalibrationReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            syncWithReadings();
        }
    };
    LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
    broadcastManager.registerReceiver(updatedCalibrationReceiver, new IntentFilter(SexyTopo.CALIBRATION_UPDATED_EVENT));
}
Also used : Context(android.content.Context) IntentFilter(android.content.IntentFilter) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager)

Example 25 with LocalBroadcastManager

use of androidx.localbroadcastmanager.content.LocalBroadcastManager in project sexytopo by richsmith.

the class DeviceActivity method onPause.

@Override
protected void onPause() {
    super.onPause();
    try {
        unregisterReceiver(stateChangeReceiver);
        unregisterReceiver(scanReceiver);
        LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
        broadcastManager.unregisterReceiver(logUpdateReceiver);
    } catch (Exception exception) {
        // this shouldn't ever happen
        Log.e("Error unregistering receiver: " + exception.getMessage());
    }
}
Also used : LocalBroadcastManager(androidx.localbroadcastmanager.content.LocalBroadcastManager)

Aggregations

LocalBroadcastManager (androidx.localbroadcastmanager.content.LocalBroadcastManager)30 IntentFilter (android.content.IntentFilter)15 BroadcastReceiver (android.content.BroadcastReceiver)9 Intent (android.content.Intent)8 Context (android.content.Context)7 ArrayList (java.util.ArrayList)4 Bundle (android.os.Bundle)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Apk (org.fdroid.fdroid.data.Apk)3 Uri (android.net.Uri)2 FragmentActivity (androidx.fragment.app.FragmentActivity)2 Test (org.junit.Test)2 SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 BluetoothDevice (android.bluetooth.BluetoothDevice)1 Handler (android.os.Handler)1 HandlerThread (android.os.HandlerThread)1 Message (android.os.Message)1 ScrollView (android.widget.ScrollView)1 FirebaseCrashlytics (com.google.firebase.crashlytics.FirebaseCrashlytics)1