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






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 va2s.c om*/
import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import mil.nga.dice.R;
import mil.nga.dice.report.Report;
import mil.nga.dice.report.ReportDetailActivity;
import mil.nga.dice.report.ReportManager;

public class ReportGridFragment extends Fragment implements AdapterView.OnItemClickListener {

  public static final String ARG_REPORTS = "reports";

  private CustomGrid mReportsAdapter;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReportsAdapter = new CustomGrid(getActivity(), ReportManager.getInstance().getReports());
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getActivity());
    bm.registerReceiver(new BroadcastReceiver() {
      @Override
      public void onReceive(Context context, Intent intent) {
        mReportsAdapter.notifyDataSetChanged();
      }
    }, new IntentFilter(ReportManager.INTENT_UPDATE_REPORT_LIST));
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.activity_report_grid, container, false);
    final GridView gridView = (GridView) v.findViewById(R.id.report_grid);
    gridView.setAdapter(mReportsAdapter);
    gridView.setOnItemClickListener(this);
    return v;
  }


  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Report report = (Report) mReportsAdapter.getItem(position);
    if (report.isEnabled()) {
      Intent detailIntent = new Intent(getActivity(), ReportDetailActivity.class);
      detailIntent.putExtra("report", report);
      startActivity(detailIntent);
    }
  }
}




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