handle network swap #32

Merged
CiufudeanDani merged 2 commits from SD-230 into develop 2022-05-03 08:27:34 +00:00
3 changed files with 218 additions and 451 deletions
Showing only changes of commit b17ba94950 - Show all commits

View File

@ -102,10 +102,8 @@ public class TCPService extends Service {
/** Stop TCP Connection */
public void stopTCPConnection()
{
if(tcp != null)
{
public void stopTCPConnection() {
if(tcp != null) {
tcp.Stop();
tcp = null;
}

View File

@ -593,18 +593,10 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
// network available
Log.v(TAG, "network available");
Log.v(TAG, "tcp: " + (tcp != null));
// if (tcp == null)
// getApplicationContext().bindService(new Intent(context, TCPService.class), serviceConnection, Context.BIND_AUTO_CREATE);
// if (myService != null)
// tcp = myService.getTCPConnection();
if (tcp != null) {
if (tcp.isConnectionUP) {
if (tcp.isConnectionUP)
tcp.isConnectionUP = false;
tcp.Stop();
}
// tcp = null;
uiHandler.post(() -> {
Log.v(TAG, "myService: " + (myService != null));
@ -614,7 +606,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
getApplicationContext().bindService(new Intent(context, TCPService.class), serviceConnection, Context.BIND_AUTO_CREATE);
if (getRadioActivity() != null)
getRadioActivity().onCreate(getRadioActivity().savedInstanceState);
getRadioActivity().onCreate(getRadioActivity().getSavedInstanceState());
if (getMessageActivity() != null)
getMessageActivity().onCreate(getMessageActivity().getSavedInstanceState());
if (getRecordingsActivity() != null)
Review

Is this related to tcp.Stop() above? Is it independent? Why?

Is this related to `tcp.Stop()` above? Is it independent? Why?
@ -817,7 +809,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
if (getHistoryActivity() != null)
getHistoryActivity().setLanguage();
if (getRadioActivity() != null)
getRadioActivity().onCreate(getRadioActivity().savedInstanceState);
getRadioActivity().onCreate(getRadioActivity().getSavedInstanceState());
if (getMessageActivity() != null)
getMessageActivity().onCreate(getMessageActivity().getSavedInstanceState());
if (getRecordingsActivity() != null)
@ -2136,7 +2128,7 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
getApplicationContext().bindService(new Intent(context, TCPService.class), serviceConnection, Context.BIND_AUTO_CREATE);
if (getRadioActivity() != null)
getRadioActivity().onCreate(getRadioActivity().savedInstanceState);
getRadioActivity().onCreate(getRadioActivity().getSavedInstanceState());
if (getMessageActivity() != null)
getMessageActivity().onCreate(getMessageActivity().getSavedInstanceState());
if (getRecordingsActivity() != null)