List of usage examples for android.app SearchManager setOnCancelListener
public void setOnCancelListener(OnCancelListener listener)
From source file:org.geometerplus.android.fbreader.BookmarkFragmentActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); Thread.setDefaultUncaughtExceptionHandler( new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this)); PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this); int theme = PreferenceManager.getDefaultSharedPreferences(this).getInt(IConstants.THEME_PREF, IConstants.THEME_REDTREE);//from ww w . ja v a 2 s. co m switch (theme) { case IConstants.THEME_MYBLACK: setTheme(R.style.Theme_myBlack); break; case IConstants.THEME_LAMINAT: setTheme(R.style.Theme_Laminat); break; case IConstants.THEME_REDTREE: setTheme(R.style.Theme_Redtree); break; } setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); final SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE); manager.setOnCancelListener(null); myBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(FullReaderActivity.BOOK_KEY)); myTabListener = new MyTabListener(); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setSubtitle(ZLResource.resource("menu").getResource("bookmarks").getValue()); }
From source file:org.geometerplus.android.fbreader.QuotesFragmentActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); Thread.setDefaultUncaughtExceptionHandler( new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this)); PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this); int theme = PreferenceManager.getDefaultSharedPreferences(this).getInt(IConstants.THEME_PREF, IConstants.THEME_REDTREE);/*from ww w . j a va 2 s .co m*/ switch (theme) { case IConstants.THEME_MYBLACK: setTheme(R.style.Theme_myBlack); break; case IConstants.THEME_LAMINAT: setTheme(R.style.Theme_Laminat); break; case IConstants.THEME_REDTREE: setTheme(R.style.Theme_Redtree); break; } // requestWindowFeature(Window.FEATURE_NO_TITLE); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); // final SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE); manager.setOnCancelListener(null); // // final TabHost host = getTabHost(); // LayoutInflater.from(this).inflate(R.layout.quotes, host.getTabContentView(), true); myBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(FullReaderActivity.BOOK_KEY)); myTabListener = new MyTabListener(); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (loadCurrentLanguage().equals("en")) { getSupportActionBar().setSubtitle("Quotes"); } else if (loadCurrentLanguage().equals("ru")) { getSupportActionBar().setSubtitle(""); } else if (loadCurrentLanguage().equals("fr")) { getSupportActionBar().setSubtitle("Citations"); } else if (loadCurrentLanguage().equals("de")) { getSupportActionBar().setSubtitle("Zitate"); } else if (loadCurrentLanguage().equals("uk")) { getSupportActionBar().setSubtitle(""); } else { if (Locale.getDefault().getDisplayLanguage().equals("??")) { getSupportActionBar().setSubtitle(""); } else if (Locale.getDefault().getDisplayLanguage().equals("?")) { getSupportActionBar().setSubtitle(""); } else { getSupportActionBar().setSubtitle("Quotes"); } } }
From source file:org.geometerplus.android.fbreader.FBReader.java
@Override public boolean onSearchRequested() { final FBReaderApp.PopupPanel popup = myFBReaderApp.getActivePopup(); myFBReaderApp.hideActivePopup();/*from www . ja va 2s. co m*/ if (DeviceType.Instance().hasStandardSearchDialog()) { final SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE); manager.setOnCancelListener(new SearchManager.OnCancelListener() { public void onCancel() { if (popup != null) { myFBReaderApp.showPopup(popup.getId()); } manager.setOnCancelListener(null); } }); startSearch(myFBReaderApp.MiscOptions.TextSearchPattern.getValue(), true, null, false); } else { SearchDialogUtil.showDialog(this, FBReader.class, myFBReaderApp.MiscOptions.TextSearchPattern.getValue(), new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface di) { if (popup != null) { myFBReaderApp.showPopup(popup.getId()); } } }); } return true; }