blob: d1a3346e47a88242467526411ac0abcc83d09143 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
package de.blinkt.openvpn;
import android.preference.Preference;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class VPNConfigPreference extends Preference implements OnClickListener {
class startClickListener implements OnClickListener{
private VPNConfigPreference mvp;
public startClickListener(VPNConfigPreference vp) {
mvp = vp;
}
@Override
public void onClick(View v) {
mOnQuickSettingsListener.onStartVPNClick(mvp);
}
}
private VpnPreferencesClickListener mOnQuickSettingsListener;
private ImageView mQuickPrefButton;
public VPNConfigPreference(VPNProfileList vpnProfileList) {
super(vpnProfileList.getActivity());
setLayoutResource(R.layout.vpn_preference_layout);
}
private View mProfilesPref;
@Override
protected void onBindView(View view) {
super.onBindView(view);
mProfilesPref = view.findViewById(R.id.vpnconfig_pref);
mProfilesPref.setOnClickListener(new startClickListener(this));
mProfilesPref.setClickable(true);
mQuickPrefButton = (ImageView) view.findViewById(R.id.quickedit_settings);
mQuickPrefButton.setOnClickListener(this);
}
public interface VpnPreferencesClickListener {
/**
* Called when a Preference has been clicked.
*
* @param preference The Preference that was clicked.
* @return True if the click was handled.
*/
boolean onQuickSettingsClick(Preference preference);
void onStartVPNClick(VPNConfigPreference vpnConfigPreference);
}
public void setOnQuickSettingsClickListener(VpnPreferencesClickListener onQuickSettingsListener) {
mOnQuickSettingsListener = onQuickSettingsListener;
}
@Override
public void onClick(View v) {
mOnQuickSettingsListener.onQuickSettingsClick(this);
}
}
|