@ -781,6 +781,23 @@ public class Actions
return false ;
}
public static void setDoNotDisturb ( Context context , int desiredDndMode )
{
if ( Build . VERSION . SDK_INT > = Build . VERSION_CODES . M )
{
/ *
if ( ! notificationManager . isNotificationPolicyAccessGranted ( ) )
- - > done externally
* /
Miscellaneous . logEvent ( "i" , context . getResources ( ) . getString ( R . string . soundSettings ) , "Changing DND to " + String . valueOf ( desiredDndMode ) , 4 ) ;
NotificationManager mNotificationManager = ( NotificationManager ) context . getSystemService ( Context . NOTIFICATION_SERVICE ) ;
mNotificationManager . setInterruptionFilter ( desiredDndMode ) ;
}
else
Miscellaneous . logEvent ( "w" , context . getResources ( ) . getString ( R . string . soundSettings ) , "Cannot change DND to " + String . valueOf ( desiredDndMode ) + ". This Android version is too and doesn\'t have that feature, yet." , 4 ) ;
}
@RequiresApi ( api = Build . VERSION_CODES . M )
public static boolean isDoNotDisturbActive ( Context context )
{
@ -915,18 +932,6 @@ public class Actions
}
}
public static void setDND ( Context context , int desiredDndMode )
{
if ( Build . VERSION . SDK_INT > = Build . VERSION_CODES . M )
{
Miscellaneous . logEvent ( "i" , context . getResources ( ) . getString ( R . string . soundSettings ) , "Changing DND to " + String . valueOf ( desiredDndMode ) , 4 ) ;
NotificationManager mNotificationManager = ( NotificationManager ) context . getSystemService ( Context . NOTIFICATION_SERVICE ) ;
mNotificationManager . setInterruptionFilter ( desiredDndMode ) ;
}
else
Miscellaneous . logEvent ( "w" , context . getResources ( ) . getString ( R . string . soundSettings ) , "Cannot change DND to " + String . valueOf ( desiredDndMode ) + ". This Android version is too and doesn\'t have that feature, yet." , 4 ) ;
}
public void useDownloadedWebpage ( String result )
{
// Toast.makeText(context, "Result: " + result, Toast.LENGTH_LONG).show();