Commit f67c6925 authored by Janik Steegmüller's avatar Janik Steegmüller Committed by Gabriele

Jelly: The app should not close when search is active and back-button is pressed.

Change-Id: Idac79df88182bfa541cd1417f14b17b61203a4b5
parent f8793e82
......@@ -139,6 +139,8 @@ public class MainActivity extends WebViewExtActivity implements View.OnTouchList
private View mCustomView;
private WebChromeClient.CustomViewCallback mFullScreenCallback;
private boolean mSearchActive = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -287,8 +289,9 @@ public class MainActivity extends WebViewExtActivity implements View.OnTouchList
@Override
public void onBackPressed() {
mSearchController.onCancel();
if (mCustomView != null) {
if (mSearchActive) {
mSearchController.onCancel();
} else if (mCustomView != null) {
onHideCustomView();
} else if (mWebView.canGoBack()) {
mWebView.goBack();
......@@ -418,12 +421,14 @@ public class MainActivity extends WebViewExtActivity implements View.OnTouchList
findViewById(R.id.toolbar_search_bar).setVisibility(View.GONE);
findViewById(R.id.toolbar_search_page).setVisibility(View.VISIBLE);
mSearchController.onShow();
mSearchActive = true;
}
@Override
public void onCancelSearch() {
findViewById(R.id.toolbar_search_page).setVisibility(View.GONE);
findViewById(R.id.toolbar_search_bar).setVisibility(View.VISIBLE);
mSearchActive = false;
}
private void openInNewTab(String url, boolean incognito) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment