diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-07-19 14:11:29 -0600 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-07-19 15:10:48 -0600 |
commit | f0c42391501aa646c5d65df5e19dbbd36b19b970 (patch) | |
tree | 0368ca6f91ebbd55f2aaaf56eee0d70beaccb861 /src/se/leap | |
parent | b19dc954b381c1e266395fdc1f19a1246096d4ab (diff) |
Add logic to only trigger EIP control events if switch changed by a touch event.
Fixes VPN reconnection when framework rebuilds view, triggering onCheckedChangeListener
Diffstat (limited to 'src/se/leap')
-rw-r--r-- | src/se/leap/leapclient/EipServiceFragment.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/se/leap/leapclient/EipServiceFragment.java b/src/se/leap/leapclient/EipServiceFragment.java index 51284bc0..c18f83da 100644 --- a/src/se/leap/leapclient/EipServiceFragment.java +++ b/src/se/leap/leapclient/EipServiceFragment.java @@ -12,6 +12,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.ResultReceiver; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; @@ -30,7 +31,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli private View eipDetail; private TextView eipStatus; - private boolean eipAutoSwitched = false; + private boolean eipAutoSwitched = true; private boolean mEipStartPending = false; @@ -55,6 +56,13 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli eipStatus.setOnClickListener(this); eipSwitch = (Switch) eipFragment.findViewById(R.id.eipSwitch); + eipSwitch.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + eipAutoSwitched = false; + return false; + } + }); eipSwitch.setOnCheckedChangeListener(this); return eipFragment; @@ -139,6 +147,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli } } } + eipAutoSwitched = true; } /** |