Environment-dependent photochromism of silver nanoparticles interfaced with metal-oxide films