diff options
-rw-r--r-- | src/com/android/browser/BaseUi.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index c098045..b9f61e3 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 The Android Open Source Project + * Copyright (c) 2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +76,9 @@ public abstract class BaseUi implements UI { Gravity.CENTER); private static final int MSG_HIDE_TITLEBAR = 1; + private static final int MSG_HIDE_CUSTOM_VIEW = 2; public static final int HIDE_TITLEBAR_DELAY = 1500; // in ms + public static final int HIDE_CUSTOM_VIEW_DELAY = 750; // in ms Activity mActivity; UiController mUiController; @@ -539,22 +542,31 @@ public abstract class BaseUi implements UI { mActivity.setRequestedOrientation(requestedOrientation); } - @Override - public void onHideCustomView() { - ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE); - if (mCustomView == null) - return; + private void hideCustomViewAfterDuration() { + Message msg = Message.obtain(mHandler, MSG_HIDE_CUSTOM_VIEW); + mHandler.sendMessageDelayed(msg, HIDE_CUSTOM_VIEW_DELAY); + } + + private void hideCustomView() { setFullscreen(false); FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView(); decor.removeView(mFullscreenContainer); mFullscreenContainer = null; mCustomView = null; - mCustomViewCallback.onCustomViewHidden(); // Show the content view. mActivity.setRequestedOrientation(mOriginalOrientation); } @Override + public void onHideCustomView() { + ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE); + if (mCustomView == null) + return; + mCustomViewCallback.onCustomViewHidden(); + hideCustomViewAfterDuration(); + } + + @Override public boolean isCustomViewShowing() { return mCustomView != null; } @@ -826,6 +838,8 @@ public abstract class BaseUi implements UI { public void handleMessage(Message msg) { if (msg.what == MSG_HIDE_TITLEBAR) { suggestHideTitleBar(); + } else if (msg.what == MSG_HIDE_CUSTOM_VIEW) { + hideCustomView(); } BaseUi.this.handleMessage(msg); } |