diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-04-23 00:07:02 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-04-23 00:07:02 +0200 |
commit | 58e2574f6a27930679f976278ad9c3dbc8d4ef2a (patch) | |
tree | ed66e30a6d1acf1fcb68672cb636507e0bd89d2a /src/de/blinkt/openvpn/VPNConfigPreference.java | |
parent | 488a41cc60636298581c2b44b4706b259fc98a36 (diff) |
Doing progress on the Preference dialog chaos
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); + } + + } + + } |