Commit d359d8ce authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Merge branch 'hotfix/broadcastReceiver' into develop

parents d8b66b07 6c9220aa
...@@ -34,8 +34,6 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -34,8 +34,6 @@ public abstract class BaseActivity extends NFCActivity {
protected static NemopaySession nemopaySession; protected static NemopaySession nemopaySession;
protected static CASConnexion casConnexion; protected static CASConnexion casConnexion;
protected static InternetBroadcast internetBroadcast;
protected static Config config; protected static Config config;
protected static Dialog dialog; protected static Dialog dialog;
...@@ -44,8 +42,6 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -44,8 +42,6 @@ public abstract class BaseActivity extends NFCActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.internetBroadcast = new InternetBroadcast();
registerReceiver(this.internetBroadcast, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
dialog = new Dialog(this); dialog = new Dialog(this);
} }
...@@ -53,7 +49,6 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -53,7 +49,6 @@ public abstract class BaseActivity extends NFCActivity {
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
unregisterReceiver(this.internetBroadcast);
dialog.dismiss(); dialog.dismiss();
} }
......
...@@ -5,6 +5,7 @@ import android.app.Activity; ...@@ -5,6 +5,7 @@ import android.app.Activity;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
...@@ -35,6 +36,7 @@ import java.util.Map; ...@@ -35,6 +36,7 @@ import java.util.Map;
import fr.utc.simde.payutc.tools.CASConnexion; import fr.utc.simde.payutc.tools.CASConnexion;
import fr.utc.simde.payutc.tools.Config; import fr.utc.simde.payutc.tools.Config;
import fr.utc.simde.payutc.tools.Dialog; import fr.utc.simde.payutc.tools.Dialog;
import fr.utc.simde.payutc.tools.InternetBroadcast;
import fr.utc.simde.payutc.tools.NemopaySession; import fr.utc.simde.payutc.tools.NemopaySession;
public class MainActivity extends BaseActivity { public class MainActivity extends BaseActivity {
...@@ -46,6 +48,8 @@ public class MainActivity extends BaseActivity { ...@@ -46,6 +48,8 @@ public class MainActivity extends BaseActivity {
private static TextView appRegisteredText; private static TextView appRegisteredText;
private static Button usernameButton; private static Button usernameButton;
protected static InternetBroadcast internetBroadcast;
private static SharedPreferences sharedPreferences; private static SharedPreferences sharedPreferences;
@Override @Override
...@@ -59,6 +63,9 @@ public class MainActivity extends BaseActivity { ...@@ -59,6 +63,9 @@ public class MainActivity extends BaseActivity {
casConnexion = new CASConnexion(nemopaySession); casConnexion = new CASConnexion(nemopaySession);
config = new Config(sharedPreferences); config = new Config(sharedPreferences);
this.internetBroadcast = new InternetBroadcast();
registerReceiver(this.internetBroadcast, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
final String key = sharedPreferences.getString("key", ""); final String key = sharedPreferences.getString("key", "");
if (!key.equals("")) if (!key.equals(""))
setKey(key); setKey(key);
...@@ -108,6 +115,7 @@ public class MainActivity extends BaseActivity { ...@@ -108,6 +115,7 @@ public class MainActivity extends BaseActivity {
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
unregisterReceiver(this.internetBroadcast);
disconnect(); disconnect();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment