void showTextSearchControls(boolean show) { Log.i( "showTextSearchControls", "show = " + show + " myPanel.ControlPanel " + myPanel.ControlPanel); if (myPanel.ControlPanel == null) { myPanel.ControlPanel = new ControlPanel(this); myPanel.ControlPanel.addButton( ActionCode.FIND_PREVIOUS, false, R.drawable.text_search_previous); myPanel.ControlPanel.addButton( ActionCode.CLEAR_FIND_RESULTS, true, R.drawable.text_search_close); myPanel.ControlPanel.addButton(ActionCode.FIND_NEXT, false, R.drawable.text_search_next); RelativeLayout root = (RelativeLayout) findViewById(R.id.root_view); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); p.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); p.addRule(RelativeLayout.CENTER_HORIZONTAL); root.addView(myPanel.ControlPanel, p); } if (myPanel.ControlPanel != null) { if (show) { myPanel.ControlPanel.show(true); } else { myPanel.ControlPanel.hide(false); } } }
@Override public void onStop() { if (myPanel.ControlPanel != null) { myPanel.ControlPanel.hide(false); myPanel.ControlPanel = null; } fbreader.onWindowClosing(); super.onStop(); }
@Override public void onPause() { /*if (myWakeLock != null) { myWakeLock.release(); }*/ if (myPanel.ControlPanel != null) { myPanel.Visible = myPanel.ControlPanel.getVisibility() == View.VISIBLE; } super.onPause(); }
@Override public boolean onSearchRequested() { final ua.pocketbook.fb2viewer.fbreader.fbreader.FBReader fbreader = (ua.pocketbook.fb2viewer.fbreader.fbreader.FBReader) ZLApplication.Instance(); Log.i("FBReader", "onSearchRequested(), myPanel.ControlPanel = " + myPanel.ControlPanel); if (myPanel.ControlPanel != null) { final boolean visible = myPanel.ControlPanel.getVisibility() == View.VISIBLE; myPanel.ControlPanel.hide(false); SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE); manager.setOnCancelListener( new SearchManager.OnCancelListener() { public void onCancel() { if ((myPanel.ControlPanel != null) && visible) { myPanel.ControlPanel.show(false); } } }); } startSearch(fbreader.TextSearchPatternOption.getValue(), true, null, false); return true; }
@Override public void onResume() { super.onResume(); if (myPanel.ControlPanel != null) { myPanel.ControlPanel.setVisibility(myPanel.Visible ? View.VISIBLE : View.GONE); } /*if (ZLAndroidApplication.Instance().DontTurnScreenOffOption.getValue()) { myWakeLock = ((PowerManager)getSystemService(POWER_SERVICE)). newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "FBReader"); myWakeLock.acquire(); } else { myWakeLock = null; }*/ }