summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/VPNConfigPreference.java
blob: 0387ebdbdbe1782519a67705c029bb4a1cb114a6 (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
package de.blinkt.openvpn;

import android.os.Bundle;
import android.preference.Preference;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class VPNConfigPreference extends Preference implements OnClickListener {


	private OnQuickSettingsClickListener mOnQuickSettingsListener;
	private ImageView mQuickPrefButton;


	public VPNConfigPreference(VPNProfileList vpnProfileList, Bundle args) {

		super(vpnProfileList.getActivity());
		setWidgetLayoutResource(R.layout.vpn_preference_layout);


	}

	@Override
	protected void onBindView(View view) {
		super.onBindView(view);
		mQuickPrefButton = (ImageView) view.findViewById(R.id.quickedit_settings);
		mQuickPrefButton.setOnClickListener(this);
	}

	public interface OnQuickSettingsClickListener {
		/**
		 * 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);
	}


	public void setOnQuickSettingsClickListener(OnQuickSettingsClickListener onQuickSettingsListener) {
		mOnQuickSettingsListener = onQuickSettingsListener;
	}

	@Override
	public void onClick(View v) {
		if (mOnQuickSettingsListener != null) {
			mOnQuickSettingsListener.onQuickSettingsClick(this);
		}

	}


}