Android Open Source - BusTicketer Bus Ticketer






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.passenger;
/*from w w w  . j a v a  2s  . com*/
import java.util.ArrayList;

import bus.ticketer.objects.Ticket;
import bus.ticketer.runnable.TimerThread;

import android.app.AlertDialog;
import android.app.Application;
import android.content.Context;
import android.content.DialogInterface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v4.view.ViewPager;
import android.util.SparseArray;

public class BusTicketer extends Application {

    private boolean timerOn = false, waitingValidation = false, successValidity = false;
    private SparseArray<ArrayList<Ticket>> tickets = new SparseArray<ArrayList<Ticket>>();
    private long[] minutes = {15,30,60};
    private String clientFilename = "client", IPAddress = "http://192.168.178.24:81/", ticketType;
    private String fileExtension = ".txt";
    private ViewPager appViewPager;
    private TimerThread timerThread;
    private int ticketID=-1;
    
    public boolean isTimerOn() {
        return timerOn;
    }

    public void setTimerOn(boolean timerOn) {
        this.timerOn = timerOn;
    }

    public boolean isWaitingValidation() {
        return waitingValidation;
    }

    public void setWaitingValidation(boolean waitingValidation) {
        this.waitingValidation = waitingValidation;
    }
    
  public SparseArray<ArrayList<Ticket>> getTickets() {
    return tickets;
  }

  public void setTickets(SparseArray<ArrayList<Ticket>> tickets) {
    this.tickets = tickets;
  }
  
  public void networkPrompt() {
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getApplicationContext());

    alertDialogBuilder.setTitle("No Connection");

    alertDialogBuilder
    .setMessage("Did you turn on your WiFi/Internet connectivity?")
    .setCancelable(false)
    .setPositiveButton("OK",new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog,int id) {
            System.exit(0);
      }
    });

    AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();    
  }
  
    public boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager 
              = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }

  public String getClientFilename() {
    return clientFilename;
  }

  public void setClientFilename(String clientFilename) {
    this.clientFilename = clientFilename;
  }

  public String getIPAddress() {
    return IPAddress;
  }

  public void setIPAddress(String iPAddress) {
    IPAddress = iPAddress;
  }

  public boolean isSuccessValidity() {
    return successValidity;
  }

  public void setSuccessValidity(boolean successValidity) {
    this.successValidity = successValidity;
  }

  public String getTicketType() {
    return ticketType;
  }

  public void setTicketType(String ticketType) {
    this.ticketType = ticketType;
  }

  public long getMinutes(int pos) {
    return pos >= 0 && pos <= 2 ? minutes[pos] : -1;    
  }

  public ViewPager getAppViewPager() {
    return appViewPager;
  }

  public void setAppViewPager(ViewPager appViewPager) {
    this.appViewPager = appViewPager;
  }

  public TimerThread getTimerThread() {
    return timerThread;
  }

  public void setTimerThread(TimerThread timerThread) {
    this.timerThread = timerThread;
  }

  public int getTicketID() {
    return ticketID;
  }

  public void setTicketID(int ticketID) {
    this.ticketID = ticketID;
  }

  public String getFileExtension() {
    return fileExtension;
  }

  public void setFileExtension(String fileExtension) {
    this.fileExtension = fileExtension;
  }
}




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