Esempio n. 1
0
 @Override
 public boolean onPrepareOptionsMenu(Menu menu) {
   final ZLAndroidApplication application = (ZLAndroidApplication) getApplication();
   if (!application.ShowStatusBarOption.getValue()
       && application.ShowStatusBarWhenMenuIsActiveOption.getValue()) {
     getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
   }
   return super.onPrepareOptionsMenu(menu);
 }
Esempio n. 2
0
 @Override
 public void onOptionsMenuClosed(Menu menu) {
   super.onOptionsMenuClosed(menu);
   final ZLAndroidApplication application = (ZLAndroidApplication) getApplication();
   if (!application.ShowStatusBarOption.getValue()
       && application.ShowStatusBarWhenMenuIsActiveOption.getValue()) {
     getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
   }
 }
Esempio n. 3
0
  @Override
  public void onStart() {
    super.onStart();
    final ZLAndroidApplication application = (ZLAndroidApplication) getApplication();

    final int fullScreenFlag =
        application.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
    if (fullScreenFlag != myFullScreenFlag) {
      finish();
      startActivity(new Intent(this, getClass()));
    }

    final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
    final RelativeLayout root = (RelativeLayout) findViewById(R.id.root_view);
    ((PopupPanel) fbReader.getPopupById(TextSearchPopup.ID))
        .createControlPanel(this, root, PopupWindow.Location.Bottom);
    ((PopupPanel) fbReader.getPopupById(NavigationPopup.ID))
        .createControlPanel(this, root, PopupWindow.Location.Bottom);
    ((PopupPanel) fbReader.getPopupById(SelectionPopup.ID))
        .createControlPanel(this, root, PopupWindow.Location.Floating);

    synchronized (myPluginActions) {
      int index = 0;
      while (index < myPluginActions.size()) {
        fbReader.removeAction(PLUGIN_ACTION_PREFIX + index++);
      }
      myPluginActions.clear();
    }

    sendOrderedBroadcast(
        new Intent(PluginApi.ACTION_REGISTER),
        null,
        myPluginInfoReceiver,
        null,
        RESULT_OK,
        null,
        null);
  }
Esempio n. 4
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    final ZLAndroidApplication application = (ZLAndroidApplication) getApplication();
    myFullScreenFlag =
        application.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, myFullScreenFlag);

    final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
    if (fbReader.getPopupById(TextSearchPopup.ID) == null) {
      new TextSearchPopup(fbReader);
    }
    if (fbReader.getPopupById(NavigationPopup.ID) == null) {
      new NavigationPopup(fbReader);
    }
    if (fbReader.getPopupById(SelectionPopup.ID) == null) {
      new SelectionPopup(fbReader);
    }

    fbReader.addAction(ActionCode.SHOW_LIBRARY, new ShowLibraryAction(this, fbReader));
    fbReader.addAction(ActionCode.SHOW_PREFERENCES, new ShowPreferencesAction(this, fbReader));
    fbReader.addAction(ActionCode.SHOW_BOOK_INFO, new ShowBookInfoAction(this, fbReader));
    fbReader.addAction(ActionCode.SHOW_TOC, new ShowTOCAction(this, fbReader));
    fbReader.addAction(ActionCode.SHOW_BOOKMARKS, new ShowBookmarksAction(this, fbReader));
    fbReader.addAction(
        ActionCode.SHOW_NETWORK_LIBRARY, new ShowNetworkLibraryAction(this, fbReader));

    fbReader.addAction(ActionCode.SHOW_MENU, new ShowMenuAction(this, fbReader));
    fbReader.addAction(ActionCode.SHOW_NAVIGATION, new ShowNavigationAction(this, fbReader));
    fbReader.addAction(ActionCode.SEARCH, new SearchAction(this, fbReader));

    fbReader.addAction(
        ActionCode.SELECTION_SHOW_PANEL, new SelectionShowPanelAction(this, fbReader));
    fbReader.addAction(
        ActionCode.SELECTION_HIDE_PANEL, new SelectionHidePanelAction(this, fbReader));
    fbReader.addAction(
        ActionCode.SELECTION_COPY_TO_CLIPBOARD, new SelectionCopyAction(this, fbReader));
    fbReader.addAction(ActionCode.SELECTION_SHARE, new SelectionShareAction(this, fbReader));
    fbReader.addAction(
        ActionCode.SELECTION_TRANSLATE, new SelectionTranslateAction(this, fbReader));
    fbReader.addAction(ActionCode.SELECTION_BOOKMARK, new SelectionBookmarkAction(this, fbReader));

    fbReader.addAction(ActionCode.PROCESS_HYPERLINK, new ProcessHyperlinkAction(this, fbReader));

    fbReader.addAction(ActionCode.SHOW_CANCEL_MENU, new ShowCancelMenuAction(this, fbReader));
    Process process = null;
    appRoot = getApplicationContext().getFilesDir().getParent();
    Log.i("fbreader", "app root = " + appRoot);
    try {

      process = Runtime.getRuntime().exec("su -c " + appRoot + "/lib/libexechmod.so");

      process.waitFor();

    } catch (Exception e) {

      e.printStackTrace();

    } finally {

      process.destroy();
    }
  }