Android Open Source - rtwong-notes Summary Activity






From Project

Back to project page rtwong-notes.

License

The source code is released under:

GNU General Public License

If you think the Android project rtwong-notes 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 ca.ualberta.cs.rtwong_notes;
//from w  w  w .j a  v  a  2  s.  co m
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;

// prints to a list the current stats of the app
public class SummaryActivity extends Activity {

  private DataManager dataManager;
  
  private ToDoList todoList;
  
  private ArrayAdapter<String> summaryViewAdapter;
  
  private ListView summaryListView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.activity_summary);
    summaryListView = (ListView) findViewById(R.id.summaryListView);
  }

    @Override
    protected void onStart() {
      super.onStart();
      dataManager = new DataManager(getApplicationContext());
      todoList = this.loadToDoList();
      summaryViewAdapter = new ArrayAdapter<String> (this, R.layout.list_item, todoList.getSummary());
      summaryListView.setAdapter(summaryViewAdapter);
    }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.summary, menu);
    return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();    
        switch (id) {
        case R.id.switchArchive:
          Intent archiveIntent = new Intent(this, ArchiveActivity.class);
          startActivity(archiveIntent);
          return true;
        case R.id.switchToDo:
          Intent todoIntent = new Intent(this, MainActivity.class);
          startActivity(todoIntent);
          return true;
        case R.id.switchEmail:
          Intent emailIntent = new Intent(this, EmailActivity.class);
          startActivity(emailIntent);
          return true;
        default:
          return super.onOptionsItemSelected(item);
        }
  }
  
  public ToDoList loadToDoList() {
    return dataManager.load();
  }
}




Java Source Code List

ca.ualberta.cs.rtwong_notes.ArchiveActivity.java
ca.ualberta.cs.rtwong_notes.DataManager.java
ca.ualberta.cs.rtwong_notes.EmailActivity.java
ca.ualberta.cs.rtwong_notes.EmailArchived.java
ca.ualberta.cs.rtwong_notes.EmailCurrent.java
ca.ualberta.cs.rtwong_notes.MainActivity.java
ca.ualberta.cs.rtwong_notes.SummaryActivity.java
ca.ualberta.cs.rtwong_notes.ToDoList.java
ca.ualberta.cs.rtwong_notes.ToDo.java