@Override protected void onPreExecute() { super.onPreExecute(); scanning = true; start_time = System.currentTimeMillis(); Tracker.get().trackEvent("ui_event", "scan", "started", null); updateUIToScanningState(); }
@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 boolean onOptionsItemSelected(MenuItem item) { if (drawerToggle.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case R.id.menu_refresh: Tracker.get().trackEvent("ui_event", "refresh", "from_list", null); new ScanForPassesTask().execute(); return true; case R.id.menu_help: Intent intent = new Intent(this, HelpActivity.class); startActivity(intent); return true; } return super.onOptionsItemSelected(item); }
@Override protected void onCancelled() { Tracker.get().trackEvent("ui_event", "scan", "cancelled", null); super.onCancelled(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.ticket_list); ButterKnife.inject(this); passadapter = new PassAdapter(); listView.setAdapter(passadapter); inflater = getLayoutInflater(); listView.setEmptyView(emptyView); // don't want too many windows in worst case - so check for errors first if (TraceDroid.getStackTraceFiles().length > 0) { Tracker.get().trackEvent("ui_event", "send", "stacktraces", null); TraceDroidEmailSender.sendStackTraces("*****@*****.**", this); } else { // if no error - check if there is a new version of the app Tracker.get().trackEvent("ui_event", "processInputStream", "updatenotice", null); MarketService ms = new MarketService(this); ms.level(MarketService.MINOR).checkVersion(); } drawerToggle = new ActionBarDrawerToggle( this, drawer, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerOpened(View drawerView) { App.getBus().post(new NavigationOpenedEvent()); } }; drawer.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); listView.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick( final AdapterView<?> parent, final View view, final int position, long id) { listView.setItemChecked(position, true); view.refreshDrawableState(); actionMode = new ActionMode.Callback() { @Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { getMenuInflater().inflate(R.menu.activity_ticket_view, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) { if (new PassMenuOptions( TicketListActivity.this, App.getPassStore().getPassbookAt(position)) .process(menuItem)) { actionMode.finish(); return true; } return false; } @Override public void onDestroyActionMode(ActionMode actionMode) { listView.setItemChecked(position, false); actionMode = null; } }; startSupportActionMode(actionMode); return true; } }); ActionBarPullToRefresh.from(this) .allChildrenArePullable() .listener( new OnRefreshListener() { @Override public void onRefreshStarted(View view) { App.getPassStore().deleteCache(); new ScanForPassesTask().execute(); } }) .setup(mPullToRefreshLayout); }