Esempio n. 1
0
 public void showSelectionPanel() {
   final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
   final ZLTextView view = fbReader.getTextView();
   ((SelectionPopup) fbReader.getPopupById(SelectionPopup.ID))
       .move(view.getSelectionStartY(), view.getSelectionEndY());
   fbReader.showPopup(SelectionPopup.ID);
 }
Esempio n. 2
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. 3
0
  @Override
  public void onStart() {
    super.onStart();

    initPluginActions();

    final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary) ZLibrary.Instance();

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

    SetScreenOrientationAction.setOrientation(this, zlibrary.OrientationOption.getValue());

    final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
    final RelativeLayout root = (RelativeLayout) findViewById(R.id.root_view);
    ((PopupPanel) fbReader.getPopupById(TextSearchPopup.ID)).setPanelInfo(this, root);
    ((PopupPanel) fbReader.getPopupById(NavigationPopup.ID)).setPanelInfo(this, root);
    ((PopupPanel) fbReader.getPopupById(SelectionPopup.ID)).setPanelInfo(this, root);
  }
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();
    }
  }
Esempio n. 5
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
    final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary) ZLibrary.Instance();
    myFullScreenFlag =
        zlibrary.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, myFullScreenFlag);

    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);
    }
    setupViews();
    setlistView();

    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.SHARE_BOOK, new ShareBookAction(this, fbReader));
    // edited addaction
    fbReader.addAction(ActionCode.OPEN_BOOK, new OpenBook(this, fbReader));
    fbReader.addAction(
        ActionCode.TOUCH_ACTIONS, new TouchScreenAction(this, fbReader, eventHandler));
    fbReader.addAction(ActionCode.TOGGLE_BOOKMARK, new BookmarkAddDelete(this, fbReader));
    fbReader.addAction(ActionCode.DRAW_POINTER, new drawCursor(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));

    fbReader.addAction(
        ActionCode.SET_SCREEN_ORIENTATION_SYSTEM,
        new SetScreenOrientationAction(this, fbReader, ZLibrary.SCREEN_ORIENTATION_SYSTEM));
    fbReader.addAction(
        ActionCode.SET_SCREEN_ORIENTATION_SENSOR,
        new SetScreenOrientationAction(this, fbReader, ZLibrary.SCREEN_ORIENTATION_SENSOR));
    fbReader.addAction(
        ActionCode.SET_SCREEN_ORIENTATION_PORTRAIT,
        new SetScreenOrientationAction(this, fbReader, ZLibrary.SCREEN_ORIENTATION_PORTRAIT));
    fbReader.addAction(
        ActionCode.SET_SCREEN_ORIENTATION_LANDSCAPE,
        new SetScreenOrientationAction(this, fbReader, ZLibrary.SCREEN_ORIENTATION_LANDSCAPE));
    if (ZLibrary.Instance().supportsAllOrientations()) {
      fbReader.addAction(
          ActionCode.SET_SCREEN_ORIENTATION_REVERSE_PORTRAIT,
          new SetScreenOrientationAction(
              this, fbReader, ZLibrary.SCREEN_ORIENTATION_REVERSE_PORTRAIT));
      fbReader.addAction(
          ActionCode.SET_SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
          new SetScreenOrientationAction(
              this, fbReader, ZLibrary.SCREEN_ORIENTATION_REVERSE_LANDSCAPE));
    }
  }