summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android/ProfileDetailFragment.java
blob: 0fed7708a810dd7a26d16ce2cb2a087d5ebf48c6 (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
38
39
40
41
42
43
package com.wireguard.android;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wireguard.android.databinding.ProfileDetailFragmentBinding;
import com.wireguard.config.Profile;

/**
 * Fragment for viewing information about a WireGuard profile.
 */

public class ProfileDetailFragment extends ProfileFragment {
    private ProfileDetailFragmentBinding binding;

    @Override
    protected void onCachedProfileChanged(Profile cachedProfile) {
        if (binding != null)
            binding.setProfile(cachedProfile);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.profile_detail, menu);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
        binding = ProfileDetailFragmentBinding.inflate(inflater, parent, false);
        binding.setProfile(getCachedProfile());
        return binding.getRoot();
    }
}