示例#1
0
  private void initPluginActions() {
    final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
    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);
  }
示例#2
0
 @Override
 public void onReceive(Context context, Intent intent) {
   final ArrayList<PluginApi.ActionInfo> actions =
       getResultExtras(true)
           .<PluginApi.ActionInfo>getParcelableArrayList(PluginApi.PluginInfo.KEY);
   if (actions != null) {
     synchronized (myPluginActions) {
       final FBReaderApp fbReader = (FBReaderApp) FBReaderApp.Instance();
       int index = 0;
       while (index < myPluginActions.size()) {
         fbReader.removeAction(PLUGIN_ACTION_PREFIX + index++);
       }
       myPluginActions.addAll(actions);
       index = 0;
       for (PluginApi.ActionInfo info : myPluginActions) {
         fbReader.addAction(
             PLUGIN_ACTION_PREFIX + index++,
             new RunPluginAction(FBReader.this, fbReader, info.getId()));
       }
     }
   }
 }
示例#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);
  }