Пример #1
0
  @Override
  public void onStop() {
    Log.i("fbreader", "onStop");
    PopupPanel.removeAllWindows(FBReaderApp.Instance());
    super.onStop();
    Process process = null;
    String appRoot = getApplicationContext().getFilesDir().getParent();
    try {

      process = Runtime.getRuntime().exec("su -c " + appRoot + "/lib/libexekillevklistener.so");
      process.waitFor();
      evkListenerProcess = null;
    } catch (Exception e) {

      e.printStackTrace();

    } finally {

      process.destroy();
    }
  }
Пример #2
0
  @Override
  public void onResume() {
    super.onResume();
    try {
      sendBroadcast(new Intent(getApplicationContext(), KillerCallback.class));
    } catch (Throwable t) {
    }
    PopupPanel.restoreVisibilities(FBReaderApp.Instance());
    Log.i("fbreader", "onResume");

    if (evkListenerProcess != null) return;

    String appRoot = getApplicationContext().getFilesDir().getParent();
    try {

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

    } catch (Exception e) {

      e.printStackTrace();
    }
  }
Пример #3
0
  private SimplePlot createPlot(
      final String id, Markings markings, String xAxisLabel, double yMinimum, boolean isMetric) {
    PlotOptions plotOptions = new PlotOptions();
    plotOptions.setZoomOptions(new ZoomOptions().setAmount(1.02));
    plotOptions.setGlobalSeriesOptions(
        new GlobalSeriesOptions()
            .setLineSeriesOptions(
                new LineSeriesOptions().setLineWidth(1).setShow(true).setFill(0.1))
            .setPointsOptions(new PointsSeriesOptions().setRadius(1).setShow(true))
            .setShadowSize(0d));

    plotOptions.setPanOptions(new PanOptions().setInteractive(true));

    if (isMetric) {
      plotOptions.addXAxisOptions(
          new AxisOptions()
              .setZoomRange(true)
              .setTickDecimals(0)
              .setTickFormatter(
                  new TickFormatter() {
                    @Override
                    public String formatTickValue(double tickValue, Axis axis) {
                      if (tickValue >= 0 && tickValue < chosenSessions.size())
                        return chosenSessions.get((int) tickValue);
                      else return "";
                    }
                  }));
    } else {
      plotOptions.addXAxisOptions(new AxisOptions().setZoomRange(true).setMinimum(0));
    }

    plotOptions.addYAxisOptions(new AxisOptions().setZoomRange(false).setMinimum(yMinimum));

    plotOptions.setLegendOptions(new LegendOptions().setNumOfColumns(2));

    if (markings == null) {
      // Make the grid hoverable
      plotOptions.setGridOptions(new GridOptions().setHoverable(true));
    } else {
      // Make the grid hoverable and add  markings
      plotOptions.setGridOptions(
          new GridOptions().setHoverable(true).setMarkings(markings).setClickable(true));
    }

    // create the plot
    SimplePlot plot = new SimplePlot(plotOptions);
    plot.setHeight(200);
    plot.setWidth("100%");

    final PopupPanel popup = new PopupPanel();
    popup.addStyleName(getResources().css().infoPanel());
    final HTML popupPanelContent = new HTML();
    popup.add(popupPanelContent);

    // add hover listener
    if (isMetric) {
      plot.addHoverListener(
          new ShowCurrentValueHoverListener(popup, popupPanelContent, xAxisLabel, chosenSessions),
          false);
    } else {
      plot.addHoverListener(
          new ShowCurrentValueHoverListener(popup, popupPanelContent, xAxisLabel, null), false);
    }

    if (!isMetric && markings != null && !markingsMap.isEmpty()) {
      final PopupPanel taskInfoPanel = new PopupPanel();
      taskInfoPanel.setWidth("200px");
      taskInfoPanel.addStyleName(getResources().css().infoPanel());
      final HTML taskInfoPanelContent = new HTML();
      taskInfoPanel.add(taskInfoPanelContent);
      taskInfoPanel.setAutoHideEnabled(true);

      plot.addClickListener(
          new ShowTaskDetailsListener(id, markingsMap, taskInfoPanel, 200, taskInfoPanelContent),
          false);
    }

    return plot;
  }