Android Open Source - disconnected-content-explorer-android Report Grid Activity






From Project

Back to project page disconnected-content-explorer-android.

License

The source code is released under:

MIT License

If you think the Android project disconnected-content-explorer-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 mil.nga.dice.gridview;
/*from w w  w.j a v  a 2s . c  om*/
import java.util.ArrayList;

import mil.nga.dice.R;
import mil.nga.dice.listview.ReportListActivity;
import mil.nga.dice.map.ReportMapActivity;
import mil.nga.dice.report.Report;
import mil.nga.dice.report.ReportManager;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class ReportGridActivity extends Activity {

  private static final String TAG = "ReportGridActivity";
  ArrayList<Report> mReports;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_report_grid);
    
    Bundle bundle = getIntent().getExtras();
    mReports = bundle.getParcelableArrayList(ReportGridFragment.ARG_REPORTS);
    
    if (getFragmentManager().findFragmentByTag(TAG) == null) {
      final FragmentTransaction ft = getFragmentManager().beginTransaction();
      ft.add(android.R.id.content, new ReportGridFragment(), TAG);
      ft.commit();
    }
  }
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.grid_menu, menu);
      return true;
  }
  
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.list_button:
        showListView();
        return true;
      case R.id.map_button:
        showMapView();
        return true;
    }
    
    return super.onOptionsItemSelected(item);
  }
  
  
  private void showListView() {
    Intent listIntent = new Intent(this, ReportListActivity.class);
    ReportManager reportManger = ReportManager.getInstance();
    ArrayList<Report> reportArrayList = new ArrayList<Report>(reportManger.getReports());
    listIntent.putParcelableArrayListExtra("reports", reportArrayList);
    startActivity(listIntent);
  }
  
  
  private void showMapView() {
    Intent mapIntent = new Intent(this, ReportMapActivity.class);
    ReportManager reportManger = ReportManager.getInstance();
    ArrayList<Report> reportArrayList = new ArrayList<Report>(reportManger.getReports());
    mapIntent.putParcelableArrayListExtra("reports", reportArrayList);
    startActivity(mapIntent);
  }
}




Java Source Code List

mil.nga.dice.DICE.java
mil.nga.dice.gridview.CustomGrid.java
mil.nga.dice.gridview.ReportGridActivity.java
mil.nga.dice.gridview.ReportGridFragment.java
mil.nga.dice.jackson.deserializer.Deserializer.java
mil.nga.dice.jackson.deserializer.FeatureDeserializer.java
mil.nga.dice.jackson.deserializer.GeometryDeserializer.java
mil.nga.dice.listview.CustomList.java
mil.nga.dice.listview.ReportListActivity.java
mil.nga.dice.listview.ReportListFragment.java
mil.nga.dice.listview.ReportListItem.java
mil.nga.dice.map.BackgroundTileProvider.java
mil.nga.dice.map.OfflineMapLoader.java
mil.nga.dice.map.OfflineMap.java
mil.nga.dice.map.ReportMapActivity.java
mil.nga.dice.map.ReportMapFragment.java
mil.nga.dice.report.NoteActivity.java
mil.nga.dice.report.NoteFragment.java
mil.nga.dice.report.ReportDetailActivity.java
mil.nga.dice.report.ReportDetailFragment.java
mil.nga.dice.report.ReportDropbox.java
mil.nga.dice.report.ReportManager.java
mil.nga.dice.report.ReportUnzipRunnable.java
mil.nga.dice.report.Report.java