Ejemplo n.º 1
0
 private void connectWithSubApp(Engine engine, Object[] objects, SubApp subApp) {
   Intent intent = new Intent(this, SubAppActivity.class);
   intent.putExtra(ConnectionConstants.ENGINE_CONNECTION, engine);
   intent.putExtra(ConnectionConstants.SEARCH_NAME, objects);
   intent.putExtra(ConnectionConstants.SUB_APP_CONNECTION, subApp.getAppPublicKey());
   intent.putExtra(ConnectionConstants.SUB_APP_CONNECTION_TYPE, subApp.getType());
   intent.setFlags(
       Intent.FLAG_ACTIVITY_NEW_TASK
           | Intent.FLAG_ACTIVITY_CLEAR_TASK
           | Intent.FLAG_ACTIVITY_CLEAR_TOP);
   finish();
   overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
   startActivity(intent);
 }
Ejemplo n.º 2
0
  @Override
  public void changeActivity(String activityName, String appBackPublicKey, Object... objects) {
    //        Method m = null;
    //        try {
    //            m = StrictMode.class.getMethod("incrementExpectedActivityCount", Class.class);
    //            m.invoke(null, WalletActivity.class);
    //        } catch (NoSuchMethodException e) {
    //            e.printStackTrace();
    //        } catch (InvocationTargetException e) {
    //            e.printStackTrace();
    //        } catch (IllegalAccessException e) {
    //            e.printStackTrace();
    //        }

    boolean isConnectionWithOtherApp = false;
    Activity lastActivity = null;
    Activity nextActivity = null;
    SubApp subApp = null;
    try {
      WalletNavigationStructure walletNavigationStructure =
          getWalletRuntimeManager().getLastWallet();
      if (walletNavigationStructure.getPublicKey().equals(appBackPublicKey)) {
        lastActivity = walletNavigationStructure.getLastActivity();
        nextActivity =
            walletNavigationStructure.getActivity(Activities.getValueFromString(activityName));
      } else {
        subApp = getSubAppRuntimeMiddleware().getSubAppByPublicKey(appBackPublicKey);
        if (subApp != null) {
          isConnectionWithOtherApp = true;
          subApp.getActivity(Activities.getValueFromString(activityName));
        }
      }
      if (!isConnectionWithOtherApp) {
        if (!nextActivity.equals(lastActivity)) {
          resetThisActivity();
          loadUI(
              getWalletSessionManager()
                  .getWalletSession(getWalletRuntimeManager().getLastWallet().getPublicKey()));
        }
      } else {
        connectWithSubApp(null, objects, subApp);
      }

    } catch (Exception e) {
      getErrorManager()
          .reportUnexpectedUIException(
              UISource.ACTIVITY,
              UnexpectedUIExceptionSeverity.UNSTABLE,
              new IllegalArgumentException("Error in changeActivity"));
      Toast.makeText(
              getApplicationContext(), "Oooops! recovering from system error", Toast.LENGTH_LONG)
          .show();
    } catch (Throwable throwable) {
      Toast.makeText(
              getApplicationContext(),
              "Oooops! recovering from system error. Throwable",
              Toast.LENGTH_LONG)
          .show();
      throwable.printStackTrace();
    }
  }