Change logic for detecting keyboard view.