/**
   * Shows <tt>AuthorizationRequestedDialog</tt> for the request with given <tt>id</tt>.
   *
   * @param id request identifier for which new dialog will be displayed.
   */
  public static void showDialog(Long id) {
    Context ctx = JitsiApplication.getGlobalContext();

    Intent showIntent = new Intent(ctx, AuthorizationRequestedDialog.class);

    showIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    showIntent.putExtra(EXTRA_REQUEST_ID, id);

    ctx.startActivity(showIntent);
  }
Esempio n. 2
0
  /**
   * Creates new call to given <tt>destination</tt> using selected <tt>provider</tt>.
   *
   * @param context the android context
   * @param destination target callee name.
   * @param provider the provider that will be used to make a call.
   */
  public static void createCall(
      final Context context, final String destination, final ProtocolProviderService provider) {
    if (createCallThread != null) {
      logger.warn("Another call is already being created");
      return;
    } else if (CallManager.getActiveCallsCount() > 0) {
      logger.warn("Another call is in progress");
      return;
    }

    final long dialogId =
        ProgressDialogFragment.showProgressDialog(
            JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL),
            JitsiApplication.getResString(R.string.service_gui_OUTGOING_CALL_MSG, destination));

    createCallThread =
        new Thread("Create call thread") {
          public void run() {
            try {
              CallManager.createCall(provider, destination);
            } catch (Throwable t) {
              logger.error("Error creating the call: " + t.getMessage(), t);
              AndroidUtils.showAlertDialog(
                  context, context.getString(R.string.service_gui_ERROR), t.getMessage());
            } finally {
              if (DialogActivity.waitForDialogOpened(dialogId)) {
                DialogActivity.closeDialog(JitsiApplication.getGlobalContext(), dialogId);
              } else {
                logger.error("Failed to wait for the dialog: " + dialogId);
              }
              createCallThread = null;
            }
          }
        };

    createCallThread.start();
  }
  /** Private constructor for this class. */
  private LibDexLoader() {
    String assetDexName = "jitsi-bundles-dex.jar";
    // Before the dex file can be processed by the DexClassLoader,
    // it has to be first copied from asset resource to a storage location.
    Context ctx = JitsiApplication.getGlobalContext();
    File dexInternalStoragePath = new File(ctx.getDir("dex", Context.MODE_PRIVATE), assetDexName);

    BufferedInputStream bis = null;
    OutputStream dexWriter = null;

    final int BUF_SIZE = 2 * 1024;
    try {
      bis = new BufferedInputStream(ctx.getAssets().open(assetDexName));
      dexWriter = new BufferedOutputStream(new FileOutputStream(dexInternalStoragePath));
      byte[] buf = new byte[BUF_SIZE];
      int len;
      while ((len = bis.read(buf, 0, BUF_SIZE)) > 0) {
        dexWriter.write(buf, 0, len);
      }
      dexWriter.close();
      bis.close();

      // Internal storage where the DexClassLoader writes
      // the optimized dex file to
      final File optimizedDexOutputPath = ctx.getDir("outdex", Context.MODE_PRIVATE);

      this.dexClassLoader =
          new DexClassLoader(
              dexInternalStoragePath.getAbsolutePath(),
              optimizedDexOutputPath.getAbsolutePath(),
              null,
              getClass().getClassLoader());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }