public static boolean isMailSyncDisabled(Context context){ final boolean hasConnectivity = Utility.hasConnectivity(context); @SuppressLint("MissingPermission") final boolean autoSync = ContentResolver.getMasterSyncAutomatically(); boolean doBackground = true; K9.BACKGROUND_OPS bOps = K9.getBackgroundOps(); switch (bOps) { case NEVER: doBackground = false; break; case ALWAYS: doBackground = true; break; case WHEN_CHECKED_AUTO_SYNC: doBackground = autoSync; break; } return !(doBackground && hasConnectivity); } }
hasConnectivity = Utility.hasConnectivity(getActivity().getApplication());