Merge pull request #1671 from tanja3981/issue1619
Issue1619: Fixed status notification for charging/uncharging
This commit is contained in:
commit
562ccf27cf
1 changed files with 5 additions and 5 deletions
|
@ -48,9 +48,7 @@ class NsClientReceiverDelegate {
|
||||||
bus.post(event);
|
bus.post(event);
|
||||||
|
|
||||||
context.registerReceiver(chargingStateReceiver,
|
context.registerReceiver(chargingStateReceiver,
|
||||||
new IntentFilter(Intent.ACTION_POWER_CONNECTED));
|
new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||||
context.registerReceiver(chargingStateReceiver,
|
|
||||||
new IntentFilter(Intent.ACTION_POWER_DISCONNECTED));
|
|
||||||
|
|
||||||
EventChargingState eventChargingState = chargingStateReceiver.grabChargingState(context);
|
EventChargingState eventChargingState = chargingStateReceiver.grabChargingState(context);
|
||||||
if (eventChargingState != null)
|
if (eventChargingState != null)
|
||||||
|
@ -97,7 +95,7 @@ class NsClientReceiverDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
void processStateChange() {
|
void processStateChange() {
|
||||||
boolean newAllowedState = allowedChargingState && allowedNetworkState;
|
boolean newAllowedState = allowedChargingState && allowedNetworkState;
|
||||||
if (newAllowedState != allowed) {
|
if (newAllowedState != allowed) {
|
||||||
allowed = newAllowedState;
|
allowed = newAllowedState;
|
||||||
bus.post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
|
bus.post(new EventPreferenceChange(R.string.key_nsclientinternal_paused));
|
||||||
|
@ -109,7 +107,9 @@ class NsClientReceiverDelegate {
|
||||||
|
|
||||||
boolean newAllowedState = true;
|
boolean newAllowedState = true;
|
||||||
|
|
||||||
if (!ev.isCharging && chargingOnly) newAllowedState = false;
|
if (!ev.isCharging && chargingOnly) {
|
||||||
|
newAllowedState = false;
|
||||||
|
}
|
||||||
|
|
||||||
return newAllowedState;
|
return newAllowedState;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue