summaryrefslogtreecommitdiff
authorkejun.gao <kejun.gao@amlogic.com>2012-06-27 02:20:26 (GMT)
committer kejun.gao <kejun.gao@amlogic.com>2012-06-27 02:20:26 (GMT)
commit1aa5dbb1b996228e28e064e93212cdd0e63d02de (patch)
tree1e2b68648547f980e78cda354f2ed8e6d3802b4a
parent5538db1b549cb4a8ab3d6cedc8c60f5ae4ae6514 (diff)
downloadPPPoE-1aa5dbb1b996228e28e064e93212cdd0e63d02de.zip
PPPoE-1aa5dbb1b996228e28e064e93212cdd0e63d02de.tar.gz
PPPoE-1aa5dbb1b996228e28e064e93212cdd0e63d02de.tar.bz2
Fix bug: No PPPOE_STATE_CHANGED_ACTION received when disconnecting PPPoE
Diffstat
-rwxr-xr-xsrc/com/amlogic/PPPoE/PppoeConfigDialog.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/amlogic/PPPoE/PppoeConfigDialog.java b/src/com/amlogic/PPPoE/PppoeConfigDialog.java
index d8ed9f3..3e8613b 100755
--- a/src/com/amlogic/PPPoE/PppoeConfigDialog.java
+++ b/src/com/amlogic/PPPoE/PppoeConfigDialog.java
@@ -148,6 +148,11 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
operation = new PppoeOperation();
buildDialog(context);
waitDialog = new ProgressDialog(this.context);
+
+ pppoeReceiver = new PppoeReceiver();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(PppoeManager.PPPOE_STATE_CHANGED_ACTION);
+ context.registerReceiver(pppoeReceiver, filter);
}
class SpinnerSelectedListener implements OnItemSelectedListener{
@@ -244,12 +249,10 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
//hide AutoDial CheckBox
mCbAutoDial.setVisibility(View.GONE);
-
//hide network interfaces
mNetworkInterfaces.setVisibility(View.GONE);
spinner.setVisibility(View.GONE);
-
//hide Username
mView.findViewById(R.id.user_pppoe_text).setVisibility(View.GONE);
mPppoeName.setVisibility(View.GONE);
@@ -257,6 +260,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
//hide Password
mView.findViewById(R.id.passwd_pppoe_text).setVisibility(View.GONE);
mPppoePasswd.setVisibility(View.GONE);
+
this.setButton(BUTTON_POSITIVE, context.getText(R.string.pppoe_disconnect), this);
/*
@@ -377,6 +381,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
case android.content.DialogInterface.BUTTON_POSITIVE:
{
alertDia.cancel();
+ Log.d(TAG, "User click OK button, exit APK");
clearSelf();
}
break;
@@ -391,11 +396,6 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
private void handleStartDial()
{
- pppoeReceiver = new PppoeReceiver();
- IntentFilter filter = new IntentFilter();
- filter.addAction(PppoeManager.PPPOE_STATE_CHANGED_ACTION);
- context.registerReceiver(pppoeReceiver, filter);
-
tmp_name = mPppoeName.getText().toString();
tmp_passwd = mPppoePasswd.getText().toString();
if(tmp_name != null && tmp_passwd != null)
@@ -456,7 +456,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
private void handleStopDial()
{
boolean result = operation.disconnect();
-
+
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
@@ -511,6 +511,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
}
};
+
//@Override
public void onClick(DialogInterface dialog, int which)
{
@@ -522,6 +523,7 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
handleStartDial();
break;
case BUTTON_NEGATIVE:
+ Log.d(TAG, "User click Discard button, exit APK");
clearSelf();
break;
default:
@@ -567,9 +569,12 @@ public class PppoeConfigDialog extends AlertDialog implements DialogInterface.On
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
+ Log.d(TAG, "User BACK operation, exit APK");
clearSelf();
return true;
}
+
+ Log.d(TAG, "keyCode " + keyCode + " is down, do nothing");
return super.onKeyDown(keyCode, event);
}