Android Open Source - openmbta-android Trans Details






From Project

Back to project page openmbta-android.

License

The source code is released under:

Copyright (c) 2014 Kaja Software Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal...

If you think the Android project openmbta-android 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 com.kaja.openmbta;
/*from w ww .  j  ava  2  s.  c  om*/
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.view.View.OnKeyListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;

import android.app.Dialog;
import android.widget.AdapterView.OnItemClickListener;
import android.app.AlertDialog;
import android.view.LayoutInflater;

public class TransDetails extends Activity {
    
  
    //private boolean addingNew = false;
    private ArrayList<String> transItems;
    private ListView myListView;
    private ArrayAdapter<String> aa;
    
    static final private int TRANS_DIALOG = 1;
    String selectedTrans;
  
  /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        
        // Get references to UI widgets
    //    myListView = (ListView)findViewById(R.id.myListView);
        myListView = (ListView)findViewById(android.R.id.list);
          transItems = new ArrayList<String>();
        
        int resID = android.R.layout.simple_list_item_1;
        aa = new ArrayAdapter<String>(this, resID, transItems);
        loadItems();
        myListView.setAdapter(aa);
        
        
        myListView.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView _av, View _v, int _index, long arg3) {
              selectedTrans = transItems.get(_index);
              showDialog(TRANS_DIALOG);
            }
          });
        
    }
    
    public Dialog onCreateDialog(int id) {
        switch(id) {
          case (TRANS_DIALOG) :
           LayoutInflater li = LayoutInflater.from(this);
            View transDetailsView = li.inflate(R.layout.dialog_details, null);

            AlertDialog.Builder transDialog = new AlertDialog.Builder(this);
            transDialog.setTitle("OpenMBTA");
            transDialog.setView(transDetailsView);
            return transDialog.create();
        }
        return null;
      }
    @Override
    public void onPrepareDialog(int id, Dialog dialog) {
      switch(id) {
        case (TRANS_DIALOG) :
          //SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
          //String dateString = sdf.format(selectedQuake.getDate()); 
          //String transText =
           

          AlertDialog transDialog = (AlertDialog)dialog;
          transDialog.setTitle("OnPrepare");
          TextView tv = (TextView)transDialog.findViewById(R.id.dialogDetailsTextView);
          tv.setText(selectedTrans);

          break;
      }
    }
    
    
    private void loadItems(){
      transItems.add(0, "Line 5-1 \nLine 5-2");
      transItems.add(0, "Line4");
      transItems.add(0, "Line3");
      transItems.add(0, "Line2");
      transItems.add(0, "Line1");

      aa.notifyDataSetChanged();
    }
}




Java Source Code List

com.kaja.openmbta.JsonParser.java
com.kaja.openmbta.KajaItemizedOverlay.java
com.kaja.openmbta.MergeAdapter.java
com.kaja.openmbta.OpenMBTA.java
com.kaja.openmbta.RItemizedOverlay.java
com.kaja.openmbta.RoutesItemizedOverlay.java
com.kaja.openmbta.Routes.java
com.kaja.openmbta.ScheduleAdapter.java
com.kaja.openmbta.ScheduleItem.java
com.kaja.openmbta.ScheduleTab.java
com.kaja.openmbta.SplashScreen.java
com.kaja.openmbta.TransDetails.java
com.kaja.openmbta.WebViewer.java
com.kaja.openmbta.hashFile.java
com.kaja.openmbta.transAdapter.java
com.kaja.openmbta.transItem.java
com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.java
com.readystatesoftware.mapviewballoons.BalloonOverlayView.java