fixed maxWindow function in Activities onResume