summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android/ProfileActivityFragment.java
blob: da394204553dd956a091b4640c2cee78b6679454 (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
32
33
34
35
36
37
package com.wireguard.android;

import android.app.Fragment;
import android.content.Context;

/**
 * Base class for fragments that are part of a ProfileActivity.
 */

public class ProfileActivityFragment extends Fragment implements ServiceConnectionListener {
    private ProfileActivity activity;
    protected ProfileServiceInterface service;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        activity = (ProfileActivity) context;
        activity.addServiceConnectionListener(this);
        service = activity.getService();
    }

    @Override
    public void onDetach() {
        super.onDetach();
        activity.removeServiceConnectionListener(this);
    }

    @Override
    public void onServiceConnected(ProfileServiceInterface service) {
        this.service = service;
    }

    @Override
    public void onServiceDisconnected() {
        service = null;
    }
}