We develop a subgrid model for the growth of supermassive black holes (BHs) and their associated active galactic nucleus (AGN) feedback in hydrodynamical cosmological simulations. This model transposes previous attempts to describe BH accretion and AGN feedback with the smoothed particle hydrodynamics (SPH) technique to the adaptive mesh refinement framework. It also furthers their development by implementing a new jet-like outflow treatment of the AGN feedback which we combine with the heating mode traditionally used in the SPH approach. Thus, our approach allows one to test the robustness of the conclusions derived from simulating the impact of self-regulated AGN feedback on galaxy formation vis-à-vis the numerical method. Assuming that BHs are created in the early stages of galaxy formation, they grow by mergers and accretion of gas at a Eddington-limited Bondi accretion rate. However this growth is regulated by AGN feedback which we model using two different modes: a quasar-heating mode when accretion rates on to the BHs are comparable to the Eddington rate, and a radio-jet mode at lower accretion rates which not only deposits energy, but also deposits mass and momentum on the grid. In other words, our feedback model deposits energy as a succession of thermal bursts and jet outflows depending on the properties of the gas surrounding the BHs. We assess the plausibility of such a model by comparing our results to observational measurements of the co-evolution of BHs and their host galaxy properties, and check their robustness with respect to numerical resolution. We show that AGN feedback must be a crucial physical ingredient for the formation of massive galaxies as it appears to be able to efficiently prevent the accumulation of and/or expel cold gas out of haloes/galaxies and significantly suppress star formation. Our model predicts that the relationship between BHs and their host galaxy mass evolves as a function of redshift, because of the vigorous accretion of cold material in the early Universe that drives Eddington-limited accretion on to BHs. Quasar activity is also enhanced at high redshift. However, as structures grow in mass and lose their cold material through star formation and efficient BH feedback ejection, the AGN activity in the low-redshift Universe becomes more and more dominated by the radio mode, which powers jets through the hot circumgalactic medium.