Пример #1
0
  @Override
  protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);

    if (!activity.isFinishing() && progress_dialog.isShowing()) {
      progress_dialog.dismiss();
    }

    if (passExporter.exception != null) {
      App.component()
          .tracker()
          .trackException("passExporterException", passExporter.exception, false);
      Toast.makeText(activity, "could not export pass " + passExporter.exception, Toast.LENGTH_LONG)
          .show();
      return;
    }

    if (share_after_export) {
      final Intent it = new Intent(Intent.ACTION_SEND);
      it.putExtra(Intent.EXTRA_SUBJECT, activity.getString(R.string.passbook_is_shared_subject));
      it.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + passExporter.fullZipFileName));
      it.setType("application/vnd.apple.pkpass");
      activity.startActivity(
          Intent.createChooser(it, activity.getString(R.string.passbook_share_chooser_title)));
    }
  }
Пример #2
0
  @Override
  public void setUp() throws Exception {
    super.setUp();

    App.setComponent(
        DaggerTestComponent.builder().testModule(new TestModule(new ArrayList<Pass>())).build());
    getActivity();
  }
 private void scrollToType(String type) {
   for (int i = 0; i < passadapter.getCount(); i++) {
     if (App.getPassStore().getReducedPassbookAt(i).getTypeNotNull().equals(type)) {
       listView.setSelection(i);
       return; // we are done
     }
   }
 }
  @Override
  protected void onResume() {

    super.onResume();

    if (App.getPassStore().isEmpty()) {
      scan_task = new ScanForPassesTask();
      scan_task.execute();
    }

    updateUIToScanningState();

    Tracker.get().trackEvent("ui_event", "resume", "passes", (long) App.getPassStore().passCount());

    App.getBus().register(this);

    refreshPasses();
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      View res = inflater.inflate(R.layout.pass_list_item, null);

      PassVisualizer.visualize(
          TicketListActivity.this, App.getPassStore().getReducedPassbookAt(position), res);

      return res;
    }
  @Override
  protected void onPause() {
    App.getBus().unregister(this);

    if (scan_task != null) {
      scan_task.cancel(true);
    }
    scanning = false;
    super.onPause();
  }
Пример #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!passbook.isValid()) { // don't deal with invalid passes
      new AlertDialog.Builder(this)
          .setMessage(getString(R.string.pass_problem))
          .setTitle(getString(R.string.problem))
          .setPositiveButton(
              android.R.string.ok,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  finish();
                }
              })
          .setNeutralButton(
              getString(R.string.send),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  new ExportProblemPassToLigiAndFinishTask(
                          TicketViewActivity.this,
                          passbook.getPath(),
                          TicketDefinitions.getShareDir(TicketViewActivity.this),
                          "share.pkpass")
                      .execute();
                }
              })
          .show();
      return;
    }

    View contentView = getLayoutInflater().inflate(R.layout.activity_ticket_view, null);
    setContentView(contentView);

    ButterKnife.inject(this);

    barcode_img.setImageBitmap(
        passbook.getBarcodeBitmap(AXT.at(getWindowManager()).getSmallestSide() / 3));
    logo_img.setImageBitmap(passbook.getLogoBitmap());

    logo_img.setBackgroundColor(passbook.getBackGroundColor());
    thumbnail_img.setImageBitmap(passbook.getThumbnailImage());

    if (findViewById(R.id.map_container) != null) {
      if (!(passbook.getLocations().size() > 0 && PassbookMapsFacade.init(this))) {
        findViewById(R.id.map_container).setVisibility(View.GONE);
      }
    }

    if (passbook.getType() != null) {
      String front_str = "";
      front_str += PassVisualizer.getFieldListAsString(passbook.getPrimaryFields());
      front_str += PassVisualizer.getFieldListAsString(passbook.getSecondaryFields());
      front_str += PassVisualizer.getFieldListAsString(passbook.getHeaderFields());
      front_str += PassVisualizer.getFieldListAsString(passbook.getAuxiliaryFields());

      front_tv.setText(Html.fromHtml(front_str));
    }
    String back_str = "";

    if (App.isDeveloperMode()) {
      back_str += getPassDebugInfo(passbook);
    }

    back_str += PassVisualizer.getFieldListAsString(passbook.getBackFields());

    back_tv.setText(Html.fromHtml(back_str));

    Linkify.addLinks(back_tv, Linkify.ALL);
    PassVisualizer.visualize(this, new ReducedPassInformation(passbook), contentView);
  }
 public void refreshPasses() {
   App.getPassStore().refreshPassesList();
   App.getPassStore().sort(App.getSettings().getSortOrder());
   passadapter.notifyDataSetChanged();
 }
 @OnItemClick(R.id.content_list)
 void lisItemCick(int position) {
   Intent intent = new Intent(TicketListActivity.this, TicketViewActivity.class);
   intent.putExtra("path", App.getPassStore().getPassbookAt(position).getPath());
   startActivity(intent);
 }
 @Override
 public int getCount() {
   return App.getPassStore().passCount();
 }