How adherence to public health measures shapes epidemic spreading: a temporal network model