Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TucWLAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
urz-anwendungen
TucWLAN
Commits
9cb21884
Commit
9cb21884
authored
Jan 17, 2019
by
Toni Beier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle WIFI and connectivity changes
parent
882cab3d
Pipeline
#22853
passed with stages
in 3 minutes and 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
app/src/main/java/de/tu_chemnitz/wlan/MainActivity.java
app/src/main/java/de/tu_chemnitz/wlan/MainActivity.java
+32
-1
No files found.
app/src/main/java/de/tu_chemnitz/wlan/MainActivity.java
View file @
9cb21884
...
...
@@ -75,6 +75,8 @@ public class MainActivity extends AppCompatActivity {
boolean
inInstall
=
false
,
canLeaveInstall
=
false
;
int
useCache
=
0
;
// <0 - false ; 0 - undefined ; >0 - true
private
NetworkChangeReciever
networkChangeReciever
=
null
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -141,6 +143,14 @@ public class MainActivity extends AppCompatActivity {
super
.
onResume
();
recomputeLayout
();
IntentFilter
networkChangeRecieverIntentFilter
=
new
IntentFilter
();
networkChangeRecieverIntentFilter
.
addAction
(
WifiManager
.
SUPPLICANT_CONNECTION_CHANGE_ACTION
);
networkChangeRecieverIntentFilter
.
addAction
(
ConnectivityManager
.
CONNECTIVITY_ACTION
);
this
.
networkChangeReciever
=
new
NetworkChangeReciever
();
Log
.
d
(
"network_change_broadcast"
,
"register receiver"
);
this
.
registerReceiver
(
this
.
networkChangeReciever
,
networkChangeRecieverIntentFilter
);
}
private
void
recomputeLayout
()
{
...
...
@@ -172,6 +182,14 @@ public class MainActivity extends AppCompatActivity {
}
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
Log
.
d
(
"network_change_broadcast"
,
"unregister receiver"
);
this
.
unregisterReceiver
(
this
.
networkChangeReciever
);
}
private
void
recomputeLayoutStatus
()
{
ticks_status
=
Helper
.
getNetworkStatus
(
MainActivity
.
this
,
"\"eduroam\""
);
...
...
@@ -806,4 +824,17 @@ public class MainActivity extends AppCompatActivity {
params
.
setMargins
((
subentry
?
50
:
0
),
0
,
0
,
10
);
return
params
;
}
}
private
class
NetworkChangeReciever
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
try
{
Log
.
d
(
"network_change_broadcast"
,
"Get action: "
+
intent
.
getAction
());
recomputeLayout
();
}
catch
(
Exception
exception
)
{
Log
.
d
(
"network_change_broadcast"
,
"Error while recompute ticklist"
,
exception
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment