summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/ProviderObservable.java
blob: 776c0e92069c8d89588b4a163f3909df7c7686fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package se.leap.bitmaskclient;

import java.util.Observable;

import se.leap.bitmaskclient.utils.PreferenceHelper;

/**
 * Created by cyberta on 05.12.18.
 */
public class ProviderObservable extends Observable {
    private static ProviderObservable instance;
    private Provider currentProvider;

    public static ProviderObservable getInstance() {
        if (instance == null) {
            instance = new ProviderObservable();
        }
        return instance;
    }

    public synchronized void updateProvider(Provider provider) {
        instance.currentProvider = provider;
        instance.setChanged();
        instance.notifyObservers();
    }

    public Provider getCurrentProvider() {
        return instance.currentProvider;
    }

}