Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
6
600SeriesAndroidUploader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cgm
uploader
600SeriesAndroidUploader
Commits
08217717
Unverified
Commit
08217717
authored
7 years ago
by
Johannes Mockenhaupt
Browse files
Options
Downloads
Patches
Plain Diff
Clear USB disconnect notification when USB is reconnected.
parent
9600f5b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/info/nightscout/android/medtronic/MainActivity.java
+10
-3
10 additions, 3 deletions
.../java/info/nightscout/android/medtronic/MainActivity.java
with
10 additions
and
3 deletions
app/src/main/java/info/nightscout/android/medtronic/MainActivity.java
+
10
−
3
View file @
08217717
...
@@ -82,6 +82,7 @@ import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
...
@@ -82,6 +82,7 @@ import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
public
class
MainActivity
extends
AppCompatActivity
implements
OnSharedPreferenceChangeListener
,
OnEulaAgreedTo
{
public
class
MainActivity
extends
AppCompatActivity
implements
OnSharedPreferenceChangeListener
,
OnEulaAgreedTo
{
private
static
final
String
TAG
=
MainActivity
.
class
.
getSimpleName
();
private
static
final
String
TAG
=
MainActivity
.
class
.
getSimpleName
();
public
static
final
int
USB_DISCONNECT_NOFICATION_ID
=
1
;
public
static
final
float
MMOLXLFACTOR
=
18.016f
;
public
static
final
float
MMOLXLFACTOR
=
18.016f
;
public
static
int
batLevel
=
0
;
public
static
int
batLevel
=
0
;
...
@@ -461,8 +462,6 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
...
@@ -461,8 +462,6 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
}
}
private
void
showDisconnectionNotification
(
String
title
,
String
message
)
{
private
void
showDisconnectionNotification
(
String
title
,
String
message
)
{
int
notifyId
=
1
;
NotificationCompat
.
Builder
mBuilder
=
NotificationCompat
.
Builder
mBuilder
=
(
NotificationCompat
.
Builder
)
new
NotificationCompat
.
Builder
(
this
)
(
NotificationCompat
.
Builder
)
new
NotificationCompat
.
Builder
(
this
)
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
...
@@ -488,7 +487,12 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
...
@@ -488,7 +487,12 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
NotificationManager
mNotificationManager
=
NotificationManager
mNotificationManager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
// notifyId allows you to update the notification later on.
// notifyId allows you to update the notification later on.
mNotificationManager
.
notify
(
notifyId
,
mBuilder
.
build
());
mNotificationManager
.
notify
(
USB_DISCONNECT_NOFICATION_ID
,
mBuilder
.
build
());
}
private
void
clearUsbDisconnectedNotification
()
{
NotificationManager
notificationManager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
notificationManager
.
cancel
(
MainActivity
.
USB_DISCONNECT_NOFICATION_ID
);
}
}
@Override
@Override
...
@@ -934,6 +938,9 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
...
@@ -934,6 +938,9 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
}
}
}
else
if
(
UsbManager
.
ACTION_USB_DEVICE_ATTACHED
.
equals
(
action
))
{
}
else
if
(
UsbManager
.
ACTION_USB_DEVICE_ATTACHED
.
equals
(
action
))
{
Log
.
d
(
TAG
,
"USB plugged in"
);
Log
.
d
(
TAG
,
"USB plugged in"
);
if
(
mEnableCgmService
)
{
clearUsbDisconnectedNotification
();
}
if
(
hasUsbPermission
())
{
if
(
hasUsbPermission
())
{
// Give the USB a little time to warm up first
// Give the USB a little time to warm up first
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment