diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 3b31a27ea..e70de26e9 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -1948,7 +1948,8 @@ public class MessageView extends K9Activity implements OnClickListener onShowAdditionalHeaders(); break; case R.id.select_text: - emulateShiftHeld(mMessageContentView); + mToggleScrollView.setScrolling(false); + mMessageContentView.emulateShiftHeld(); break; default: return super.onOptionsItemSelected(item); @@ -2677,25 +2678,6 @@ public class MessageView extends K9Activity implements OnClickListener updateDecryptLayout(); } - /* - * Emulate the shift key being pressed to trigger the text selection mode - * of a WebView. - */ - private void emulateShiftHeld(WebView view) - { - try - { - mToggleScrollView.setScrolling(false); - KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, - KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); - shiftPressEvent.dispatch(view); - Toast.makeText(this, R.string.select_text_now, Toast.LENGTH_SHORT).show(); - } - catch (Exception e) - { - Log.e(K9.LOG_TAG, "Exception in emulateShiftHeld()", e); - } - } } diff --git a/src/com/fsck/k9/view/MessageWebView.java b/src/com/fsck/k9/view/MessageWebView.java index d16023469..0bf85078b 100644 --- a/src/com/fsck/k9/view/MessageWebView.java +++ b/src/com/fsck/k9/view/MessageWebView.java @@ -4,9 +4,12 @@ import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.util.Log; +import android.view.KeyEvent; import android.webkit.WebSettings; import android.webkit.WebView; +import android.widget.Toast; import com.fsck.k9.K9; +import com.fsck.k9.R; import java.lang.reflect.Method; @@ -117,4 +120,24 @@ public class MessageWebView extends WebView { // Disable network images by default. This is overriden by preferences. blockNetworkData(true); } + + /* + * Emulate the shift key being pressed to trigger the text selection mode + * of a WebView. + */ + public void emulateShiftHeld() + { + try + { + + KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, + KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); + shiftPressEvent.dispatch(this); + Toast.makeText(getContext() , R.string.select_text_now, Toast.LENGTH_SHORT).show(); + } + catch (Exception e) + { + Log.e(K9.LOG_TAG, "Exception in emulateShiftHeld()", e); + } + } }