Android Open Source - BusTicketer Bus Timer






From Project

Back to project page BusTicketer.

License

The source code is released under:

Copyright (c) 2013, Nelspike All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Red...

If you think the Android project BusTicketer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package bus.ticketer.utils;
//  w w w .j  a  v  a  2  s . c o m
import bus.ticketer.adapters.CentralPagerAdapter;
import bus.ticketer.fragments.ShowTicketsFragment;
import bus.ticketer.passenger.BusTicketer;
import bus.ticketer.runnable.TimerRunnable;
import android.app.Activity;
import android.os.CountDownTimer;
import android.view.View;

public class BusTimer extends CountDownTimer {

  private View view;
  private BusTicketer app;
  private String finalTicketFile;
  
  public BusTimer(long millisInFuture, long countDownInterval, View view, Activity context, String finalFile) {
    super(millisInFuture, countDownInterval);
    this.view = view;
    this.finalTicketFile = finalFile;
    app = (BusTicketer) context.getApplicationContext();
    
  }

  @Override
  public void onFinish() {
    view.post(new TimerRunnable(view, "Finish", 0));
    app.setTimerOn(false);
    app.setSuccessValidity(false);
    app.setWaitingValidation(false);
    FileHandler fh = new FileHandler(finalTicketFile, "");
    fh.deleteFile();
    
    ((ShowTicketsFragment)((CentralPagerAdapter) app.getAppViewPager().getAdapter()).instantiateItem(app.getAppViewPager(), 0)).refresh();
  }

  @Override
  public void onTick(long millisUntilFinished) {
    view.post(new TimerRunnable(view, "Update", millisUntilFinished));
  }
  
  public void setView(View view) {
    this.view = view;
  }
}




Java Source Code List

bus.ticketer.adapters.CentralPagerAdapter.java
bus.ticketer.adapters.DialogAdapter.java
bus.ticketer.adapters.SpinnerAdapter.java
bus.ticketer.connection.ConnectionRunnable.java
bus.ticketer.connection.ConnectionRunnable.java
bus.ticketer.connection.ConnectionRunnable.java
bus.ticketer.connection.ConnectionThread.java
bus.ticketer.connection.ConnectionThread.java
bus.ticketer.connection.ConnectionThread.java
bus.ticketer.filters.MonthInputFilter.java
bus.ticketer.fragments.BuyTicketsFragment.java
bus.ticketer.fragments.ShowTicketsFragment.java
bus.ticketer.inspector.BusInspector.java
bus.ticketer.inspector.MainActivity.java
bus.ticketer.inspector.ResultActivity.java
bus.ticketer.inspector.ScanActivity.java
bus.ticketer.listeners.BusTabListener.java
bus.ticketer.listeners.PurchaseListener.java
bus.ticketer.listeners.RadioGroupListener.java
bus.ticketer.listeners.SwipeListener.java
bus.ticketer.listeners.TicketPurchaseListener.java
bus.ticketer.listeners.ValidationListener.java
bus.ticketer.objects.Ticket.java
bus.ticketer.passenger.BeamActivity.java
bus.ticketer.passenger.BusTicketer.java
bus.ticketer.passenger.CentralActivity.java
bus.ticketer.passenger.MainActivity.java
bus.ticketer.runnable.BuyRunnable.java
bus.ticketer.runnable.ShowRunnable.java
bus.ticketer.runnable.TimerRunnable.java
bus.ticketer.runnable.TimerThread.java
bus.ticketer.utils.BusTimer.java
bus.ticketer.utils.BusUtils.java
bus.ticketer.utils.FileHandler.java
bus.ticketer.utils.FileWriter.java
bus.ticketer.utils.Method.java
bus.ticketer.utils.Method.java
bus.ticketer.utils.Method.java
bus.ticketer.utils.RESTFunction.java
bus.ticketer.utils.RESTFunction.java
bus.ticketer.utils.RESTFunction.java
bus.ticketer.utils.SpinnerAdapter.java
bus.ticketer.validation.MainActivity.java
bus.ticketer.validation.ResultActivity.java