Controlling metal-polymer interfaces for optoelectronic devices