diff options
Diffstat (limited to 'app/src/main/java/com/wireguard/android/ProfileActivityFragment.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/ProfileActivityFragment.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/ProfileActivityFragment.java b/app/src/main/java/com/wireguard/android/ProfileActivityFragment.java new file mode 100644 index 00000000..da394204 --- /dev/null +++ b/app/src/main/java/com/wireguard/android/ProfileActivityFragment.java @@ -0,0 +1,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; + } +} |