diff options
Diffstat (limited to 'src/de/blinkt/openvpn/VPNConfigPreference.java')
-rw-r--r-- | src/de/blinkt/openvpn/VPNConfigPreference.java | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/src/de/blinkt/openvpn/VPNConfigPreference.java b/src/de/blinkt/openvpn/VPNConfigPreference.java index 3afcfccb..0387ebdb 100644 --- a/src/de/blinkt/openvpn/VPNConfigPreference.java +++ b/src/de/blinkt/openvpn/VPNConfigPreference.java @@ -1,15 +1,55 @@ package de.blinkt.openvpn; -import android.content.Context; -import android.preference.CheckBoxPreference; +import android.os.Bundle; import android.preference.Preference; -import android.util.AttributeSet; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.ImageView; -public class VPNConfigPreference extends Preference { +public class VPNConfigPreference extends Preference implements OnClickListener { - public VPNConfigPreference(Context context, AttributeSet attrs) { - super(context, attrs); - setWidgetLayoutResource(R.layout.vpn_preference_layout); + + 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); + } + + } + + } |