b/7363553: fix keyboard interaction when re-entering Compose Message activity.

rework the fix for b/7350054, use recommendations from Satoshi to call getWindow().setSoftInputMode()
instead of explicitly showing the keyboard later.

Reduce the number places to call showKeyboard() from 3 places to 1. The new logic is, if there
is a draft for this conversation, we set the window mode to SOFT_INPUT_STATE_VISIBLE, otherwise,
set the window mode to SOFT_INPUT_STATE_HIDDEN. We check DraftCache to see if there is a draft,
and don't need to wait until the full content is loaded to determine that.

In addition, employ a hack to hide the keyboard in onPause(), to avoid a jank caused by
onSizeChanged() called twice when re-entering the Compose activity. This improves the jank
slightly, as we still have to adjust the scroll position, leading to the page jump after the
keyboard is opened. It's arguably a little better than before.

Change-Id: Ic4874c103ae235ce3c813a15bbd72283bc844b1b
2 files changed