Skip to content

Commit ff2fcc7

Browse files
committed
Updated Logic
1 parent 9cc3d37 commit ff2fcc7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/io/github/ratul/topactivity/ui/MainActivity.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
225225
return;
226226
}
227227
if (isChecked && buttonView == mWindowSwitch) {
228-
if (Build.VERSION.SDK_INT >= 24 && DatabaseUtil.hasBattery() && !((PowerManager) getSystemService("power")).isIgnoringBatteryOptimizations(getPackageName())) {
228+
if (Build.VERSION.SDK_INT >= 24 && !DatabaseUtil.hasBattery() && !((PowerManager) getSystemService("power")).isIgnoringBatteryOptimizations(getPackageName())) {
229229
setupBattery();
230230
DatabaseUtil.setHasBattery(true);
231231
return;
@@ -353,6 +353,13 @@ public void onClick(View v) {
353353
fancy.dismiss();
354354
}
355355
});
356+
fancy.getDialog().setOnDismissListener(new DialogInterface.OnDismissListener() {
357+
@Override
358+
public void onDismiss(DialogInterface dialog) {
359+
refreshWindowSwitch();
360+
refreshAccessibilitySwitch();
361+
}
362+
});
356363
fancy.setCancelable(false);
357364
fancy.show();
358365

0 commit comments

Comments
 (0)