Ejemplo n.º 1
0
    @Override
    protected Void doInBackground(Void... params) {
      try {
        final LocalRepoManager lrm = LocalRepoManager.get(SwapActivity.this);
        publishProgress(getString(R.string.deleting_repo));
        lrm.deleteRepo();
        for (String app : selectedApps) {
          publishProgress(String.format(getString(R.string.adding_apks_format), app));
          lrm.addApp(SwapActivity.this, app);
        }
        lrm.writeIndexPage(sharingUri.toString());
        publishProgress(getString(R.string.writing_index_jar));
        lrm.writeIndexJar();
        publishProgress(getString(R.string.linking_apks));
        lrm.copyApksToRepo();
        publishProgress(getString(R.string.copying_icons));
        // run the icon copy without progress, its not a blocker
        new AsyncTask<Void, Void, Void>() {

          @Override
          protected Void doInBackground(Void... params) {
            lrm.copyIconsToRepo();
            return null;
          }
        }.execute();
      } catch (Exception e) {
        Log.e(TAG, "An error occured while setting up the local repo", e);
      }
      return null;
    }